diff options
Diffstat (limited to 'games-action/teeworlds')
-rw-r--r-- | games-action/teeworlds/ChangeLog | 11 | ||||
-rw-r--r-- | games-action/teeworlds/files/0.6.1/01-use-system-wavpack.patch | 103 | ||||
-rw-r--r-- | games-action/teeworlds/files/0.6.1/02-fixed-wavpack-sound-loading.patch | 109 | ||||
-rw-r--r-- | games-action/teeworlds/files/0.6.1/03-use-system-pnglite.patch | 112 | ||||
-rw-r--r-- | games-action/teeworlds/files/teeworlds-init.d | 40 | ||||
-rw-r--r-- | games-action/teeworlds/files/teeworlds_srv.cfg | 7 | ||||
-rw-r--r-- | games-action/teeworlds/teeworlds-0.6.1.ebuild | 100 |
7 files changed, 481 insertions, 1 deletions
diff --git a/games-action/teeworlds/ChangeLog b/games-action/teeworlds/ChangeLog index f3c6d8d518a3..380a2d7e0f06 100644 --- a/games-action/teeworlds/ChangeLog +++ b/games-action/teeworlds/ChangeLog @@ -1,6 +1,15 @@ # ChangeLog for games-action/teeworlds # Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/games-action/teeworlds/ChangeLog,v 1.5 2012/03/26 08:50:04 tupone Exp $ +# $Header: /var/cvsroot/gentoo-x86/games-action/teeworlds/ChangeLog,v 1.6 2012/03/27 15:16:11 tupone Exp $ + +*teeworlds-0.6.1 (27 Mar 2012) + + 27 Mar 2012; Tupone Alfredo <tupone@gentoo.org> + +files/0.6.1/01-use-system-wavpack.patch, + +files/0.6.1/02-fixed-wavpack-sound-loading.patch, + +files/0.6.1/03-use-system-pnglite.patch, +teeworlds-0.6.1.ebuild, + +files/teeworlds-init.d, +files/teeworlds_srv.cfg: + Version bump to 0.6.1 Bug #363395 by Bruno 'brubru' Tarquini 26 Mar 2012; Tupone Alfredo <tupone@gentoo.org> teeworlds-0.5.2.ebuild, +files/teeworlds-0.5.2-gcc46.patch: diff --git a/games-action/teeworlds/files/0.6.1/01-use-system-wavpack.patch b/games-action/teeworlds/files/0.6.1/01-use-system-wavpack.patch new file mode 100644 index 000000000000..3a1944dcf739 --- /dev/null +++ b/games-action/teeworlds/files/0.6.1/01-use-system-wavpack.patch @@ -0,0 +1,103 @@ +Use system wavpack. Based on patch from Gentoo Bugzilla + +From: Azamat H. Hackimov <azamat.hackimov@gmail.com> + +https://bugs.gentoo.org/show_bug.cgi?id=363395 +--- + + bam.lua | 15 +++++++++++++-- + src/engine/client/sound.cpp | 10 +++++++++- + 2 files changed, 22 insertions(+), 3 deletions(-) + + +diff --git a/bam.lua b/bam.lua +index 5699251..ce24cff 100644 +--- a/bam.lua ++++ b/bam.lua +@@ -9,6 +9,7 @@ config = NewConfig() + config:Add(OptCCompiler("compiler")) + config:Add(OptTestCompileC("stackprotector", "int main(){return 0;}", "-fstack-protector -fstack-protector-all")) + config:Add(OptLibrary("zlib", "zlib.h", false)) ++config:Add(OptLibrary("wavpack", "wavpack/wavpack.h", false)) + config:Add(SDL.OptFind("sdl", true)) + config:Add(FreeType.OptFind("freetype", true)) + config:Finalize("config.lua") +@@ -165,7 +166,7 @@ function build(settings) + end + + -- compile zlib if needed +- if config.zlib.value == 1 then ++ if config.zlib.value == true then + settings.link.libs:Add("z") + if config.zlib.include_path then + settings.cc.includes:Add(config.zlib.include_path) +@@ -176,8 +177,18 @@ function build(settings) + settings.cc.includes:Add("src/engine/external/zlib") + end + ++ if config.wavpack.value == true then ++ settings.link.libs:Add("wavpack") ++ if config.wavpack.include_path then ++ settings.cc.includes:Add(config.wavpack.include_path) ++ end ++ wavpack = {} ++ else ++ wavpack = Compile(settings, Collect("src/engine/external/wavpack/*.c")) ++ settings.cc.includes:Add("src/engine/external/") --The header is wavpack/wavpack.h so include the external folder ++ end ++ + -- build the small libraries +- wavpack = Compile(settings, Collect("src/engine/external/wavpack/*.c")) + pnglite = Compile(settings, Collect("src/engine/external/pnglite/*.c")) + + -- build game components +diff --git a/src/engine/client/sound.cpp b/src/engine/client/sound.cpp +index c2ca91f..f356e34 100644 +--- a/src/engine/client/sound.cpp ++++ b/src/engine/client/sound.cpp +@@ -10,7 +10,7 @@ + #include "sound.h" + + extern "C" { // wavpack +- #include <engine/external/wavpack/wavpack.h> ++ #include <wavpack/wavpack.h> + } + #include <math.h> + +@@ -333,19 +333,25 @@ int CSound::LoadWV(const char *pFilename) + if(!m_pStorage) + return -1; + ++ #ifndef WAVPACK_H + ms_File = m_pStorage->OpenFile(pFilename, IOFLAG_READ, IStorage::TYPE_ALL); + if(!ms_File) + { + dbg_msg("sound/wv", "failed to open file. filename='%s'", pFilename); + return -1; + } ++ #endif + + SampleID = AllocID(); + if(SampleID < 0) + return -1; + pSample = &m_aSamples[SampleID]; + ++ #ifndef WAVPACK_H + pContext = WavpackOpenFileInput(ReadData, aError); ++ #else ++ pContext = WavpackOpenFileInput(pFilename, aError, 0, 0); ++ #endif + if (pContext) + { + int m_aSamples = WavpackGetNumSamples(pContext); +@@ -401,8 +407,10 @@ int CSound::LoadWV(const char *pFilename) + dbg_msg("sound/wv", "failed to open %s: %s", pFilename, aError); + } + ++ #ifndef WAVPACK_H + io_close(ms_File); + ms_File = NULL; ++ #endif + + if(g_Config.m_Debug) + dbg_msg("sound/wv", "loaded %s", pFilename); diff --git a/games-action/teeworlds/files/0.6.1/02-fixed-wavpack-sound-loading.patch b/games-action/teeworlds/files/0.6.1/02-fixed-wavpack-sound-loading.patch new file mode 100644 index 000000000000..b129aaf11ce4 --- /dev/null +++ b/games-action/teeworlds/files/0.6.1/02-fixed-wavpack-sound-loading.patch @@ -0,0 +1,109 @@ +Fixing wavpack sound loading. Based on Gentoo Bugzilla + +From: Azamat H. Hackimov <azamat.hackimov@gmail.com> + +https://bugs.gentoo.org/show_bug.cgi?id=363395 +--- + + src/engine/client/sound.cpp | 56 ++++++++++++++++++++++++++++++++++++++----- + 1 files changed, 50 insertions(+), 6 deletions(-) + + +diff --git a/src/engine/client/sound.cpp b/src/engine/client/sound.cpp +index f356e34..b55a798 100644 +--- a/src/engine/client/sound.cpp ++++ b/src/engine/client/sound.cpp +@@ -50,6 +50,54 @@ struct CVoice + int m_X, m_Y; + } ; + ++#ifdef WAVPACK_H ++static int32_t ReadBytes(void *pFile, void *pBuffer, int32_t Size) ++{ ++ return (int32_t)io_read((IOHANDLE)pFile, pBuffer, Size); ++} ++static uint32_t GetPos(void *pFile) ++{ ++ return (uint32_t)io_tell((IOHANDLE)pFile); ++} ++static int SetPosAbs(void *pFile, uint32_t Offset) ++{ ++ return io_seek((IOHANDLE)pFile, Offset, IOSEEK_START); ++} ++static int SetPosRel(void *pFile, int32_t Offset, int Mode) ++{ ++ switch(Mode) ++ { ++ case SEEK_SET: ++ Mode = IOSEEK_START; ++ break; ++ case SEEK_CUR: ++ Mode = IOSEEK_CUR; ++ break; ++ case SEEK_END: ++ Mode = IOSEEK_END; ++ } ++ return io_seek((IOHANDLE)pFile, Offset, Mode); ++} ++ ++//TODO: Fix if 'real' functionality is needed by the wavpack header ++static int PushBackByte(void *pFile, int Char) ++{ ++ return io_seek((IOHANDLE)pFile, -1, IOSEEK_CUR); ++} ++static uint32_t GetLength(void *pFile) ++{ ++ return (uint32_t)io_length((IOHANDLE)pFile); ++} ++// Essentially assuming this to always be true, should fix if this isn't the case ++static int CanSeek(void *pFile) ++{ ++ return pFile != NULL; ++} ++static WavpackStreamReader CWavpackReader = { ++ ReadBytes, GetPos, SetPosAbs, SetPosRel, PushBackByte, GetLength, CanSeek, 0 ++}; ++#endif ++ + static CSample m_aSamples[NUM_SAMPLES] = { {0} }; + static CVoice m_aVoices[NUM_VOICES] = { {0} }; + static CChannel m_aChannels[NUM_CHANNELS] = { {255, 0} }; +@@ -333,14 +381,12 @@ int CSound::LoadWV(const char *pFilename) + if(!m_pStorage) + return -1; + +- #ifndef WAVPACK_H + ms_File = m_pStorage->OpenFile(pFilename, IOFLAG_READ, IStorage::TYPE_ALL); + if(!ms_File) + { + dbg_msg("sound/wv", "failed to open file. filename='%s'", pFilename); + return -1; + } +- #endif + + SampleID = AllocID(); + if(SampleID < 0) +@@ -350,7 +396,7 @@ int CSound::LoadWV(const char *pFilename) + #ifndef WAVPACK_H + pContext = WavpackOpenFileInput(ReadData, aError); + #else +- pContext = WavpackOpenFileInput(pFilename, aError, 0, 0); ++ pContext = WavpackOpenFileInputEx(&CWavpackReader, ms_File, 0, aError, 0, 0); + #endif + if (pContext) + { +@@ -404,13 +450,11 @@ int CSound::LoadWV(const char *pFilename) + } + else + { +- dbg_msg("sound/wv", "failed to open %s: %s", pFilename, aError); ++ dbg_msg("sound/wv", "failed to open '%s': %s", pFilename, aError); + } + +- #ifndef WAVPACK_H + io_close(ms_File); + ms_File = NULL; +- #endif + + if(g_Config.m_Debug) + dbg_msg("sound/wv", "loaded %s", pFilename); diff --git a/games-action/teeworlds/files/0.6.1/03-use-system-pnglite.patch b/games-action/teeworlds/files/0.6.1/03-use-system-pnglite.patch new file mode 100644 index 000000000000..998a08659362 --- /dev/null +++ b/games-action/teeworlds/files/0.6.1/03-use-system-pnglite.patch @@ -0,0 +1,112 @@ +Use system pnglite. Based on Gentoo Bugzilla + +From: Azamat H. Hackimov <azamat.hackimov@gmail.com> + +https://bugs.gentoo.org/show_bug.cgi?id=363395 +--- + + bam.lua | 33 +++++++++++++++++++++------------ + src/engine/client/graphics.cpp | 2 +- + src/tools/dilate.cpp | 2 +- + src/tools/tileset_borderfix.cpp | 2 +- + 4 files changed, 24 insertions(+), 15 deletions(-) + + +diff --git a/bam.lua b/bam.lua +index ce24cff..46b8e42 100644 +--- a/bam.lua ++++ b/bam.lua +@@ -9,6 +9,7 @@ config = NewConfig() + config:Add(OptCCompiler("compiler")) + config:Add(OptTestCompileC("stackprotector", "int main(){return 0;}", "-fstack-protector -fstack-protector-all")) + config:Add(OptLibrary("zlib", "zlib.h", false)) ++config:Add(OptLibrary("pnglite", "pnglite.h", false)) + config:Add(OptLibrary("wavpack", "wavpack/wavpack.h", false)) + config:Add(SDL.OptFind("sdl", true)) + config:Add(FreeType.OptFind("freetype", true)) +@@ -177,26 +178,34 @@ function build(settings) + settings.cc.includes:Add("src/engine/external/zlib") + end + ++ -- build game components ++ engine_settings = settings:Copy() ++ server_settings = engine_settings:Copy() ++ client_settings = engine_settings:Copy() ++ launcher_settings = engine_settings:Copy() ++ ++ if config.pnglite.value == true then ++ client_settings.link.libs:Add("pnglite") ++ if config.pnglite.include_path then ++ client_settings.cc.includes:Add(config.pnglite.include_path) ++ end ++ pnglite = {} ++ else ++ pnglite = Compile(settings, Collect("src/engine/external/pnglite/*.c")) ++ client_settings.cc.includes:Add("src/engine/external/pnglite") ++ end ++ + if config.wavpack.value == true then +- settings.link.libs:Add("wavpack") ++ client_settings.link.libs:Add("wavpack") + if config.wavpack.include_path then +- settings.cc.includes:Add(config.wavpack.include_path) ++ client_settings.cc.includes:Add(config.wavpack.include_path) + end + wavpack = {} + else + wavpack = Compile(settings, Collect("src/engine/external/wavpack/*.c")) +- settings.cc.includes:Add("src/engine/external/") --The header is wavpack/wavpack.h so include the external folder ++ client_settings.cc.includes:Add("src/engine/external/") --The header is wavpack/wavpack.h so include the external folder + end + +- -- build the small libraries +- pnglite = Compile(settings, Collect("src/engine/external/pnglite/*.c")) +- +- -- build game components +- engine_settings = settings:Copy() +- server_settings = engine_settings:Copy() +- client_settings = engine_settings:Copy() +- launcher_settings = engine_settings:Copy() +- + if family == "unix" then + if platform == "macosx" then + client_settings.link.frameworks:Add("OpenGL") +diff --git a/src/engine/client/graphics.cpp b/src/engine/client/graphics.cpp +index d1f0b8a..f654e87 100644 +--- a/src/engine/client/graphics.cpp ++++ b/src/engine/client/graphics.cpp +@@ -20,7 +20,7 @@ + #endif + + #include <base/system.h> +-#include <engine/external/pnglite/pnglite.h> ++#include <pnglite.h> + + #include <engine/shared/config.h> + #include <engine/graphics.h> +diff --git a/src/tools/dilate.cpp b/src/tools/dilate.cpp +index eb770a9..cbd7a3e 100644 +--- a/src/tools/dilate.cpp ++++ b/src/tools/dilate.cpp +@@ -2,7 +2,7 @@ + /* If you are missing that file, acquire a complete release at teeworlds.com. */ + #include <base/system.h> + #include <base/math.h> +-#include <engine/external/pnglite/pnglite.h> ++#include <pnglite.h> + + typedef struct + { +diff --git a/src/tools/tileset_borderfix.cpp b/src/tools/tileset_borderfix.cpp +index 0facb9a..ab36292 100644 +--- a/src/tools/tileset_borderfix.cpp ++++ b/src/tools/tileset_borderfix.cpp +@@ -1,7 +1,7 @@ + /* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */ + /* If you are missing that file, acquire a complete release at teeworlds.com. */ + #include <base/system.h> +-#include <engine/external/pnglite/pnglite.h> ++#include <pnglite.h> + + typedef struct + { diff --git a/games-action/teeworlds/files/teeworlds-init.d b/games-action/teeworlds/files/teeworlds-init.d new file mode 100644 index 000000000000..7b9fd33bffee --- /dev/null +++ b/games-action/teeworlds/files/teeworlds-init.d @@ -0,0 +1,40 @@ +#!/sbin/runscript +# Copyright 1999-2012 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} --user games \ + --exec ${GAME_DIRECTORY}/teeworlds_srv -- -f ${CONFIG} + eend $? +} + +reload() { + ebegin "Reloading TeeWorlds configs and restarting processes" + start-stop-daemon --stop --oknodo --user games \ + --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-action/teeworlds/files/teeworlds_srv.cfg b/games-action/teeworlds/files/teeworlds_srv.cfg new file mode 100644 index 000000000000..dc675622c78b --- /dev/null +++ b/games-action/teeworlds/files/teeworlds_srv.cfg @@ -0,0 +1,7 @@ +# sample Teeworlds server config file +# see http://www.teeworlds.com/?page=docs&wiki=ServerSettings for details +sv_gametype dm +sv_map dm1 +sv_name gentoo-teeworlds +sv_register 1 +sv_scorelimit 20
\ No newline at end of file diff --git a/games-action/teeworlds/teeworlds-0.6.1.ebuild b/games-action/teeworlds/teeworlds-0.6.1.ebuild new file mode 100644 index 000000000000..985a5b92eab0 --- /dev/null +++ b/games-action/teeworlds/teeworlds-0.6.1.ebuild @@ -0,0 +1,100 @@ +# Copyright 1999-2012 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/games-action/teeworlds/teeworlds-0.6.1.ebuild,v 1.1 2012/03/27 15:16:11 tupone Exp $ + +EAPI=3 + +PYTHON_DEPEND="2" + +inherit eutils python games + +REVISION="b177-r50edfd37" + +DESCRIPTION="Online multi-player platform 2D shooter" +HOMEPAGE="http://www.teeworlds.com/" +SRC_URI="http://www.teeworlds.com/files/${P}-source.tar.gz" + +LICENSE="ZLIB" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE="debug dedicated" + +RDEPEND=" + !dedicated? ( media-libs/pnglite + media-libs/libsdl[X,audio,opengl,video] + media-sound/wavpack + virtual/opengl + app-arch/bzip2 + media-libs/freetype + virtual/glu + x11-libs/libX11 ) + sys-libs/zlib" +DEPEND="${RDEPEND} + ~dev-util/bam-0.4.0" + +S=${WORKDIR}/${PN}-${REVISION}-source + +pkg_setup() { + python_set_active_version 2 + games_pkg_setup +} + +src_prepare() { + # 01 & 02 from pull request: https://github.com/oy/teeworlds/pull/493 + EPATCH_SOURCE="${FILESDIR}/${PV}" EPATCH_SUFFIX="patch" EPATCH_FORCE="yes" \ + epatch +} + +src_configure() { + bam config || die "bam config failed" +} + +src_compile() { + local myopt + + if use debug; then + myopt=" server_debug" + else + myopt=" server_release" + fi + if ! use dedicated; then + if use debug; then + myopt+=" client_debug" + else + myopt+=" client_release" + fi + fi + + bam ${myopt} || die "bam failed" +} + +src_install() { + if use debug; then + newgamesbin ${PN}_srv_d ${PN}_srv || die "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 + + doicon "${FILESDIR}"/${PN}.xpm || die "doicon failed" + make_desktop_entry ${PN} Teeworlds + + insinto "${GAMES_DATADIR}"/${PN}/data + doins -r data/* || die "doins failed" + else + insinto "${GAMES_DATADIR}"/${PN}/data/maps + doins -r data/maps/* || die "doins failed" + fi + newinitd "${FILESDIR}"/${PN}-init.d ${PN} + insinto "/etc/${PN}" + doins "${FILESDIR}"/teeworlds_srv.cfg + + dodoc readme.txt || die "dodoc failed" + + prepgamesdirs +} |