add teeworlds
authorFelix Bechstein <f@ub0r.de>
Wed, 25 Mar 2009 15:44:45 +0000 (25 16:44 +0100)
committerFelix Bechstein <f@ub0r.de>
Wed, 25 Mar 2009 15:44:45 +0000 (25 16:44 +0100)
games-arcade/teeworlds/Manifest [new file with mode: 0644]
games-arcade/teeworlds/files/fix_datadir_search.patch [new file with mode: 0644]
games-arcade/teeworlds/files/teeworlds_init [new file with mode: 0644]
games-arcade/teeworlds/teeworlds-0.5.1-r4.ebuild [new file with mode: 0644]

diff --git a/games-arcade/teeworlds/Manifest b/games-arcade/teeworlds/Manifest
new file mode 100644 (file)
index 0000000..224dc10
--- /dev/null
@@ -0,0 +1,5 @@
+AUX fix_datadir_search.patch 1011 RMD160 7da0eb9d174b676a69f7ff1a0de660d5c5a2fa94 SHA1 4fb2a4301c8c745e7f73d9b9f976685c3e5914e1 SHA256 f4357c03f4622c56fa5b2a55b9ac790a9cd00a2697cf4de54f1843d96540c381
+AUX teeworlds_init 1001 RMD160 353aa1fa4128cb42fe53d1917c63be715b0f03c8 SHA1 ba5cf8bae903e65bda9cd9629b2d7d478563bf0b SHA256 9a9bbf40766f2a0fd663a6b306dda8c66b9a9b6adc50753dcb6d0c3970298264
+DIST bam-0.2.0.tar.gz 162342 RMD160 00af151d532bb0452d802e782f1f799abf12c4c5 SHA1 99d86db750fe18ea5b25493850122929bd2c674b SHA256 ef6cddc1df47b0d8106265033ef4e55e61decabf2279a2acd7fdf016633c0758
+DIST teeworlds-0.5.1-src.tar.gz 6392475 RMD160 42b01b67b47f010d9bfb33023ec1bf1bf8600a0f SHA1 4266c43c6e6d61fa718addd5a71db4a9810fc8d2 SHA256 ec72e3439ce4d459410f6dcb6d4fa1bb305d0064323dcb36fa2c6764c372fe78
+EBUILD teeworlds-0.5.1-r4.ebuild 2500 RMD160 8a2206868847ccde005b5efa75ee08d6e1c21958 SHA1 cac2e659edd4a3298057643a70205b5f36dbd0f9 SHA256 6ead7112ca74c8e9a57bd315713622311fdaf58954b2340a7bb005a9e37b477d
diff --git a/games-arcade/teeworlds/files/fix_datadir_search.patch b/games-arcade/teeworlds/files/fix_datadir_search.patch
new file mode 100644 (file)
index 0000000..19a4ae1
--- /dev/null
@@ -0,0 +1,36 @@
+diff -r 9582fcee983b -r c1502459a920 src/engine/e_engine.c
+--- a/src/engine/e_engine.c    Sun Feb 01 20:50:22 2009 +0100
++++ b/src/engine/e_engine.c    Sun Feb 01 21:37:17 2009 +0100
+@@ -539,14 +539,15 @@
+       }
+       
+       /* 2) use data-dir in PWD if present */
+-      if(fs_is_dir("data"))
++      /* test subdir "/mapres" to reject unrelated "data" dir in PWD */
++      if(fs_is_dir("data/mapres"))
+       {
+               strcpy(datadir, "data");
+               return 0;
+       }
+       
+       /* 3) use compiled-in data-dir if present */
+-      if (fs_is_dir(DATA_DIR))
++      if (fs_is_dir(DATA_DIR "/mapres"))
+       {
+               strcpy(datadir, DATA_DIR);
+               return 0;
+@@ -572,9 +573,11 @@
+       /* 5) check for all default locations */
+       {
+               const char *sdirs[] = {
+-                      "/usr/share/teeworlds",
+-                      "/usr/local/share/teeworlds"
+-                      "/opt/teeworlds"
++                      "/usr/share/teeworlds/data",
++                      "/usr/share/games/teeworlds/data",
++                      "/usr/local/share/teeworlds/data",
++                      "/usr/local/share/games/teeworlds/data",
++                      "/opt/teeworlds/data"
+               };
+               const int sdirs_count = sizeof(sdirs) / sizeof(sdirs[0]);
+               
diff --git a/games-arcade/teeworlds/files/teeworlds_init b/games-arcade/teeworlds/files/teeworlds_init
new file mode 100644 (file)
index 0000000..a796cf8
--- /dev/null
@@ -0,0 +1,37 @@
+#!/sbin/runscript
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+PIDFILE=/var/run/teeworlds.pid
+GAME_DIRECTORY=/usr/games/bin
+CONFIG=/etc/teeworlds/teeworlds_srv.cfg
+
+depend() {
+       use dns logger net
+}
+
+checkconfig() {
+        if [ ! -e ${CONFIG} ] ; then
+                eerror "You need an ${CONFIG} config file to run TeeWorlds"
+                return 1
+        fi
+}
+
+start() {
+       ebegin "Starting TeeWorlds"
+       start-stop-daemon --start --background --pidfile "${PIDFILE}" --make-pidfile -d ${GAME_DIRECTORY} --chuid teeworlds --exec ${GAME_DIRECTORY}/teeworlds_srv \
+       -- -f ${CONFIG}
+       eend $?
+}
+
+reload() {
+    ebegin "Reloading TeeWorlds configs and restarting processes"
+    start-stop-daemon --stop --oknodo --chuid teeworlds --pidfile "${PIDFILE}" --signal HUP --exec ${GAME_DIRECTORY}/teeworlds_srv -- -f ${CONFIG}
+    eend $?
+}
+
+stop() {
+       ebegin "Stopping TeeWorlds"
+       start-stop-daemon --stop --quiet --pidfile "${PIDFILE}"
+       eend $?
+}
diff --git a/games-arcade/teeworlds/teeworlds-0.5.1-r4.ebuild b/games-arcade/teeworlds/teeworlds-0.5.1-r4.ebuild
new file mode 100644 (file)
index 0000000..683ec5c
--- /dev/null
@@ -0,0 +1,99 @@
+# Copyright 1999-2009 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI="2"
+
+inherit toolchain-funcs eutils games
+
+BAM_P="bam-0.2.0"
+DESCRIPTION="Online 2D platform shooter."
+HOMEPAGE="http://www.teeworlds.com"
+SRC_URI="http://www.teeworlds.com/files/${P}-src.tar.gz -> ${P}-src.tar.gz
+       http://teeworlds.com/trac/bam/browser/releases/bam-0.2.0.tar.gz?format=raw
+       -> ${BAM_P}.tar.gz"
+
+LICENSE="as-is"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="debug dedicated"
+
+RDEPEND="dev-lang/lua
+       !dedicated? (
+               media-libs/libsdl[X,opengl]
+               sys-libs/zlib
+       )"
+# has modified wavpack and pnglite in its sources
+# not worth of effort patching up to system ones
+DEPEND="${RDEPEND}
+       app-arch/zip"
+
+S=${WORKDIR}/${P}-src
+# that's a temporary fix for datadir location
+dir=${GAMES_DATADIR}/${PN}
+
+src_prepare() {
+       rm -f license.txt
+
+       epatch "${FILESDIR}"/fix_datadir_search.patch
+}
+
+pkg_setup() {
+       dodir /etc/${P}
+       enewgroup games
+       enewuser teeworlds -1 -1 -1 games
+}
+
+src_compile() {
+       # compile bam
+       ebegin "Preparing BAM"
+       cd "${WORKDIR}/${BAM_P}"
+       $(tc-getCC) ${CFLAGS} src/tools/txt2c.c -o src/tools/txt2c || die
+       src/tools/txt2c src/base.bam src/driver_gcc.bam \
+       src/driver_cl.bam > src/internal_base.h || die
+       # internal lua sources!
+       $(tc-getCC) ${CFLAGS} ${LDFLAGS} \
+               src/lua/*.c src/*.c -o src/bam \
+               -I /usr/include/ -lm -lpthread || die
+       eend $?
+       # compile game
+       cd "${S}"
+       sed -i \
+               -e "s|Add(\"-Wall\", \"-fno-exceptions|Add(\"|" \
+               -e "s|cc.flags:Add(\"-fstack-protector\", \"-fstack-protector-all\")|cc.flags:Add(\"${CXXFLAGS}\")|" \
+               -e "s|link.flags:Add(\"-fstack-protector\", \"-fstack-protector-all\")|link.flags:Add(\"${LDFLAGS}\")|" \
+               default.bam || die "sed failed"
+
+       local opts=""
+       use dedicated && opts="server_"
+       use debug && opts="${opts}debug" || opts="${opts}release"
+
+       ../${BAM_P}/src/bam -v ${opts}
+}
+
+src_install() {
+       if use debug ; then
+               newgamesbin ${PN}_srv_d ${PN}_srv || "newgamesbin failed"
+       else
+               dogamesbin ${PN}_srv || die "dogamesbin failed"
+       fi
+
+       if ! use dedicated ; then
+               if use debug ; then
+                       newgamesbin ${PN}_d ${PN} || die "newgamesbin failed"
+               else
+                       dogamesbin ${PN} || die "dogamesbin failed"
+               fi
+               newicon other/icons/Teeworlds.ico ${PN}.ico
+           make_desktop_entry ${PN} "Teeworlds"
+               insinto "${dir}"
+               doins -r data || die "doins failed"
+       else
+               insinto "${dir}"/data/maps
+               doins data/maps/* || die "doins failed"
+       fi
+
+       dodoc *.txt
+       prepgamesdirs
+       newinitd "${FILESDIR}"/teeworlds_init teeworlds
+}