Subject: [bug#27421] [PATCH 4/5] gnu: Add openttd-opengfx.

From: Kei Kebreau <[email-masked]>
Date: Sun, 18 Jun 2017 13:45:18 -0400

* gnu/packages/games.scm (openttd-opengfx): New variable.
---
 gnu/packages/games.scm | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)

diff --git a/gnu/packages/games.scm b/gnu/packages/games.scm
index 2c5294737..4214a2f75 100644
--- a/gnu/packages/games.scm
+++ b/gnu/packages/games.scm
@@ -73,6 +73,7 @@
   #:use-module (gnu packages game-development)
   #:use-module (gnu packages gettext)
   #:use-module (gnu packages ghostscript)
+  #:use-module (gnu packages gimp)
   #:use-module (gnu packages gl)
   #:use-module (gnu packages glib)
   #:use-module (gnu packages gnome)
@@ -2299,6 +2300,55 @@ engine.  When you start it you will be prompted to download a graphics set.")
 ;; 'openttd' a wrapper around them.  The engine is playable by itself,
 ;; but it asks a user to download graphics if it's not found.
 
+(define openttd-opengfx
+  (package
+    (name "openttd-opengfx")
+    (version "0.5.2")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "http://binaries.openttd.org/extra/opengfx/"
+                           version "/opengfx-" version "-source.tar.xz"))
+       (sha256
+        (base32
+         "0iz66q7p1mf00njfjbc4vibh3jaybki7armkl18iz7p6x4chp9zv"))))
+    (build-system gnu-build-system)
+    (arguments
+     '(#:make-flags (list "CC=gcc"
+                          (string-append "INSTALL_DIR="
+                                         (assoc-ref %outputs "out")
+                                         "/share/openttd/baseset"))
+       #:phases
+       (modify-phases %standard-phases
+         (replace 'configure
+           (lambda _
+             ;; Make sure HOME is writable for GIMP.
+             (setenv "HOME" (getcwd))
+
+             ;; Redirect stdout to /dev/null instead of stderr. This prevents
+             ;; dos2unix from receiving its version information as a flag.
+             (substitute* "Makefile"
+               (("\\$\\(UNIX2DOS\\) -q --version 2>/dev/null")
+                "$(UNIX2DOS) -q --version 1>/dev/null")))))
+       ;; The check phase for this package only checks the md5sums of the built
+       ;; GRF files against the md5sums of the release versions. Because we use
+       ;; different software versions than upstream does, some of the md5sums
+       ;; are different. However, the package is still reproducible, it's safe
+       ;; to disable this test.
+       #:tests? #f))
+    (native-inputs `(("dos2unix" ,dos2unix)
+                     ("gimp" ,gimp)
+                     ("grfcodec" ,grfcodec)
+                     ("nml" ,nml)
+                     ("python" ,python-2)))
+    (home-page "http://dev.openttdcoop.org/projects/opengfx")
+    (synopsis "Base graphics set for OpenTTD")
+    (description
+     "The OpenGFX project is a free replacement of the base graphics so that
+OpenTTD can be shipped finally fully functional without the need for additional
+downloads.")
+    (license license:gpl2)))
+
 (define-public openttd
   (package
     (inherit openttd-engine)
-- 
2.13.0