add teeworlds
[ub0rlay.git] / games-arcade / teeworlds / teeworlds-0.5.1-r4.ebuild
blob683ec5c5f28efa26e6d038e87bfd554cf2b88b23
1 # Copyright 1999-2009 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: $
5 EAPI="2"
7 inherit toolchain-funcs eutils games
9 BAM_P="bam-0.2.0"
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
14 -> ${BAM_P}.tar.gz"
16 LICENSE="as-is"
17 SLOT="0"
18 KEYWORDS="~amd64 ~x86"
19 IUSE="debug dedicated"
21 RDEPEND="dev-lang/lua
22 !dedicated? (
23 media-libs/libsdl[X,opengl]
24 sys-libs/zlib
26 # has modified wavpack and pnglite in its sources
27 # not worth of effort patching up to system ones
28 DEPEND="${RDEPEND}
29 app-arch/zip"
31 S=${WORKDIR}/${P}-src
32 # that's a temporary fix for datadir location
33 dir=${GAMES_DATADIR}/${PN}
35 src_prepare() {
36 rm -f license.txt
38 epatch "${FILESDIR}"/fix_datadir_search.patch
41 pkg_setup() {
42 dodir /etc/${P}
43 enewgroup games
44 enewuser teeworlds -1 -1 -1 games
47 src_compile() {
48 # compile bam
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
58 eend $?
59 # compile game
60 cd "${S}"
61 sed -i \
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"
67 local opts=""
68 use dedicated && opts="server_"
69 use debug && opts="${opts}debug" || opts="${opts}release"
71 ../${BAM_P}/src/bam -v ${opts}
74 src_install() {
75 if use debug ; then
76 newgamesbin ${PN}_srv_d ${PN}_srv || "newgamesbin failed"
77 else
78 dogamesbin ${PN}_srv || die "dogamesbin failed"
81 if ! use dedicated ; then
82 if use debug ; then
83 newgamesbin ${PN}_d ${PN} || die "newgamesbin failed"
84 else
85 dogamesbin ${PN} || die "dogamesbin failed"
87 newicon other/icons/Teeworlds.ico ${PN}.ico
88 make_desktop_entry ${PN} "Teeworlds"
89 insinto "${dir}"
90 doins -r data || die "doins failed"
91 else
92 insinto "${dir}"/data/maps
93 doins data/maps/* || die "doins failed"
96 dodoc *.txt
97 prepgamesdirs
98 newinitd "${FILESDIR}"/teeworlds_init teeworlds