summaryrefslogtreecommitdiff
blob: 158259043f80250c96b559827795e660a8e4964a (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
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/games-fps/tremulous/tremulous-1.1.0-r1.ebuild,v 1.2 2007/06/13 21:14:13 nyhm Exp $

inherit eutils toolchain-funcs games

DESCRIPTION="Team-based aliens vs humans FPS with buildable structures"
HOMEPAGE="http://tremulous.net/"
SRC_URI="mirror://sourceforge/${PN}/${P}.zip
	http://0day.icculus.org/mirrors/${PN}/${P}.zip
	ftp://ftp.wireplay.co.uk/pub/quake3arena/mods/${PN}/${P}.zip"

LICENSE="GPL-2
	CCPL-Attribution-ShareAlike-2.5"
SLOT="0"
KEYWORDS="~amd64 ~ppc ~x86"
IUSE="dedicated openal opengl vorbis"

UIDEPEND="openal? ( media-libs/openal )
	media-libs/libsdl
	vorbis? ( media-libs/libogg media-libs/libvorbis )
	virtual/opengl
	x11-libs/libX11
	x11-libs/libXau
	x11-libs/libXdmcp
	x11-libs/libXext"
RDEPEND="opengl? ( ${UIDEPEND} )
	!opengl? ( !dedicated? ( ${UIDEPEND} ) )
	!games-fps/tremulous-bin"
DEPEND="${RDEPEND}
	app-arch/unzip"

S=${WORKDIR}/${PN}/${P}-src

pkg_setup() {
	games_pkg_setup

	if use amd64 ; then
		ewarn "emerge games-fps/tremulous-bin instead for better performance."
		echo
	fi
}

src_unpack() {
	unpack ${A}
	cd ${PN}

	unpack ./${P}-src.tar.gz
	cd "${S}"
	epatch "${FILESDIR}"/${P}-gcc42.patch
}

src_compile() {
	buildit() { use $1 && echo 1 || echo 0 ; }

	local build_client=1
	if use dedicated && ! use opengl ; then
		build_client=0
	fi

	emake \
		BUILD_CLIENT=${build_client} \
		BUILD_SERVER=$(buildit dedicated) \
		CC="$(tc-getCC)" \
		DEFAULT_BASEDIR="${GAMES_DATADIR}/${PN}" \
		USE_CODEC_VORBIS=$(buildit vorbis) \
		USE_OPENAL=$(buildit openal) \
		USE_LOCAL_HEADERS=0 \
		OPTIMIZE= \
		COMPILE_ARCH=${ARCH} \
		|| die "emake failed"
}

src_install() {
	insinto "${GAMES_DATADIR}"/${PN}
	doins -r ../base || die "doins -r failed"

	dodoc ChangeLog ../manual.pdf

	local bindir=build/release-linux-${ARCH}

	if use opengl || ! use dedicated ; then
		newgamesbin ${bindir}/${PN}.${ARCH} ${PN} \
			|| die "newgamesbin client failed"
		doicon misc/${PN}.xpm
		make_desktop_entry ${PN} Tremulous ${PN}.xpm
	fi

	if use dedicated ; then
		newgamesbin ${bindir}/tremded.${ARCH} ${PN}-ded \
			|| die "newgamesbin ded failed"
	fi

	prepgamesdirs
}