summary refs log tree commit diff
path: root/gnu/packages
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-11-11 00:05:20 +0100
committerLudovic Courtès <ludo@gnu.org>2014-11-11 00:06:01 +0100
commita6b55314b13a61ea4a14a47f1e5e5822235c307c (patch)
tree78b87e35a0c55c65a6d330275d75bbfc9bf31b48 /gnu/packages
parentbb3b71ce8799d848d327ec9a14ed4bb4c6977bca (diff)
downloadguix-a6b55314b13a61ea4a14a47f1e5e5822235c307c.tar.gz
gnu: Add wrapper for Freedink.
* gnu/packages/games.scm (freedink-engine, freedink-data): Make
  private.
  (freedink): New variable.
Diffstat (limited to 'gnu/packages')
-rw-r--r--gnu/packages/games.scm36
1 files changed, 33 insertions, 3 deletions
diff --git a/gnu/packages/games.scm b/gnu/packages/games.scm
index 89e80c34e8..df24c0da38 100644
--- a/gnu/packages/games.scm
+++ b/gnu/packages/games.scm
@@ -4,6 +4,7 @@
 ;;; Copyright © 2014 Eric Bavier <bavier@member.fsf.org>
 ;;; Copyright © 2014 Cyrill Schenkel <cyrill.schenkel@gmail.com>
 ;;; Copyright © 2014 Sylvain Beucler <beuc@beuc.net>
+;;; Copyright © 2014 Ludovic Courtès <ludo@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -45,7 +46,9 @@
   #:use-module (gnu packages texinfo)
   #:use-module (gnu packages check)
   #:use-module (gnu packages fontutils)
-  #:use-module (guix build-system gnu))
+  #:use-module (gnu packages bash)
+  #:use-module (guix build-system gnu)
+  #:use-module (guix build-system trivial))
 
 (define-public gnubg
   (package
@@ -289,7 +292,7 @@ against the computer in a game of chess, either through the default terminal
 interface or via an external visual interface such as GNU XBoard.")
     (license gpl3+)))
 
-(define-public freedink-engine
+(define freedink-engine
   (package
     (name "freedink-engine")
     (version "108.4")
@@ -320,7 +323,7 @@ game data files but it also supports user-produced game mods or \"D-Mods\".
 To that extent, it also includes a front-end for managing all of your D-Mods.")
     (license gpl3+)))
 
-(define-public freedink-data
+(define freedink-data
   (package
     (name "freedink-data")
     (version "1.08.20140901")
@@ -343,6 +346,33 @@ To that extent, it also includes a front-end for managing all of your D-Mods.")
 
 ;; TODO: Add freedink-dfarc when there's a wxWidgets package.
 
+(define-public freedink
+  ;; This is a wrapper that tells the engine where to find the data.
+  (package (inherit freedink-engine)
+    (name "freedink")
+    (build-system trivial-build-system)
+    (arguments
+     '(#:builder (begin
+                   (use-modules (guix build utils))
+
+                   (let* ((output     (assoc-ref %outputs "out"))
+                          (bin        (string-append output "/bin"))
+                          (executable (string-append bin "/freedink")))
+                     (mkdir-p bin)
+                     (call-with-output-file executable
+                       (lambda (port)
+                         (format port "#!~a/bin/sh
+exec ~a/bin/freedink -refdir ~a/share/dink\n"
+                                 (assoc-ref %build-inputs "bash")
+                                 (assoc-ref %build-inputs "engine")
+                                 (assoc-ref %build-inputs "data"))
+                         (chmod port #o777)))))
+       #:modules ((guix build utils))))
+    (inputs `(("engine" ,freedink-engine)
+              ("data" ,freedink-data)
+              ("bash" ,bash)))
+    (native-inputs '())))
+
 (define-public xboard
   (package
     (name "xboard")