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

From: Arun Isaac <[email-masked]>
Date: Tue, 18 Apr 2017 00:07:55 +0530

>> Only a matter of aesthetics, but you could split "-C" and "source" into
>> separate strings.
>>
> All the packages in games.scm do it as one string, so I didn't change it
> for now. It should be changed for all packages at once.

Fair enough...

> +       #: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)
> +             (let* ((parallel-flag (format #f "-j~d" (parallel-job-count)))
> +                    (test-flags-build (if parallel-build?
> +                                          (cons parallel-flag
> +                                                make-flags)
> +                                          make-flags))
> +                    (test-flags-run (if parallel-tests?
> +                                        (cons parallel-flag
> +                                              make-flags)
> +                                        make-flags)))

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?.

> +               (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.

> +               (apply system* (cons* "make" "debug" test-flags-build))
> +               (zero? (apply system* (cons* "make" "test" test-flags-run)))))))))

You can combine the two make commands into one.

(zero? (apply system* "make" "debug" "test" flags))

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.

> +    (build-system gnu-build-system)
> +    (inputs `(("ncurses" ,ncurses)
> +              ("sqlite" ,sqlite)
> +              ("bison" ,bison)
> +              ("flex" ,flex)

bison and flex are native-inputs. The bison and flex executables are
required only at build time.

> +              ("zlib" ,zlib)
> +              ("lua51" ,lua-5.1)))
> +    (native-inputs `(("pkg-config" ,pkg-config)
> +                     ("perl" ,perl)))

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.