summaryrefslogtreecommitdiff
blob: bf315f0a2298ad7caef3f3e13a110daba4fb4567 (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
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/games-fps/nexuiz/nexuiz-1.2.1.ebuild,v 1.1 2005/09/18 03:26:32 mr_bones_ Exp $

inherit eutils games

DESCRIPTION="a free deathmatch FPS based on the Quake I engine"
HOMEPAGE="http://www.nexuiz.com"
SRC_URI="mirror://sourceforge/${PN}/${PN}${PV//./}.zip"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~x86"
IUSE="dedicated sdl"

RDEPEND="virtual/opengl
	sdl? ( media-libs/libsdl )
	media-libs/libogg
	media-libs/libvorbis
	media-libs/jpeg
	media-libs/alsa-lib
	sys-libs/zlib"
DEPEND="${RDEPEND}
	dev-util/pkgconfig
	app-arch/unzip"

S=${WORKDIR}/${PN/n/N}

src_unpack() {
	unpack ${A}
	cd "${S}"
	unzip $(ls nexuizenginesource* | head -n 1)

	cd darkplaces
	sed -i \
		-e "/strcpy(fs_basedir/s:\.:${GAMES_DATADIR}/${PN}:" \
		fs.c \
		|| die "sed failed"

	sed -i \
		-e '/^CC/d' \
		-e "s:-lasound:$(pkg-config --libs alsa):" \
		-e 's:darkplaces-sdl:nexuiz-sdl:' \
		-e 's:darkplaces-glx:nexuiz-glx:' \
		-e 's:darkplaces-dedicated:nexuiz-dedicated:' \
		makefile.inc \
		|| die "sed failed"
}

src_compile() {
	cd darkplaces

	emake cl-release \
		CFLAGS_RELEASE="" OPTIM_RELEASE="" \
		CFLAGS_COMMON="${CFLAGS}" \
		|| die "emake cl-release failed"

	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
}

src_install() {
	dogamesbin darkplaces/nexuiz-glx || die "dogamesbin failed"
	if use sdl; then
		dogamesbin darkplaces/nexuiz-sdl || die "dogamesbin failed"
	fi
	if use dedicated; then
		dogamesbin darkplaces/nexuiz-dedicated || die "dogamesbin failed"
	fi

	insinto "${GAMES_DATADIR}"/${PN}
	doins -r data/ || die "doins failed"
	newicon darkplaces/darkplaces72x72.png ${PN}.png

	if use sdl; then
		make_desktop_entry nexuiz-sdl "Nexuiz" ${PN}.png
	else
		make_desktop_entry nexuiz-glx "Nexuiz" ${PN}.png
	fi
	prepgamesdirs
}