summaryrefslogtreecommitdiff
blob: 721b16e465e49f15e530736c53698efab1adcf1f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/games-fps/xonotic/xonotic-0.5.0.ebuild,v 1.1 2011/09/16 21:52:12 mr_bones_ Exp $

EAPI=2
inherit eutils check-reqs games

MY_PN="${PN^}"
DESCRIPTION="Fork of Nexuiz, Deathmatch FPS based on DarkPlaces, an advanced Quake 1 engine"
HOMEPAGE="http://www.xonotic.org/"
SRC_URI="http://dl.xonotic.org/${P}.zip"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="alsa debug dedicated doc sdl"

UIRDEPEND="
	media-libs/libogg
	media-libs/libtheora
	media-libs/libvorbis
	media-libs/libmodplug
	x11-libs/libX11
	x11-libs/libXau
	x11-libs/libXdmcp
	x11-libs/libXext
	x11-libs/libXxf86dga
	x11-libs/libXxf86vm
	virtual/opengl
	media-libs/freetype:2
	alsa? ( media-libs/alsa-lib )
	sdl? ( media-libs/libsdl[X,audio,joystick,opengl,video,alsa?] )"
UIDEPEND="
	x11-proto/xextproto
	x11-proto/xf86dgaproto
	x11-proto/xf86vidmodeproto
	x11-proto/xproto"
RDEPEND="
	sys-libs/zlib
	virtual/jpeg
	media-libs/libpng
	net-misc/curl
	~dev-libs/d0_blind_id-0.3
	!dedicated? ( ${UIRDEPEND} )"
DEPEND="${RDEPEND}
	!dedicated? ( ${UIDEPEND} )"

S=${WORKDIR}/${MY_PN}

pkg_setup() {
	CHECKREQS_DISK_BUILD="1200M"
	CHECKREQS_DISK_USR="950M"
	check-reqs_pkg_setup
	games_pkg_setup
}

src_prepare() {
	rm -rf misc/buildfiles/ # use system libs

	sed -i \
		-e "/^EXE_/s:darkplaces:${PN}:" \
		-e "s:-O3:${CFLAGS}:" \
		-e "/-lm/s:$: ${LDFLAGS}:" \
		-e '/^STRIP/s/strip/true/' \
		source/darkplaces/makefile.inc || die

	if ! use alsa; then
		sed -i \
			-e "/DEFAULT_SNDAPI/s:ALSA:OSS:" \
			source/darkplaces/makefile || die
	fi
}

src_compile() {
	local t="$(use debug && echo debug || echo release)"

	emake \
		-C source/darkplaces \
		DP_LINK_TO_LIBJPEG=1 DP_FS_BASEDIR="${GAMES_DATADIR}/${PN}" \
		sv-${t} \
		$(use !dedicated && echo "cl-${t} $(use sdl && echo sdl-${t})") \
		|| die
}

src_install() {
	if ! use dedicated; then
		dogamesbin source/darkplaces/${PN}-glx || die
		newicon misc/logos/${PN}_icon.svg ${PN}.svg
		make_desktop_entry ${PN}-glx "${MY_PN} (GLX)"

		if use sdl; then
			dogamesbin source/darkplaces/${PN}-sdl || die
			make_desktop_entry ${PN}-sdl "${MY_PN} (SDL)"
		fi
	fi
	dogamesbin source/darkplaces/${PN}-dedicated || die

	dodoc Docs/*.txt
	use doc && dohtml -r Docs

	insinto "${GAMES_DATADIR}/${PN}"
	doins -r key_0.d0pk server data || die
	prepgamesdirs
}