Hi!

This is my first package for the Guix project.  I've done my best to
follow all the guidelines.

As you can see, I had to make use of quite few tricks to make it work.

To the people in #guix: thanks a lot for your help!


Albin
From 061be49f0b39370541320984fc9eb53c2f2076c2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Albin=20S=C3=B6derqvist?= <al...@fripost.org>
Date: Tue, 12 Apr 2016 00:13:08 +0200
Subject: [PATCH] gnu: Add openttd.

---
 gnu/packages/games.scm | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 69 insertions(+)

diff --git a/gnu/packages/games.scm b/gnu/packages/games.scm
index 653e0c7..8ae59c7 100644
--- a/gnu/packages/games.scm
+++ b/gnu/packages/games.scm
@@ -17,6 +17,7 @@
 ;;; Copyright © 2016 Rodger Fox <thylak...@openmailbox.org>
 ;;; Copyright © 2016 Manolis Fragkiskos Ragkousis <manolis...@gmail.com>
 ;;; Copyright © 2016 Nils Gillmann <niaster...@grrlz.net>
+;;; Copyright © 2016 Albin Söderqvist <al...@fripost.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -61,6 +62,7 @@
   #:use-module (gnu packages libunwind)
   #:use-module (gnu packages haskell)
   #:use-module (gnu packages mp3)
+  #:use-module (gnu packages icu4c)
   #:use-module (gnu packages image)
   #:use-module (gnu packages ncurses)
   #:use-module (gnu packages python)
@@ -1859,6 +1861,73 @@ and a game metadata scraper.")
     (home-page "http://www.emulationstation.org";)
     (license license:expat)))
 
+(define-public openttd
+  (package
+    (name "openttd")
+    (version "1.6.0")
+    (source
+     (origin (method url-fetch)
+             ;; The official download URL is
+             ;; http://binaries.openttd.org/releases/1.6.0/openttd-1.6.0-source.tar.xz
+             ;; but it doesn't work with `guix download`.  However, it
+             ;; redirects to the one below (and the SHA sums match).
+             (uri (string-append "http://ftp.snt.utwente.nl/pub/games";
+                                 "/openttd/binaries/releases/" version
+                                 "/openttd-" version "-source.tar.xz"))
+             (sha256
+              (base32
+               "1cjf9gz7d0sn7893wv9d00q724sxv3d81bgb0c5f5ppz2ssyc4jc"))
+             (modules '((guix build utils)))
+             (snippet
+              '(begin
+                 ;; The DOS port contains proprietary software, thus:
+                 (delete-file-recursively "os/dos")
+                 ;; GNU's not Unix so let's modify the exit dialog.
+                 (substitute* (find-files "src/lang/" "\\.txt")
+                   ((":Unix") ":GNU"))))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:tests? #f ;; no "check" target.
+       #:phases
+       (modify-phases %standard-phases
+         (replace 'configure
+           (lambda* (#:key outputs #:allow-other-keys)
+             ;; The build scripts don't understand the option
+             ;; `--enable-fast-install'.
+             (let ((out (assoc-ref outputs "out")))
+               (zero?
+                (system* "./configure"
+                         ;; At the moment, `lzo' must be disabled
+                         ;; because the `config.lib' script cannot
+                         ;; find it.  It is only necessary for loading
+                         ;; saved games generated by early versions of
+                         ;; OpenTTD.
+                         (string-append "--prefix=" out)
+                         "--without-liblzo2"
+                         ;; Put the binary in `bin' instead of `games'
+                         "--binary-dir=bin"))))))))
+    (native-inputs `(("pkg-config" ,pkg-config)))
+    (inputs
+     `(("allegro" ,allegro-4)
+       ("fontconfig" ,fontconfig)
+       ("freetype" ,freetype)
+       ("icu4c" ,icu4c)
+       ("libpng" ,libpng)
+       ;; ("lzo" ,lzo) disabled for the time being (see above).
+       ("sdl" ,sdl)
+       ("xz" ,xz)
+       ("zlib" ,zlib)))
+    (synopsis "Transportation economics simulator")
+    (description "OpenTTD is a game in which you transport goods and
+passengers by land, water and air.  It is a free implementation of
+Transport Tycoon Deluxe but with many enhancements including
+multiplayer mode, internationalization support, conditional orders and
+the ability to clone, autoreplace and autoupdate vehicles.")
+    (home-page "http://openttd.org/";)
+    ;; The software contains an in-game downloader from which the user
+    ;; may find non-functional data licensed under different terms.
+    (license license:gpl2)))
+
 (define-public pinball
   (package
     (name "pinball")
-- 
2.6.3

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to