summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'games-action/teeworlds/files/0.6.3/01-use-system-wavpack.patch')
-rw-r--r--games-action/teeworlds/files/0.6.3/01-use-system-wavpack.patch101
1 files changed, 101 insertions, 0 deletions
diff --git a/games-action/teeworlds/files/0.6.3/01-use-system-wavpack.patch b/games-action/teeworlds/files/0.6.3/01-use-system-wavpack.patch
new file mode 100644
index 000000000000..4a11a866511d
--- /dev/null
+++ b/games-action/teeworlds/files/0.6.3/01-use-system-wavpack.patch
@@ -0,0 +1,101 @@
+commit 7202b142891ee10771af9f1f3063664d75a38bbc
+Author: hasufell <hasufell@gentoo.org>
+Date: Thu Sep 5 12:28:30 2013 +0200
+
+ 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
+
+diff --git a/bam.lua b/bam.lua
+index 11ac7b9..35c1d8d 100644
+--- a/bam.lua
++++ b/bam.lua
+@@ -11,6 +11,7 @@ config:Add(OptTestCompileC("stackprotector", "int main(){return 0;}", "-fstack-p
+ config:Add(OptTestCompileC("minmacosxsdk", "int main(){return 0;}", "-mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk"))
+ config:Add(OptTestCompileC("macosxppc", "int main(){return 0;}", "-arch ppc"))
+ 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")
+@@ -187,7 +188,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)
+@@ -198,8 +199,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 343fa2e..e32cac9 100644
+--- a/src/engine/client/sound.cpp
++++ b/src/engine/client/sound.cpp
+@@ -13,7 +13,7 @@
+ #include "sound.h"
+
+ extern "C" { // wavpack
+- #include <engine/external/wavpack/wavpack.h>
++ #include <wavpack/wavpack.h>
+ }
+ #include <math.h>
+
+@@ -351,19 +351,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);
+@@ -419,8 +425,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);