summaryrefslogtreecommitdiff
blob: 8d03e141b4c4d677b90d395b95418e6487ba6f56 (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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/games-fps/nexuiz/nexuiz-1.5.ebuild,v 1.1 2006/03/17 19:43:18 wolf31o2 Exp $

inherit eutils games

MY_PV=${PV//./}
MY_PN=${PN/n/N}

DESCRIPTION="Deathmatch FPS based on the Quake 1 engine"
HOMEPAGE="http://www.nexuiz.com"
SRC_URI="mirror://sourceforge/${PN}/${PN}-${MY_PV}.zip"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~ppc ~x86"
IUSE="dedicated opengl sdl"

UIDEPEND="media-libs/alsa-lib
	media-libs/libogg
	media-libs/libvorbis
	|| (
		(
			x11-libs/libX11
			x11-libs/libXau
			x11-libs/libXdmcp
			x11-libs/libXext )
		virtual/x11 )"
RDEPEND="media-libs/jpeg
	sys-libs/glibc
	sys-libs/zlib
	sdl? (
		media-libs/libsdl
		${UIDEPEND} )
	opengl? (
		virtual/opengl
		${UIDEPEND} )
	!dedicated? (
		!sdl? (
			!opengl? (
				virtual/opengl
				${UIDEPEND} ) ) )"
DEPEND="${RDEPEND}
	dev-util/pkgconfig
	app-arch/unzip"

S=${WORKDIR}/${MY_PN}/darkplaces
dir=${GAMES_DATADIR}/${PN}
exe=${PN}

pkg_setup() {
	if ! use dedicated && ! use sdl && ! use opengl
	then
		einfo "Defaulting to OpenGL client"
	fi
}

src_unpack() {
	unpack ${A}
	cd ${MY_PN}
	unzip $(ls -A ${PN}enginesource*.zip) || die "unzip failed"

	cd "${S}"
	sed -i \
		-e '/^CC/d' \
		-e "s:-lasound:$(pkg-config --libs alsa):" \
		makefile.inc \
		|| die "sed makefile failed"
}

src_compile() {
	if use opengl
	then
		emake cl-release \
			CFLAGS_RELEASE="" OPTIM_RELEASE="" \
			CFLAGS_COMMON="${CFLAGS}" \
			|| die "emake cl-release failed"
	fi

	if use sdl
	then
		emake sdl-release \
			CFLAGS_RELEASE="" OPTIM_RELEASE="" \
			CFLAGS_COMMON="${CFLAGS}" \
			|| die "emake sdl-release failed"
	fi

	if use dedicated
	then
		emake sv-release \
			CFLAGS_RELEASE="" OPTIM_RELEASE="" \
			CFLAGS_COMMON="${CFLAGS}" \
			|| die "emake dedicated failed"
	fi

	if ! use dedicated && ! use sdl && ! use opengl
	then
		emake cl-release \
			CFLAGS_RELEASE="" OPTIM_RELEASE="" \
			CFLAGS_COMMON="${CFLAGS}" \
			|| die "emake cl-release failed"
	fi
}

src_install() {
	insinto "${dir}"
	exeinto "${dir}"

	if use opengl || use sdl
	then
		newicon darkplaces72x72.png ${PN}.png
	elif ! use dedicated && ! use sdl && ! use opengl
	then
		newicon darkplaces72x72.png ${PN}.png
	fi

	if use opengl
	then
		newexe darkplaces-glx ${exe} || die "newexe glx failed"
		games_make_wrapper ${PN} ./${exe} "${dir}"
		make_desktop_entry ${PN} Nexuiz ${PN}.png
	fi

	if use sdl
	then
		newexe darkplaces-sdl ${PN}-sdl || die "newexe sdl failed"
		games_make_wrapper ${PN}-sdl ./${PN}-sdl "${dir}"
		make_desktop_entry ${PN}-sdl "Nexuiz (SDL)" ${PN}.png
	fi

	if use dedicated
	then
		newexe darkplaces-dedicated ${PN}-ded || die "newexe ded failed"
		games_make_wrapper ${PN}-ded ./${PN}-ded "${dir}"
	fi

	if ! use dedicated && ! use sdl && ! use opengl
	then
		newexe darkplaces-glx ${exe} || die "newexe glx failed"
		games_make_wrapper ${PN} ./${exe} "${dir}"
		make_desktop_entry ${PN} Nexuiz ${PN}.png
	fi

	cd "${WORKDIR}/${MY_PN}"
	insinto "${dir}/data"
	doins -r data/* || die "doins data failed"
	dodoc Docs/*.txt
	dohtml Docs/*.{htm,html}

	prepgamesdirs
}

pkg_postinst() {
	einfo "For sound problems, read:"
	einfo "   http://www.alientrap.org/forum/viewtopic.php?t=72"

	games_pkg_postinst
}