Subject: [PATCH 5/5] gnu: openttd-engine: Add 'install-data' phase.

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

* gnu/packages/games.scm (openttd-engine): Rename package to openttd.
[arguments]: Add it.
[native-inputs]: Add openttd-opengfx.
---
 gnu/packages/games.scm | 28 +++++++++++++++++-----------
 1 file changed, 17 insertions(+), 11 deletions(-)

diff --git a/gnu/packages/games.scm b/gnu/packages/games.scm
index 4214a2f75..112e1c3db 100644
--- a/gnu/packages/games.scm
+++ b/gnu/packages/games.scm
@@ -2236,9 +2236,9 @@ and a game metadata scraper.")
       (home-page "http://www.emulationstation.org")
       (license license:expat))))
 
-(define openttd-engine
+(define-public openttd
   (package
-    (name "openttd-engine")
+    (name "openttd")
     (version "1.7.1")
     (source
      (origin (method url-fetch)
@@ -2269,8 +2269,20 @@ and a game metadata scraper.")
                          (string-append "--with-liblzo2="
                                         lzo "/lib/liblzo2.a")
                          ;; Put the binary in 'bin' instead of 'games'.
-                         "--binary-dir=bin"))))))))
-    (native-inputs `(("pkg-config" ,pkg-config)))
+                         "--binary-dir=bin")))))
+         (add-after 'install 'install-data
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let*
+                 ((opengfx (assoc-ref inputs "opengfx"))
+                  (out (assoc-ref outputs "out"))
+                  (gfx-dir
+                   (string-append out "/share/games/openttd/baseset/opengfx")))
+               (mkdir-p gfx-dir)
+               (copy-recursively opengfx gfx-dir))
+             #t)))))
+    (native-inputs
+     `(("opengfx" ,openttd-opengfx)
+       ("pkg-config" ,pkg-config)))
     (inputs
      `(("allegro" ,allegro-4)
        ("fontconfig" ,fontconfig)
@@ -2316,8 +2328,7 @@ engine.  When you start it you will be prompted to download a graphics set.")
     (arguments
      '(#:make-flags (list "CC=gcc"
                           (string-append "INSTALL_DIR="
-                                         (assoc-ref %outputs "out")
-                                         "/share/openttd/baseset"))
+                                         (assoc-ref %outputs "out")))
        #:phases
        (modify-phases %standard-phases
          (replace 'configure
@@ -2349,11 +2360,6 @@ OpenTTD can be shipped finally fully functional without the need for additional
 downloads.")
     (license license:gpl2)))
 
-(define-public openttd
-  (package
-    (inherit openttd-engine)
-    (name "openttd")))
-
 (define-public pinball
   (package
     (name "pinball")
-- 
2.13.0