guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#35234] [PATCH] gnu: Add the-dark-mod.


From: Pierre Neidhardt
Subject: [bug#35234] [PATCH] gnu: Add the-dark-mod.
Date: Thu, 11 Apr 2019 20:16:44 +0200

* gnu/packages/games.scm (the-dark-mod): New variable.
---
 gnu/packages/games.scm | 142 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 142 insertions(+)

diff --git a/gnu/packages/games.scm b/gnu/packages/games.scm
index 2afe5b58ba..4895c0e361 100644
--- a/gnu/packages/games.scm
+++ b/gnu/packages/games.scm
@@ -113,6 +113,7 @@
   #:use-module (gnu packages libunwind)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages lua)
+  #:use-module (gnu packages m4)
   #:use-module (gnu packages man)
   #:use-module (gnu packages maths)
   #:use-module (gnu packages mp3)
@@ -141,6 +142,7 @@
   #:use-module (gnu packages textutils)
   #:use-module (gnu packages tls)
   #:use-module (gnu packages upnp)
+  #:use-module (gnu packages version-control)
   #:use-module (gnu packages video)
   #:use-module (gnu packages vulkan)
   #:use-module (gnu packages web)
@@ -6765,3 +6767,143 @@ a procedurally generated world, the player can explore 
thousands of rooms in
 search of powerful artifacts, tools to help them, and to eventually free the
 Orcus Dome from evil.")
     (license license:gpl3+)))
+
+(define-public the-dark-mod
+  (let ((scons-flags
+         (string-append "TARGET_ARCH="
+                              (match (%current-system)
+                                ("i686-linux" "x86")
+                                ("x86_64-linux" "x64"))))
+        (the-dark-mod-env-var-name "THEDARKMOD_PATH")
+        (the-dark-mod-env-var-value "~/.local/share/darkmod"))
+    (package
+      (name "the-dark-mod")
+      (version "2.07")
+      (source (origin
+                (method url-fetch)
+                (uri (string-append 
"http://www.thedarkmod.com/sources/thedarkmod.";
+                                    version ".src.7z"))
+                (sha256
+                 (base32
+                  "1lhqwl0qnddzbh9na9c73aqg923ixyrr5ih12p4y9v5nis9b3kyy"))))
+      (build-system scons-build-system)
+      (arguments
+       `(#:tests? #f                    ;no test
+         #:scons ,scons-python2
+         ;; BUILD=release makes Scons strip the executable, which fails because
+         ;; "strip" is not found in the path.
+         #:scons-flags (list ,scons-flags)
+         #:phases
+         (modify-phases %standard-phases
+           (replace 'unpack
+             (lambda* (#:key source #:allow-other-keys)
+               (and (invoke "7z" "x" source))))
+           (add-after 'unpack 'fix-build-flags
+             ;; TODO: By default, -no-pie is passed because of the assumption
+             ;; that -fPIC was used to build ffmpeg.  This does not work with
+             ;; out default gcc-5.  This package does not seem to build with
+             ;; gcc>5.
+             (lambda _
+               (substitute* "SConstruct"
+                 (("BASELINKFLAGS.append\\( '-no-pie' \\)") ""))
+               #t))
+           (add-after 'build 'build-updater
+             (lambda _
+               (with-directory-excursion "tdm_update"
+                 (apply invoke "scons"
+                        (append (list "-j" (number->string
+                                            (parallel-job-count)))
+                                (list ,scons-flags))))
+               #t))
+           (replace 'install
+             (lambda* (#:key inputs outputs #:allow-other-keys)
+               (let* ((out (assoc-ref outputs "out"))
+                      (mesa (assoc-ref inputs "mesa"))
+                      (bin (string-append out "/bin/thedarkmod"))
+                      (bin-real (string-append out "/bin/.thedarkmod-real"))
+                      (updater (string-append out "/bin/tdm_update"))
+                      (updater-real (string-append out 
"/bin/.tdm_update-real"))
+                      (apps (string-append out "/share/applications"))
+                      (icons (string-append out "/share/icons")))
+                 (mkdir-p (string-append out "/bin"))
+                 (copy-file ,@(match (%current-system)
+                                ("i686-linux"
+                                 '("thedarkmod.x86"))
+                                ("x86_64-linux"
+                                 '("thedarkmod.x64")))
+                            bin-real)
+                 (copy-file "tdm_update/tdm_update.linux" updater-real)
+                 (with-output-to-file bin
+                   (lambda _
+                     (format #t "\
+#!~a
+export LD_LIBRARY_PATH=~a/lib
+~a=${~a:-~a}
+cd \"$~a\"
+exec -a \"~a\" ~a \"address@hidden"\n"
+                             (which "bash")
+                             mesa
+                             ,the-dark-mod-env-var-name 
,the-dark-mod-env-var-name
+                             ,the-dark-mod-env-var-value
+                             ,the-dark-mod-env-var-name
+                             (basename bin) bin-real)))
+                 (chmod bin #o555)
+                 (with-output-to-file updater
+                   (lambda _
+                     (format #t "\
+#!~a
+~a=${~a:-~a}
+mkdir -p \"$~a\"
+## tdm_update outputs a log in its current working directory.
+cd \"$~a\"
+~a --noselfupdate --targetdir \"$~a\" \"address@hidden"~%"
+                             (which "bash")
+                             ,the-dark-mod-env-var-name 
,the-dark-mod-env-var-name
+                             ,the-dark-mod-env-var-value
+                             ,the-dark-mod-env-var-name
+                             ,the-dark-mod-env-var-name
+                             updater-real
+                             ,the-dark-mod-env-var-name)))
+                 (chmod updater #o555)
+                 (mkdir-p apps)
+                 (mkdir-p icons)
+                 (install-file "tdm_update/darkmod.ico" icons)
+                 (with-output-to-file
+                     (string-append apps "/darkmod.desktop")
+                   (lambda _
+                     (format #t
+                             "[Desktop Entry]~@
+                     Name=The Dark Mod~@
+                     Comment=The Dark Mod~@
+                     Exec=~a~@
+                     address@hidden@
+                     Icon=darkmod~@
+                     Categories=Game~@
+                     Type=Application~%"
+                             bin)))))))))
+      (inputs
+       `(("mesa" ,mesa)
+         ("libxxf86vm" ,libxxf86vm)
+         ("openal" ,openal)
+         ("libxext" ,libxext)))
+      (native-inputs
+       `(("p7zip" ,p7zip)
+         ("m4" ,m4)
+         ("subversion" ,subversion)))
+      (home-page "http://www.thedarkmod.com/";)
+      (synopsis "Game based on the Thief series by Looking Glass Studios")
+      (description (format #f "The Dark Mod (TDM) is stealth/infiltration game
+based on the Thief series by Looking Glass Studios.  Formerly a Doom III mod,
+it is now released as a standalone.
+
+The game data must be fetched manually by running @command{tdm_update}.
+The ~a environment variable specifies the location where the game data is
+saved (defaults to ~a)."
+                           the-dark-mod-env-var-name 
the-dark-mod-env-var-value))
+      (supported-systems '("x86_64-linux" "i686-linux"))
+      (license (list license:gpl3       ; idTech 4 engine
+                     license:bsd-3 ; Portion of the engine by Broken Glass 
Studios
+                     ;; All other non-software components: they are not
+                     ;; included in the Guix package, but the updater fetches
+                     ;; them.
+                     license:cc-by-sa3.0)))))
-- 
2.21.0






reply via email to

[Prev in Thread] Current Thread [Next in Thread]