From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: [PATCH] gnu: Add nethack. Date: Sat, 04 Jun 2016 23:15:57 +0200 Message-ID: <87y46kwt82.fsf@gnu.org> References: <20160531175630.0bfd76ff@openmailbox.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:42311) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b9IvN-0000sT-ER for guix-devel@gnu.org; Sat, 04 Jun 2016 17:16:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b9IvJ-0001lj-Fw for guix-devel@gnu.org; Sat, 04 Jun 2016 17:16:05 -0400 In-Reply-To: <20160531175630.0bfd76ff@openmailbox.org> (Kei Kebreau's message of "Tue, 31 May 2016 17:56:30 -0400") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Kei Kebreau Cc: guix-devel@gnu.org Hi! Kei Kebreau skribis: > From b728e078408f17136e8a4c3344b606e8f152b9e4 Mon Sep 17 00:00:00 2001 > From: Kei Kebreau > Date: Tue, 31 May 2016 17:42:28 -0400 > Subject: [PATCH] gnu: Add nethack. > > * gnu/packages/games.scm (nethack): New variable. You need to mention the new .patch file here (see =E2=80=98git log=E2=80=99= for examples.) You also need to add the .patch file to gnu/local.mk, and to mention the change to gnu/local.mk in the commit log. [...] > + (replace 'configure > + (lambda* (#:key inputs outputs #:allow-other-keys) > + (let ((out (assoc-ref outputs "out"))) > + (substitute* "sys/unix/hints/linux" > + (("^PREFIX=3D.*$") > + (string-append "PREFIX=3D" out "\n")) > + (("/bin/gzip") (which "gzip"))) > + (substitute* "sys/unix/setup.sh" > + (("/bin/sh") (which "bash")))) > + (system* "sh" "sys/unix/setup.sh" "sys/unix/hints/linux"))) Should be: (zero? (system* =E2=80=A6)), which returns #t on success (a phase must return a true value to be considered successful.) > + (add-after 'install 'move-state-files > + (lambda* (#:key inputs outputs #:allow-other-keys) > + (let* ((out (assoc-ref outputs "out"))) > + (mkdir (string-append out "/games/lib/nethack-state-files= ")) > + (chdir (string-append out "/games/lib/nethackdir")) > + (for-each (lambda (file) > + (system* "mv" file > + (string-append > + out "/games/lib/nethack-state-files= "))) Instead of using the =E2=80=98mv=E2=80=99 command (or any other Coreutils c= ommand, for that matter), use the Scheme equivalent. Here it would be: (install-file file directory) Besides, =E2=80=9C/games=E2=80=9D is unusual in the file system hierarchy. = Usually, state files go to the localstatedir, i.e., the var/PACKAGE subdirectory. Thus, what about putting state files in OUT/var/nethack? But again, OUT is immutable, so these files cannot be modified, so they=E2=80=99re not really =E2=80=9Cstate.=E2=80=9D > + '("logfile" "perm" "record" "save" "xlogfile"))= ))) For clarity, have the phase return #t. > + (add-after 'move-state-files 'wrap-program > + (lambda* (#:key inputs outputs #:allow-other-keys) > + (let* ((out (assoc-ref outputs "out")) > + (bin (string-append out "/bin")) > + (nethack-user-dir "~/.nethack")) > + (mkdir bin) > + (with-directory-excursion bin > + (call-with-output-file "nethack" > + (lambda (port) > + (format port "#!~a/bin/sh -e > +# Create NetHack directory in user's $HOME if it isn't there > +if [ ! -d ~a ]; then > + mkdir -p ~a > + cp -r ~a/* ~a > + chmod -R +w ~a > +fi > + > +RUNDIR=3D$(mktemp -d) > + > +cleanup() { > + rm -rf $RUNDIR > +} > +trap cleanup EXIT > + > +cd $RUNDIR > +for i in ~a/*; do > + ln -s $i $(basename $i) > +done > +for i in ~a/*; do > + ln -s $i $(basename $i) > +done > +./nethack~%" Do we really need this wrapper? Can=E2=80=99t we instead take it as a patch from Debian or something? I=E2=80=99m not a fan of inline Bash code, and n= ot very confident of scripts that do =E2=80=98rm -rf=E2=80=99. :-) > +--- nethack-3.6.0.orig/include/config.h 2016-05-27 17:20:03.062318307 -0= 400 > ++++ nethack-3.6.0/include/config.h 2016-05-31 16:48:04.283642766 -0400 Patches must always start with a line or two indicating what they do and what their upstream status or origin is. > +@@ -308,7 +308,6 @@ > + #define INSURANCE /* allow crashed game recovery */ > +=20 > + #ifndef MAC > +-#define CHDIR /* delete if no chdir() available */ > + #endif Why? > +-# CC =3D gcc > ++CC =3D gcc > + # > + # For Bull DPX/2 systems at B.O.S. 2.0 or higher use the following: > + # > +@@ -104,11 +104,11 @@ > +=20 > + # yacc/lex programs to use to generate *_comp.h, *_lex.c, and *_yacc.c. > + # if, instead of yacc/lex you have bison/flex, comment/uncomment the fo= llowing. > +-YACC =3D yacc > +-LEX =3D lex > +-# YACC =3D bison -y > ++# YACC =3D yacc > ++# LEX =3D lex > ++YACC =3D bison -y > + # YACC =3D byacc > +-# LEX =3D flex > ++LEX =3D flex Would it work to, instead, do: #:make-flags '("CC=3Dgcc" "LEX=3Dflex" =E2=80=A6) If it does, I think it=E2=80=99s preferable. Could you send an updated patch? Thanks for working on this tricky package! ;-) Ludo=E2=80=99.