summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
authorokapi <okapi@firemail.cc>2018-01-17 00:21:42 +0100
committerLudovic Courtès <ludo@gnu.org>2018-02-19 00:33:34 +0100
commit2922852e86b5173d45d1097b8cb72f8e081b4152 (patch)
treed3ee60c1dfd271ceafdca7c69a7da1dca3f872cd /gnu
parent9073c8758ceb0d39e3c7c2985e5a1fc06ba4076a (diff)
downloadguix-2922852e86b5173d45d1097b8cb72f8e081b4152.tar.gz
gnu: Add gzdoom.
* gnu/packages/games.scm (gzdoom): New variable.
* gnu/packages/patches/gzdoom-search-in-installed-share.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add it.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'gnu')
-rw-r--r--gnu/local.mk1
-rw-r--r--gnu/packages/games.scm89
-rw-r--r--gnu/packages/patches/gzdoom-search-in-installed-share.patch23
3 files changed, 113 insertions, 0 deletions
diff --git a/gnu/local.mk b/gnu/local.mk
index 7fb560bb43..f1834e3687 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -746,6 +746,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/gtk3-respect-GUIX_GTK3_PATH.patch	\
   %D%/packages/patches/gtk3-respect-GUIX_GTK3_IM_MODULE_FILE.patch \
   %D%/packages/patches/gtkglext-disable-disable-deprecated.patch \
+  %D%/packages/patches/gzdoom-search-in-installed-share.patch	\
   %D%/packages/patches/handbrake-pkg-config-path.patch		\
   %D%/packages/patches/hdf4-architectures.patch 		\
   %D%/packages/patches/hdf4-reproducibility.patch 		\
diff --git a/gnu/packages/games.scm b/gnu/packages/games.scm
index a53d3ed406..d15618308b 100644
--- a/gnu/packages/games.scm
+++ b/gnu/packages/games.scm
@@ -33,6 +33,7 @@
 ;;; Copyright © 2017, 2018 Rutger Helling <rhelling@mykolab.com>
 ;;; Copyright © 2017 Roel Janssen <roel@gnu.org>
 ;;; Copyright © 2017, 2018 Nicolas Goaziou <mail@nicolasgoaziou.fr>
+;;; Copyright © 2018 okapi <okapi@firemail.cc>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -5678,3 +5679,91 @@ to C++ and Java.  Your mission is to find a new planet to live and survive.
 You can save humanity and get programming skills!")
     (home-page "https://colobot.info")
     (license license:gpl3+)))
+
+(define-public gzdoom
+  (package
+    (name "gzdoom")
+    (version "3.2.5")
+    (source (origin
+              (method url-fetch)
+              (uri
+               (string-append "https://zdoom.org/files/gzdoom/src/gzdoom-g"
+                              version ".zip"))
+              (sha256
+               (base32
+                "1164d1zf5in98gp4j981ml3hwmks3q7vzfanlqpjlx2c09jmlv0q"))
+              (patches (search-patches "gzdoom-search-in-installed-share.patch"))
+              (modules '((guix build utils)))
+              (snippet
+               '(begin
+                  (delete-file-recursively "bzip2")
+                  (delete-file-recursively "game-music-emu")
+                  (delete-file-recursively "jpeg-6b")
+                  (delete-file-recursively "zlib")))))
+    (arguments
+     '(#:tests? #f
+       #:configure-flags
+       (let ((out (assoc-ref %outputs "out")))
+         (list
+          (string-append
+           "-DCMAKE_CXX_FLAGS:="
+           "-DSHARE_DIR=\\\"" out "/share/\\\" "
+           "-DGUIX_OUT_PK3=\\\"" out "/share/games/doom\\\"")
+          ;; look for libraries at buildtime instead of
+          ;; dynamically finding them at runtime
+          "-DDYN_OPENAL=OFF"
+          "-DDYN_FLUIDSYNTH=OFF"
+          "-DDYN_GTK=OFF"
+          "-DDYN_MPG123=OFF"
+          "-DDYN_SNDFILE=OFF"))
+       #:phases
+       (modify-phases %standard-phases
+         (add-before 'configure 'fix-referenced-paths
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let ((fluid-3 (assoc-ref inputs "fluid-3"))
+                   (timidity++ (assoc-ref inputs "timidity++"))
+                   (out (assoc-ref outputs "out")))
+
+               (substitute*
+                   "src/CMakeLists.txt"
+                 (("COMMAND /bin/sh")
+                  (string-append "COMMAND " (which "sh"))))
+
+               (substitute*
+                   "src/sound/mididevices/music_fluidsynth_mididevice.cpp"
+                 (("/usr/share/sounds/sf2/FluidR3_GM.sf2")
+                  (string-append fluid-3 "/share/soundfonts/FluidR3Mono_GM.sf3")))
+
+               (substitute*
+                   "src/sound/mididevices/music_timiditypp_mididevice.cpp"
+                 (("exename = \"timidity\"")
+                  (string-append "exename = \"" timidity++ "/bin/timidity\"")))
+               #t))))))
+    (build-system cmake-build-system)
+    (inputs `(("bzip2" ,bzip2)
+              ("fluid-3" ,fluid-3)
+              ("fluidsynth" ,fluidsynth)
+              ("gtk+3" ,gtk+)
+              ("libgme" ,libgme)
+              ("libjpeg" ,libjpeg)
+              ("libsndfile" ,libsndfile)
+              ("mesa" ,mesa)
+              ("mpg123" ,mpg123)
+              ("openal" ,openal)
+              ("sdl2" ,sdl2)
+              ("timidity++" ,timidity++)
+              ("zlib" ,zlib)))
+    (native-inputs `(("pkg-config" ,pkg-config)
+                     ("unzip" ,unzip)))
+    (synopsis "Modern Doom 2 source port")
+    (description "GZdoom is a port of the Doom 2 game engine, with a modern
+renderer.  It improves modding support with ZDoom's advanced mapping features
+and the new ZScript language.  In addition to Doom, it supports Heretic, Hexen,
+Strife, Chex Quest, and fan-created games like Harmony, Hacx and Freedoom.")
+    (home-page "https://zdoom.org/index")
+    (license (list license:gpl3+         ; gzdoom game
+                   license:lgpl3+        ; gzdoom renderer
+                   license:expat         ; gdtoa
+                   (license:non-copyleft ; modified dumb
+                    "file://dumb/licence.txt"
+                    "Dumb license, explicitly GPL compatible.")))))
diff --git a/gnu/packages/patches/gzdoom-search-in-installed-share.patch b/gnu/packages/patches/gzdoom-search-in-installed-share.patch
new file mode 100644
index 0000000000..f312686566
--- /dev/null
+++ b/gnu/packages/patches/gzdoom-search-in-installed-share.patch
@@ -0,0 +1,23 @@
+Lookup gzdoom pk3 files in the installed directory in
+addition to the path that is stored in ~/.config/gzdoom/.
+
+Simply replacing the hardcoded /usr/share would leave the
+configfile pointing to outdated guix builds, which could get
+garbage collected and break the gzdoom installation.
+This ensures that the files installed with the corresponding
+build will be used.
+
+--- /src/d_main.cpp	2018-01-16 22:13:09.700602781 +0200
++++ /src/d_main.cpp	2018-01-16 22:22:36.560617961 +0200
+@@ -1716,6 +1716,11 @@
+ 		return wad;
+ 	}
+ 
++    mysnprintf (wad, countof(wad), "%s/%s", GUIX_OUT_PK3, file);
++    if (DirEntryExists (wad)) {
++        return wad;
++    }
++
+ 	if (GameConfig != NULL && GameConfig->SetSection ("FileSearch.Directories"))
+ 	{
+ 		const char *key;