summaryrefslogtreecommitdiff
blob: 929d22749dad0e324da39dbf7c22d79fe9a4e174 (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
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/games-fps/urbanterror/urbanterror-4.1.1.ebuild,v 1.1 2012/05/24 23:37:46 hasufell Exp $

EAPI=3

inherit eutils games

MY_PV=${PV//./}
IOQ3_SVN=1807
IOQ3_PATCH=ioq3-${IOQ3_SVN}-urt-251210-git-nobumpy

DESCRIPTION="Hollywood tactical shooter based on the ioquake3 engine"
HOMEPAGE="http://www.urbanterror.info/home/"
SRC_URI="http://dev.gentoo.org/~hasufell/distfiles/ioquake3-${IOQ3_SVN}.tar.bz2
	http://dev.gentoo.org/~hasufell/distfiles/${IOQ3_PATCH}.tar.xz
	ftp://ftp.snt.utwente.nl/pub/games/${PN}/old/UrbanTerror_${MY_PV:0:2}_FULL.zip
	http://upload.wikimedia.org/wikipedia/en/5/56/Urbanterror.svg -> ${PN}.svg"

LICENSE="GPL-2 Q3AEULA"
SLOT="0"
KEYWORDS="~amd64 ~x86 -*"
IUSE="+curl dedicated openal server speex vorbis"

RDEPEND="
	sys-libs/zlib[minizip]
	!dedicated? (
		media-libs/ftgl
		media-libs/freetype
		media-libs/libsdl[X,opengl]
		virtual/opengl
		curl? ( net-misc/curl )
		openal? ( media-libs/openal )
		speex? ( media-libs/speex )
		vorbis? ( media-libs/libogg media-libs/libvorbis )
	)"
# server target needs libsdl and some 
# other headers for build-time
# added them for dedicated useflag
DEPEND="${RDEPEND}
	app-arch/unzip
	virtual/pkgconfig
	dedicated? (
		media-libs/libsdl
		curl? ( net-misc/curl )
		speex? ( media-libs/speex )
	)"

S=${WORKDIR}/ioquake3

src_prepare() {
	epatch "${FILESDIR}"/${P}-minizip.patch \
		"${WORKDIR}"/${IOQ3_PATCH}.patch \
		"${FILESDIR}"/${P}-build.patch

	# unbundle
	rm -r code/zlib || die
	rm code/qcommon/unzip.{c,h}  || die
	rm code/qcommon/ioapi.{c,h}  || die
	rm -r code/{FTGL,FT2,SDL12,libs/win32} || die

	# set svn version
	sed \
		-e 's/SVN_REV=$(shell LANG=C svnversion .)/SVN_REV='${IOQ3_SVN}'M/' \
		-i Makefile || die "setting svn version failed"

	# fix case sensitivity
	mv "${WORKDIR}/UrbanTerror/q3ut4/demos/tutorial.dm_68" \
		"${WORKDIR}/UrbanTerror/q3ut4/demos/TUTORIAL.dm_68" || die
}

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

	emake \
		ARCH=$(usex amd64 "x86_64" "i386") \
		DEFAULT_BASEDIR="${GAMES_DATADIR}/${PN}" \
		BUILD_CLIENT=$(nobuildit dedicated) \
		BUILD_CLIENT_SMP=$(nobuildit dedicated) \
		BUILD_SERVER=$(usex dedicated "1" "$(buildit server)") \
		USE_CODEC_VORBIS=$(buildit vorbis) \
		USE_VOIP=$(buildit speex) \
		USE_OPENAL=$(buildit openal) \
		USE_CURL=$(buildit curl) \
		USE_INTERNAL_SPEEX=0 \
		USE_INTERNAL_ZLIB=0 \
		USE_LOCAL_HEADERS=0 \
		OPTIMIZEVM="" \
		Q="" \
		release || die
}

src_install() {
	local my_arch=$(usex amd64 "x86_64" "i386")

	insinto /usr/share/icons/hicolor/scalable/apps
	doins "${DISTDIR}"/${PN}.svg

	dodoc ChangeLog NOTTODO README TODO {md4,voip}-readme.txt

	insinto "${GAMES_DATADIR}"/${PN}/q3ut4
	doins -r "${WORKDIR}"/UrbanTerror/q3ut4/{*.pk3,demos/,description.txt} || die

	if use !dedicated ; then
		newgamesbin build/release-linux-${my_arch}/ioquake3-smp.${my_arch} ${PN} || die
		make_desktop_entry ${PN} "UrbanTerror"
	fi

	if use dedicated || use server ; then
		newgamesbin build/release-linux-${my_arch}/ioq3ded.${my_arch} ${PN}-dedicated || die
		newins "${WORKDIR}"/UrbanTerror/q3ut4/mapcycle.txt mapcycle.txt.example || die
		newins "${WORKDIR}"/UrbanTerror/q3ut4/server.cfg q3config_server.cfg.example || die
	fi

	prepgamesdirs
}