gnu: teeworlds: Update to 0.7.0 [fixes CVE-2018-18541].
* gnu/packages/games.scm (teeworlds): Update to 0.7.0. [source]: Switch to git-fetch. Remove all bundled libraries except md5. [arguments]: Adjust accordingly. [inputs]: Use sdl2 instead of sdl and python-wrapper instead of python-2. Add json-parser and pnglite. * gnu/packages/patches/teeworlds-use-latest-wavpack.patch: Update it.
This commit is contained in:
parent
53367e17b6
commit
f9e5caf9ba
|
@ -35,6 +35,7 @@
|
||||||
;;; Copyright © 2018 Tim Gesthuizen <tim.gesthuizen@yahoo.de>
|
;;; Copyright © 2018 Tim Gesthuizen <tim.gesthuizen@yahoo.de>
|
||||||
;;; Copyright © 2018 Madalin Ionel-Patrascu <madalinionel.patrascu@mdc-berlin.de>
|
;;; Copyright © 2018 Madalin Ionel-Patrascu <madalinionel.patrascu@mdc-berlin.de>
|
||||||
;;; Copyright © 2018 Benjamin Slade <slade@jnanam.net>
|
;;; Copyright © 2018 Benjamin Slade <slade@jnanam.net>
|
||||||
|
;;; Copyright © 2018 Alex Vong <alexvong1995@gmail.com>
|
||||||
;;;
|
;;;
|
||||||
;;; This file is part of GNU Guix.
|
;;; This file is part of GNU Guix.
|
||||||
;;;
|
;;;
|
||||||
|
@ -4139,31 +4140,54 @@ small robot living in the nano world, repair its maker.")
|
||||||
(define-public teeworlds
|
(define-public teeworlds
|
||||||
(package
|
(package
|
||||||
(name "teeworlds")
|
(name "teeworlds")
|
||||||
(version "0.6.4")
|
(version "0.7.0")
|
||||||
(source (origin
|
(source (origin
|
||||||
(method url-fetch)
|
;; do not use auto-generated tarballs
|
||||||
(uri (string-append "https://github.com/teeworlds/teeworlds/"
|
(method git-fetch)
|
||||||
"archive/" version "-release.tar.gz"))
|
(uri (git-reference
|
||||||
(file-name (string-append name "-" version ".tar.gz"))
|
(url "https://github.com/teeworlds/teeworlds.git")
|
||||||
|
(commit version)))
|
||||||
|
(file-name (git-file-name name version))
|
||||||
(sha256
|
(sha256
|
||||||
(base32
|
(base32
|
||||||
"1mqhp6xjl75l49050cid36wxyjn1qr0vjx1c709dfg1lkvmgs6l3"))
|
"0jigg2yikihbivzs7hpljr0mghx1l9v4f1cdr8fbmqv2wb51ah8q"))
|
||||||
(modules '((guix build utils)))
|
(modules '((guix build utils)
|
||||||
(snippet
|
(ice-9 ftw)
|
||||||
'(begin
|
(ice-9 regex)
|
||||||
(for-each delete-file-recursively
|
(srfi srfi-1)
|
||||||
'("src/engine/external/wavpack/"
|
(srfi srfi-26)))
|
||||||
"src/engine/external/zlib/"))
|
(snippet ; remove bundled libraries except md5
|
||||||
|
'(let ((base-dir "src/engine/external/"))
|
||||||
|
(for-each (compose (cut delete-file-recursively <>)
|
||||||
|
(cut string-append base-dir <>))
|
||||||
|
(remove (cut string-match "(^.)|(^md5$)" <>)
|
||||||
|
(scandir base-dir)))
|
||||||
#t))
|
#t))
|
||||||
(patches
|
(patches
|
||||||
(search-patches "teeworlds-use-latest-wavpack.patch"))))
|
(search-patches "teeworlds-use-latest-wavpack.patch"))))
|
||||||
(build-system gnu-build-system)
|
(build-system gnu-build-system)
|
||||||
(arguments
|
(arguments
|
||||||
`(#:tests? #f ; no tests included
|
`(#:tests? #f ; no tests included
|
||||||
|
#:modules ((guix build gnu-build-system)
|
||||||
|
(guix build utils)
|
||||||
|
(srfi srfi-26))
|
||||||
#:phases
|
#:phases
|
||||||
(modify-phases %standard-phases
|
(modify-phases %standard-phases
|
||||||
(replace 'configure
|
(replace 'configure
|
||||||
(lambda* (#:key outputs #:allow-other-keys)
|
(lambda* (#:key outputs #:allow-other-keys)
|
||||||
|
;; The bundled json-parser uses an old API.
|
||||||
|
;; To use the latest non-bundled version, we need to pass the
|
||||||
|
;; length of the data in all 'json_parse_ex' calls.
|
||||||
|
(define (use-latest-json-parser file)
|
||||||
|
(substitute* file
|
||||||
|
(("engine/external/json-parser/json\\.h")
|
||||||
|
"json-parser/json.h")
|
||||||
|
(("json_parse_ex\\(&JsonSettings, pFileData, aError\\);")
|
||||||
|
"json_parse_ex(&JsonSettings,
|
||||||
|
pFileData,
|
||||||
|
strlen(pFileData),
|
||||||
|
aError);")))
|
||||||
|
|
||||||
;; Embed path to assets.
|
;; Embed path to assets.
|
||||||
(substitute* "src/engine/shared/storage.cpp"
|
(substitute* "src/engine/shared/storage.cpp"
|
||||||
(("#define DATA_DIR.*")
|
(("#define DATA_DIR.*")
|
||||||
|
@ -4173,50 +4197,68 @@ small robot living in the nano world, repair its maker.")
|
||||||
"\"")))
|
"\"")))
|
||||||
|
|
||||||
;; Bam expects all files to have a recent time stamp.
|
;; Bam expects all files to have a recent time stamp.
|
||||||
(for-each (lambda (file)
|
(for-each (cut utime <> 1 1)
|
||||||
(utime file 1 1))
|
|
||||||
(find-files "."))
|
(find-files "."))
|
||||||
|
|
||||||
;; Do not use bundled libraries.
|
;; Do not use bundled libraries.
|
||||||
(substitute* "bam.lua"
|
(substitute* "bam.lua"
|
||||||
(("if config.zlib.value == 1 then")
|
(("local json = Compile.+$")
|
||||||
"if true then")
|
"local json = nil
|
||||||
(("wavpack = .*")
|
settings.link.libs:Add(\"jsonparser\")")
|
||||||
"wavpack = {}
|
(("local png = Compile.+$")
|
||||||
settings.link.libs:Add(\"wavpack\")\n"))
|
"local png = nil
|
||||||
|
settings.link.libs:Add(\"pnglite\")")
|
||||||
|
(("local wavpack = Compile.+$")
|
||||||
|
"local wavpack = nil
|
||||||
|
settings.link.libs:Add(\"wavpack\")")
|
||||||
|
(("if config\\.zlib\\.value == 1")
|
||||||
|
"if config.zlib.value"))
|
||||||
|
(substitute* "src/engine/client/graphics_threaded.cpp"
|
||||||
|
(("engine/external/pnglite/pnglite\\.h")
|
||||||
|
"pnglite.h"))
|
||||||
(substitute* "src/engine/client/sound.cpp"
|
(substitute* "src/engine/client/sound.cpp"
|
||||||
(("#include <engine/external/wavpack/wavpack.h>")
|
(("engine/external/wavpack/wavpack\\.h")
|
||||||
"#include <wavpack/wavpack.h>"))
|
"wavpack/wavpack.h"))
|
||||||
|
(for-each use-latest-json-parser
|
||||||
|
'("src/game/client/components/countryflags.cpp"
|
||||||
|
"src/game/client/components/menus_settings.cpp"
|
||||||
|
"src/game/client/components/skins.cpp"
|
||||||
|
"src/game/client/localization.cpp"
|
||||||
|
"src/game/editor/auto_map.h"
|
||||||
|
"src/game/editor/editor.cpp"))
|
||||||
#t))
|
#t))
|
||||||
(replace 'build
|
(replace 'build
|
||||||
(lambda _
|
(lambda _
|
||||||
(zero? (system* "bam" "-a" "-v" "release"))))
|
(invoke "bam" "-a" "-v" "conf=release")))
|
||||||
(replace 'install
|
(replace 'install
|
||||||
(lambda* (#:key outputs #:allow-other-keys)
|
(lambda* (#:key outputs #:allow-other-keys)
|
||||||
(let* ((out (assoc-ref outputs "out"))
|
(let* ((arch ,(system->linux-architecture
|
||||||
(bin (string-append out "/bin"))
|
(or (%current-target-system)
|
||||||
(data (string-append out "/share/teeworlds/data")))
|
(%current-system))))
|
||||||
(mkdir-p bin)
|
(build (string-append "build/" arch "/release/"))
|
||||||
(mkdir-p data)
|
(data-built (string-append build "data/"))
|
||||||
(for-each (lambda (file)
|
(out (assoc-ref outputs "out"))
|
||||||
(install-file file bin))
|
(bin (string-append out "/bin/"))
|
||||||
'("teeworlds" "teeworlds_srv"))
|
(data (string-append out "/share/teeworlds/data/")))
|
||||||
(copy-recursively "data" data)
|
(for-each (cut install-file <> bin)
|
||||||
|
(map (cut string-append build <>)
|
||||||
|
'("teeworlds" "teeworlds_srv")))
|
||||||
|
(copy-recursively data-built data)
|
||||||
#t))))))
|
#t))))))
|
||||||
;; FIXME: teeworlds bundles the sources of "pnglite", a two-file PNG
|
|
||||||
;; library without a build system.
|
|
||||||
(inputs
|
(inputs
|
||||||
`(("freetype" ,freetype)
|
`(("freetype" ,freetype)
|
||||||
("glu" ,glu)
|
("glu" ,glu)
|
||||||
|
("json-parser" ,json-parser)
|
||||||
("mesa" ,mesa)
|
("mesa" ,mesa)
|
||||||
("sdl-union" ,(sdl-union (list sdl
|
("pnglite" ,pnglite)
|
||||||
sdl-mixer
|
("sdl2" ,sdl2)
|
||||||
sdl-image)))
|
("sdl2-image" ,sdl2-image)
|
||||||
|
("sdl2-mixer" ,sdl2-mixer)
|
||||||
("wavpack" ,wavpack)
|
("wavpack" ,wavpack)
|
||||||
("zlib" ,zlib)))
|
("zlib" ,zlib)))
|
||||||
(native-inputs
|
(native-inputs
|
||||||
`(("bam" ,bam)
|
`(("bam" ,bam)
|
||||||
("python" ,python-2)
|
("python" ,python-wrapper)
|
||||||
("pkg-config" ,pkg-config)))
|
("pkg-config" ,pkg-config)))
|
||||||
(home-page "https://www.teeworlds.com")
|
(home-page "https://www.teeworlds.com")
|
||||||
(synopsis "2D retro multiplayer shooter game")
|
(synopsis "2D retro multiplayer shooter game")
|
||||||
|
|
|
@ -1,10 +1,20 @@
|
||||||
Downloaded from https://anonscm.debian.org/cgit/pkg-games/teeworlds.git/plain/debian/patches/new-wavpack.patch.
|
Downloaded from https://salsa.debian.org/games-team/teeworlds/raw/master/debian/patches/new-wavpack.patch.
|
||||||
|
|
||||||
This patch lets us build teeworlds with wavpack 5.1.0.
|
From: Markus Koschany <apo@debian.org>
|
||||||
|
Date: Thu, 25 Oct 2018 20:52:27 +0200
|
||||||
|
Subject: new-wavpack
|
||||||
|
|
||||||
|
Make wavpack compatible with Debian's version.
|
||||||
|
---
|
||||||
|
src/engine/client/sound.cpp | 33 +++++++++++++++------------------
|
||||||
|
src/engine/client/sound.h | 4 ----
|
||||||
|
2 files changed, 15 insertions(+), 22 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/engine/client/sound.cpp b/src/engine/client/sound.cpp
|
||||||
|
index 048ec24..80de3c5 100644
|
||||||
--- a/src/engine/client/sound.cpp
|
--- a/src/engine/client/sound.cpp
|
||||||
+++ b/src/engine/client/sound.cpp
|
+++ b/src/engine/client/sound.cpp
|
||||||
@@ -328,17 +328,14 @@ void CSound::RateConvert(int SampleID)
|
@@ -325,10 +325,6 @@ void CSound::RateConvert(int SampleID)
|
||||||
pSample->m_NumFrames = NumFrames;
|
pSample->m_NumFrames = NumFrames;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,10 +22,10 @@ This patch lets us build teeworlds with wavpack 5.1.0.
|
||||||
-{
|
-{
|
||||||
- return io_read(ms_File, pBuffer, Size);
|
- return io_read(ms_File, pBuffer, Size);
|
||||||
-}
|
-}
|
||||||
-
|
|
||||||
int CSound::LoadWV(const char *pFilename)
|
ISound::CSampleHandle CSound::LoadWV(const char *pFilename)
|
||||||
{
|
{
|
||||||
CSample *pSample;
|
@@ -336,6 +332,8 @@ ISound::CSampleHandle CSound::LoadWV(const char *pFilename)
|
||||||
int SampleID = -1;
|
int SampleID = -1;
|
||||||
char aError[100];
|
char aError[100];
|
||||||
WavpackContext *pContext;
|
WavpackContext *pContext;
|
||||||
|
@ -24,17 +34,18 @@ This patch lets us build teeworlds with wavpack 5.1.0.
|
||||||
|
|
||||||
// don't waste memory on sound when we are stress testing
|
// don't waste memory on sound when we are stress testing
|
||||||
if(g_Config.m_DbgStress)
|
if(g_Config.m_DbgStress)
|
||||||
@@ -351,19 +348,23 @@ int CSound::LoadWV(const char *pFilename
|
@@ -349,25 +347,29 @@ ISound::CSampleHandle CSound::LoadWV(const char *pFilename)
|
||||||
if(!m_pStorage)
|
return CSampleHandle();
|
||||||
return -1;
|
|
||||||
|
|
||||||
|
lock_wait(m_SoundLock);
|
||||||
- ms_File = m_pStorage->OpenFile(pFilename, IOFLAG_READ, IStorage::TYPE_ALL);
|
- ms_File = m_pStorage->OpenFile(pFilename, IOFLAG_READ, IStorage::TYPE_ALL);
|
||||||
- if(!ms_File)
|
- if(!ms_File)
|
||||||
+ File = m_pStorage->OpenFile(pFilename, IOFLAG_READ, IStorage::TYPE_ALL, aWholePath, sizeof(aWholePath));
|
+ File = m_pStorage->OpenFile(pFilename, IOFLAG_READ, IStorage::TYPE_ALL, aWholePath, sizeof(aWholePath));
|
||||||
+ if(!File)
|
+ if(!File)
|
||||||
{
|
{
|
||||||
dbg_msg("sound/wv", "failed to open file. filename='%s'", pFilename);
|
dbg_msg("sound/wv", "failed to open file. filename='%s'", pFilename);
|
||||||
return -1;
|
lock_unlock(m_SoundLock);
|
||||||
|
return CSampleHandle();
|
||||||
}
|
}
|
||||||
+ else
|
+ else
|
||||||
+ {
|
+ {
|
||||||
|
@ -43,7 +54,14 @@ This patch lets us build teeworlds with wavpack 5.1.0.
|
||||||
|
|
||||||
SampleID = AllocID();
|
SampleID = AllocID();
|
||||||
if(SampleID < 0)
|
if(SampleID < 0)
|
||||||
return -1;
|
{
|
||||||
|
- io_close(ms_File);
|
||||||
|
- ms_File = 0;
|
||||||
|
+ io_close(File);
|
||||||
|
+ File = 0;
|
||||||
|
lock_unlock(m_SoundLock);
|
||||||
|
return CSampleHandle();
|
||||||
|
}
|
||||||
pSample = &m_aSamples[SampleID];
|
pSample = &m_aSamples[SampleID];
|
||||||
|
|
||||||
- pContext = WavpackOpenFileInput(ReadData, aError);
|
- pContext = WavpackOpenFileInput(ReadData, aError);
|
||||||
|
@ -51,7 +69,29 @@ This patch lets us build teeworlds with wavpack 5.1.0.
|
||||||
if (pContext)
|
if (pContext)
|
||||||
{
|
{
|
||||||
int m_aSamples = WavpackGetNumSamples(pContext);
|
int m_aSamples = WavpackGetNumSamples(pContext);
|
||||||
@@ -419,9 +420,6 @@ int CSound::LoadWV(const char *pFilename
|
@@ -385,8 +387,8 @@ ISound::CSampleHandle CSound::LoadWV(const char *pFilename)
|
||||||
|
if(pSample->m_Channels > 2)
|
||||||
|
{
|
||||||
|
dbg_msg("sound/wv", "file is not mono or stereo. filename='%s'", pFilename);
|
||||||
|
- io_close(ms_File);
|
||||||
|
- ms_File = 0;
|
||||||
|
+ io_close(File);
|
||||||
|
+ File = 0;
|
||||||
|
lock_unlock(m_SoundLock);
|
||||||
|
return CSampleHandle();
|
||||||
|
}
|
||||||
|
@@ -401,8 +403,8 @@ ISound::CSampleHandle CSound::LoadWV(const char *pFilename)
|
||||||
|
if(BitsPerSample != 16)
|
||||||
|
{
|
||||||
|
dbg_msg("sound/wv", "bps is %d, not 16, filname='%s'", BitsPerSample, pFilename);
|
||||||
|
- io_close(ms_File);
|
||||||
|
- ms_File = 0;
|
||||||
|
+ io_close(File);
|
||||||
|
+ File = 0;
|
||||||
|
lock_unlock(m_SoundLock);
|
||||||
|
return CSampleHandle();
|
||||||
|
}
|
||||||
|
@@ -429,9 +431,6 @@ ISound::CSampleHandle CSound::LoadWV(const char *pFilename)
|
||||||
dbg_msg("sound/wv", "failed to open %s: %s", pFilename, aError);
|
dbg_msg("sound/wv", "failed to open %s: %s", pFilename, aError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,14 +101,16 @@ This patch lets us build teeworlds with wavpack 5.1.0.
|
||||||
if(g_Config.m_Debug)
|
if(g_Config.m_Debug)
|
||||||
dbg_msg("sound/wv", "loaded %s", pFilename);
|
dbg_msg("sound/wv", "loaded %s", pFilename);
|
||||||
|
|
||||||
@@ -527,7 +525,5 @@ void CSound::StopAll()
|
@@ -560,7 +559,5 @@ bool CSound::IsPlaying(CSampleHandle SampleID)
|
||||||
lock_unlock(m_SoundLock);
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
-IOHANDLE CSound::ms_File = 0;
|
-IOHANDLE CSound::ms_File = 0;
|
||||||
-
|
-
|
||||||
IEngineSound *CreateEngineSound() { return new CSound; }
|
IEngineSound *CreateEngineSound() { return new CSound; }
|
||||||
|
|
||||||
|
diff --git a/src/engine/client/sound.h b/src/engine/client/sound.h
|
||||||
|
index ff357c0..cec2cde 100644
|
||||||
--- a/src/engine/client/sound.h
|
--- a/src/engine/client/sound.h
|
||||||
+++ b/src/engine/client/sound.h
|
+++ b/src/engine/client/sound.h
|
||||||
@@ -21,10 +21,6 @@ public:
|
@@ -21,10 +21,6 @@ public:
|
||||||
|
@ -81,4 +123,4 @@ This patch lets us build teeworlds with wavpack 5.1.0.
|
||||||
-
|
-
|
||||||
virtual bool IsSoundEnabled() { return m_SoundEnabled != 0; }
|
virtual bool IsSoundEnabled() { return m_SoundEnabled != 0; }
|
||||||
|
|
||||||
virtual int LoadWV(const char *pFilename);
|
virtual CSampleHandle LoadWV(const char *pFilename);
|
||||||
|
|
Loading…
Reference in New Issue