Subject: Re: bug#26488: [PATCH] gnu: Add crawl.

From: nee <[email-masked]>
Date: Wed, 19 Apr 2017 00:15:33 +0200

Am 17.04.2017 um 20:37 schrieb Arun Isaac:
> The parallel-build? and parallel-tests? arguments are only to disable
> parallel builds and tests for packages whose build procedures fail when
> run parallely. crawl's build and tests work fine when run in
> parallel. So, you don't have to allow for sequential builds in your
> 'check phase. You can just assume the build is always going to be
> parallel. No need to test for parallel-build? and parallel-test?.
> 
Okay, removed it.
>> +               (setenv "HOME" (getcwd))
>> +               ;; Fake a terminal for the test cases.
>> +               (setenv "TERM" "xterm-256color")
>> +               (setenv "COLUMNS" "80")
>> +               (setenv "LINES" "24")
> 
> It looks like COLUMNS and LINES are not needed to fake a terminal. I was
> able to build successfully without them. Please check.
> 
I checked it and you are right. I assumed it would impact the tests,
because I know that crawl won't run in too small terminals. That doesn't
seem to be the case, so I removed it now.

> You can combine the two make commands into one.
> 
> Also note that only the last argument of apply needs to be a list. No
> need to cons* together to construct a list like you have done.
> 
Always nice to learn how I can make things shorter :)

> bison and flex are native-inputs. The bison and flex executables are
> required only at build time.
> 
Okay, I moved them into native and it still works.

> It would be nice if you could sort all inputs and native-inputs in
> alphabetical order. Not all package definitions do it. But, it does look
> neater.
> 
Okay, I reordered them.

Thank you very much, for your intensive help with cleaning up this package!
From 868d777e1856019c0037c43647cfa245f0d0fb5b Mon Sep 17 00:00:00 2001
From: nee <[email-masked]>
Date: Thu, 13 Apr 2017 22:45:18 +0200
Subject: [PATCH] gnu: Add crawl.

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

diff --git a/gnu/packages/games.scm b/gnu/packages/games.scm
index 710b2746c..451500a04 100644
--- a/gnu/packages/games.scm
+++ b/gnu/packages/games.scm
@@ -27,6 +27,7 @@
 ;;; Copyright © 2017 Adonay "adfeno" Felipe Nogueira <https://libreplanet.org/wiki/User:Adfeno> <[email-masked]>
 ;;; Copyright © 2017 Arun Isaac <[email-masked]>
 ;;; Copyright © 2017 Tobias Geerinckx-Rice <[email-masked]>
+;;; Copyright © 2017 nee <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -115,6 +116,8 @@
   #:use-module (gnu packages messaging)
   #:use-module (gnu packages upnp)
   #:use-module (gnu packages wxwidgets)
+  #:use-module (gnu packages bison)
+  #:use-module (gnu packages flex)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system haskell)
   #:use-module (guix build-system python)
@@ -3649,3 +3652,71 @@ small robot living in the nano world, repair its maker.")
     ;; kiki-the-nano-bot/kiki-the-nano-bot_1.0.2+dfsg1-4_copyright>
     ;; for a statement from the author.
     (license license:public-domain)))
+
+(define-public crawl
+  (package
+    (name "crawl")
+    (version "0.19.5")
+    (source (origin
+              (method url-fetch)
+              (uri (list
+                    ;; Older releases get moved into a versioned directory
+                    (string-append "http://crawl.develz.org/release/"
+                                   (version-major+minor version) "/stone_soup-"
+                                   version "-nodeps.tar.xz")
+                    ;; Only the latest release is in this directory
+                    (string-append "http://crawl.develz.org/release/stone_soup-"
+                                   version "-nodeps.tar.xz")))
+              (sha256
+               (base32
+                "00yl2lb2shglxlxzpyk99zvglfx4amjybqwnzdcasvbiggb4cj18"))))
+    (arguments
+     '(#:make-flags
+       (let* ((sqlite (assoc-ref %build-inputs "sqlite"))
+              (out (assoc-ref %outputs "out")))
+         (list (string-append "SQLITE_INCLUDE_DIR=" sqlite "/include")
+               (string-append "prefix=" out)
+               "SAVEDIR=~/.crawl"
+               ;; disable graphical client
+               "TILES="
+               ;; don't build any bundeled dependencies
+               "BUILD_LUA="
+               "BUILD_SQLITE="
+               "BUILD_ZLIB="
+               "-Csource"))
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure)
+         (delete 'check)
+         ;; Test cases require the source to be rebuild with the -DDEBUG define.
+         ;; Do 'check before 'build to avoid a 3rd build on make install.
+         (add-before 'build 'check
+           (lambda* (#:key inputs outputs make-flags
+                     parallel-build? parallel-tests? #:allow-other-keys)
+             (setenv "HOME" (getcwd))
+             ;; Fake a terminal for the test cases.
+             (setenv "TERM" "xterm-256color")
+             (zero? (apply system* "make" "debug" "test"
+                           (cons (format #f "-j~d" (parallel-job-count))
+                                 make-flags))))))))
+    (build-system gnu-build-system)
+    (inputs `(("lua51" ,lua-5.1)
+              ("ncurses" ,ncurses)
+              ("sqlite" ,sqlite)
+              ("zlib" ,zlib)))
+    (native-inputs `(("bison" ,bison)
+                     ("flex" ,flex)
+                     ("pkg-config" ,pkg-config)
+                     ("perl" ,perl)))
+    (synopsis "Roguelike dungeon crawler game")
+    (description "Dungeon Crawl Stone Soup is a roguelike adventure through
+dungeons filled with dangerous monsters in a quest to find the mystifyingly
+fabulous Orb of Zot.")
+    (home-page "https://crawl.develz.org")
+    (license (list license:gpl2+
+                   license:bsd-2
+                   license:bsd-3
+                   license:cc0
+                   license:x11
+                   license:zlib
+                   license:asl2.0))))
-- 
2.12.2