1 # Copyright 1999-2009 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
7 inherit toolchain-funcs eutils games
10 DESCRIPTION
="Online 2D platform shooter."
11 HOMEPAGE
="http://www.teeworlds.com"
12 SRC_URI
="http://www.teeworlds.com/files/${P}-src.tar.gz -> ${P}-src.tar.gz
13 http://teeworlds.com/trac/bam/browser/releases/bam-0.2.0.tar.gz?format=raw
18 KEYWORDS
="~amd64 ~x86"
19 IUSE
="debug dedicated"
23 media-libs/libsdl[X,opengl]
26 # has modified wavpack and pnglite in its sources
27 # not worth of effort patching up to system ones
32 # that's a temporary fix for datadir location
33 dir
=${GAMES_DATADIR}/${PN}
38 epatch
"${FILESDIR}"/fix_datadir_search.
patch
44 enewuser teeworlds
-1 -1 -1 games
49 ebegin
"Preparing BAM"
50 cd "${WORKDIR}/${BAM_P}"
51 $
(tc-getCC
) ${CFLAGS} src
/tools
/txt2c.c
-o src
/tools
/txt2c || die
52 src
/tools
/txt2c src
/base.bam src
/driver_gcc.bam \
53 src
/driver_cl.bam
> src
/internal_base.h || die
54 # internal lua sources!
55 $
(tc-getCC
) ${CFLAGS} ${LDFLAGS} \
56 src
/lua
/*.c src
/*.c
-o src
/bam \
57 -I /usr
/include
/ -lm -lpthread || die
62 -e "s|Add(\"-Wall\", \"-fno-exceptions|Add(\"|" \
63 -e "s|cc.flags:Add(\"-fstack-protector\", \"-fstack-protector-all\")|cc.flags:Add(\"${CXXFLAGS}\")|" \
64 -e "s|link.flags:Add(\"-fstack-protector\", \"-fstack-protector-all\")|link.flags:Add(\"${LDFLAGS}\")|" \
65 default.bam || die
"sed failed"
68 use dedicated
&& opts
="server_"
69 use debug
&& opts
="${opts}debug" || opts
="${opts}release"
71 ..
/${BAM_P}/src
/bam
-v ${opts}
76 newgamesbin
${PN}_srv_d
${PN}_srv ||
"newgamesbin failed"
78 dogamesbin
${PN}_srv || die
"dogamesbin failed"
81 if ! use dedicated
; then
83 newgamesbin
${PN}_d
${PN} || die
"newgamesbin failed"
85 dogamesbin
${PN} || die
"dogamesbin failed"
87 newicon other
/icons
/Teeworlds.ico
${PN}.ico
88 make_desktop_entry
${PN} "Teeworlds"
90 doins
-r data || die
"doins failed"
92 insinto
"${dir}"/data
/maps
93 doins data
/maps
/* || die
"doins failed"
98 newinitd
"${FILESDIR}"/teeworlds_init teeworlds