Subject: Re: [bug#46997] [PATCH] gnu: Add mangband.

From: Nicolas Goaziou <[email-masked]>
Date: Sat, 13 Mar 2021 12:05:01 +0100

Hello,

Adam Kandur via Guix-patches via <[email-masked]> writes:

> gnu: Add mangband.
>
> * gnu/packages/games.scm (mangband): New variable.

Thank you. Some comments follow.

> 1 file changed, 30 insertions(+)
> gnu/packages/games.scm | 30 ++++++++++++++++++++++++++++++
>
> modified   gnu/packages/games.scm
> @@ -2952,6 +2952,36 @@ the depths below Angband, seeking riches, fighting monsters, and preparing to
>  fight Morgoth, the Lord of Darkness.")
>      (license license:gpl2)))

Something is wrong with your indentation, as there are nbsp inserted
throughout your patch.

I couldn't also apply your patch cleanly. Did you try using git
format-patch?

> +(define-public mangband
> +  (package
> +    (name "mangband")
> +    (version "v1.5.3")

Version should be "1.5.3", the "v" is prepended in the commit.

> +    (source
> +     (origin
> +       (method git-fetch)
> +       (uri (git-reference
> +         (url "https://github.com/mangband/mangband")
> +         (commit version)))
> +       (file-name (git-file-name name version))
> +       (sha256
> +        (base32 "1m7fixv0cbcdzrvxqrjs3jfpzkhq2aj3zip3y67w38a3fbhwdq1k"))))
> +    (build-system gnu-build-system)
> +    (inputs
> +     `(("ncurses" ,ncurses)
> +       ("sdl2" ,sdl2)

I don't think this is sufficient, MAngband also looks for sdl2-image and
sdl2-ttf.

> +       ("automake", automake)
> +       ("autoconf", autoconf)))

automake and autoconf belong to native-inputs, not inputs.  Also, inputs
ought to be sorted alphabetically (nitpick).

> +    (home-page "https://github.com/mangband/mangband")

The home page is https://www.mangband.org

> +    (synopsis "A free online multi-player realtime roguelike game based on Angband.")

Synopsis must not start with an article, and "free" should be removed as
everything in Guix is free. There is no final full stop either in
a synopsis.

You may want to run guix lint mangband to catch some common errors.

> +    (license license:expat)))

I think this is more complex than that. Looking at the COPYING file,
there's also, at least, public-domain and bsd-2 involved.

But, more importantly, I couldn't make this game work. Running
mangclient fails with a segmentation error, while running mangband fails
with the following fatal error: "Cannot create the
'/gnu/store/…-mangband-1.5.3/var/mangband/data/scores.raw' file!"

Could you look into it. I paste here my "improved" version of the
package definition, if that helps.

--8<---------------cut here---------------start------------->8---
(define-public mangband
  (package
    (name "mangband")
    (version "1.5.3")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
             (url "https://github.com/mangband/mangband")
             (commit (string-append "v" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32 "1m7fixv0cbcdzrvxqrjs3jfpzkhq2aj3zip3y67w38a3fbhwdq1k"))))
    (build-system gnu-build-system)
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (add-after 'set-paths 'set-sdl-paths
           (lambda* (#:key inputs #:allow-other-keys)
             (setenv "CPATH"
                     (string-append (assoc-ref inputs "sdl-union")
                                    "/include/SDL2:"
                                    (or (getenv "CPATH") "")))
             #t)))))
    (native-inputs
     `(("autoconf", autoconf)
       ("automake", automake)))
    (inputs
     `(("ncurses" ,ncurses)
       ("sdl-union" ,(sdl-union (list sdl2 sdl2-image sdl2-ttf)))))
    (home-page "https://www.mangband.org")
    (synopsis "Online multi-player realtime roguelike game based on Angband")
    (description
     "MAngband is a free online multiplayer real-time roguelike game, derived
from the single player game Angband.

To win the game you must build up a character, selected from any one of 10
races and 6 classes, to be powerful enough to defeat Morgoth, Lord of
Darkness, who lives in the dungeon 5000 feet below the surface of the town.
As you work towards this near-impossible goal, you will chart unexplored
dungeon passageways, do battle with legendary creatures, and find lost
artifacts.  And of course throughout your journeys you will encounter many
other adventurers -- whether they be friend or foe is up to you to decide!")
    (license (list license:expat license:bsd-2 license:public-domain))))
--8<---------------cut here---------------end--------------->8---

Regards,
-- 
Nicolas Goaziou