unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Pierre Neidhardt <mail@ambrevar.xyz>
To: 35234@debbugs.gnu.org
Subject: [bug#35234] [PATCH] gnu: Add the-dark-mod.
Date: Thu, 11 Apr 2019 20:16:44 +0200	[thread overview]
Message-ID: <20190411181644.21661-1-mail@ambrevar.xyz> (raw)

* 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 \"$@\"\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\" \"$@\"~%"
+                             (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~@
+                     TryExec=~@*~a~@
+                     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	other threads:[~2019-04-11 18:18 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-11 18:16 Pierre Neidhardt [this message]
2019-04-11 19:40 ` [bug#35234] [PATCH] gnu: Add the-dark-mod Ricardo Wurmus
2019-04-12  9:39   ` Pierre Neidhardt
2019-04-12 11:22     ` Ricardo Wurmus
2019-04-12 12:02       ` Pierre Neidhardt
2019-04-21 14:13         ` Ricardo Wurmus
2019-04-21 16:18           ` Ludovic Courtès
2019-04-22  9:02             ` Pierre Neidhardt
2019-04-22  9:19               ` Ricardo Wurmus
2019-04-22  9:42                 ` Pierre Neidhardt
2019-04-22 16:50                 ` Ludovic Courtès
2019-04-22 17:42                   ` Pierre Neidhardt
2019-04-22 10:01             ` Adonay Felipe Nogueira
2019-04-22  9:40           ` Adonay Felipe Nogueira
2019-04-22 11:56             ` Ricardo Wurmus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190411181644.21661-1-mail@ambrevar.xyz \
    --to=mail@ambrevar.xyz \
    --cc=35234@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).