From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kei Kebreau Subject: [PATCH] gnu: Add nethack. Date: Tue, 31 May 2016 17:56:30 -0400 Message-ID: <20160531175630.0bfd76ff@openmailbox.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; boundary="Sig_/oF/v=oaUaeTsb19Ok=W69aH"; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:39906) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b7reW-0007gx-Vk for guix-devel@gnu.org; Tue, 31 May 2016 17:56:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b7reR-0005mt-Ms for guix-devel@gnu.org; Tue, 31 May 2016 17:56:43 -0400 Received: from mail.openmailbox.org ([62.4.1.34]:52321) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b7reR-0005kB-7Q for guix-devel@gnu.org; Tue, 31 May 2016 17:56:39 -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: guix-devel@gnu.org --Sig_/oF/v=oaUaeTsb19Ok=W69aH Content-Type: multipart/mixed; boundary="MP_/7tW8.3.kozCRryb8X3HY01V" --MP_/7tW8.3.kozCRryb8X3HY01V Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline NetHack finally works, though I'd like others to review the implementation. This is also my first time adding a .patch file to the repository, so advice along those lines would be appreciated. --=20 Kei (GPG Key: 4096R/E6A5EE3C19467A0D) --MP_/7tW8.3.kozCRryb8X3HY01V Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename=0001-gnu-Add-nethack.patch =46rom 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. --- gnu/packages/games.scm | 98 ++++++++++++++++++= ++++ ...thack-correct-directories-and-permissions.patch | 72 ++++++++++++++++ 2 files changed, 170 insertions(+) create mode 100644 gnu/packages/patches/nethack-correct-directories-and-pe= rmissions.patch diff --git a/gnu/packages/games.scm b/gnu/packages/games.scm index fc16862..44afb87 100644 --- a/gnu/packages/games.scm +++ b/gnu/packages/games.scm @@ -49,10 +49,12 @@ #:use-module (gnu packages autotools) #:use-module (gnu packages backup) #:use-module (gnu packages base) + #:use-module (gnu packages bison) #:use-module (gnu packages admin) #:use-module (gnu packages audio) #:use-module (gnu packages avahi) #:use-module (gnu packages boost) + #:use-module (gnu packages flex) #:use-module (gnu packages fribidi) #:use-module (gnu packages game-development) #:use-module (gnu packages gettext) @@ -2243,3 +2245,99 @@ Red Eclipse provides fast paced and accessible gamep= lay.") license:cc-by-sa3.0 license:cc-by3.0 license:cc0))))) + +(define-public nethack + (package + (name "nethack") + (version "3.6.0") + (source (origin + (method url-fetch) + (uri (string-append "mirror://sourceforge/" name "/" name "-" + (string-join (string-split version #\.) = "") + "-src.tgz")) + (sha256 + (base32 + "12mi5kgqw3q029y57pkg3gnp930p7yvlqi118xxdif2qhj6nkphs")) + (patches + (search-patches + "nethack-correct-directories-and-permissions.patch")))) + (build-system gnu-build-system) + (arguments + `(#:tests? #f ; no check target + #:phases + (modify-phases %standard-phases + (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"))) + (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")= )) + '("logfile" "perm" "record" "save" "xlogfile"))))) + (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~%" + (assoc-ref inputs "bash") ;implicit input + (string-append nethack-user-dir) + (string-append nethack-user-dir) + (string-append + out "/games/lib/nethack-state-files") + (string-append nethack-user-dir) + (string-append nethack-user-dir) + (string-append nethack-user-dir) + (string-append out "/games/lib/nethackdir") + (string-append out)))) + (chmod "nethack" #o555))) + #t))))) + (native-inputs + `(("bison" ,bison) + ("flex" ,flex))) + (inputs `(("ncurses" ,ncurses))) + (home-page "http://nethack.org") + (synopsis "Single player dungeon exploration game") + (description + "Nethack is a roguelike game that emphasizes discovery of details in = the +dungeon. The random number generator provides an unlimited number of +variations of the dungeon.") + (license (license:fsf-free "http://nethack.org/common/license.html")))) diff --git a/gnu/packages/patches/nethack-correct-directories-and-permissio= ns.patch b/gnu/packages/patches/nethack-correct-directories-and-permissions= .patch new file mode 100644 index 0000000..6f6d436 --- /dev/null +++ b/gnu/packages/patches/nethack-correct-directories-and-permissions.patch @@ -0,0 +1,72 @@ +diff -r -u nethack-3.6.0.orig/include/config.h nethack-3.6.0/include/confi= g.h +--- nethack-3.6.0.orig/include/config.h 2016-05-27 17:20:03.062318307 -0400 ++++ nethack-3.6.0/include/config.h 2016-05-31 16:48:04.283642766 -0400 +@@ -308,7 +308,6 @@ + #define INSURANCE /* allow crashed game recovery */ +=20 + #ifndef MAC +-#define CHDIR /* delete if no chdir() available */ + #endif +=20 + #ifdef CHDIR +diff -r -u nethack-3.6.0.orig/include/unixconf.h nethack-3.6.0/include/uni= xconf.h +--- nethack-3.6.0.orig/include/unixconf.h 2016-05-27 17:20:03.062318307 -0= 400 ++++ nethack-3.6.0/include/unixconf.h 2016-05-30 20:33:52.132273630 -0400 +@@ -36,7 +36,7 @@ + #define NETWORK /* if running on a networked system */ + /* e.g. Suns sharing a playground through NFS */ + /* #define SUNOS4 */ /* SunOS 4.x */ +-/* #define LINUX */ /* Another Unix clone */ ++#define LINUX /* Another Unix clone */ + /* #define CYGWIN32 */ /* Unix on Win32 -- use with case sensitive define= s */ + /* #define GENIX */ /* Yet Another Unix Clone */ + /* #define HISX */ /* Bull Unix for XPS Machines */ +diff -r -u nethack-3.6.0.orig/sys/unix/Makefile.src nethack-3.6.0/sys/unix= /Makefile.src +--- nethack-3.6.0.orig/sys/unix/Makefile.src 2016-05-27 17:20:03.082318966= -0400 ++++ nethack-3.6.0/sys/unix/Makefile.src 2016-05-27 17:42:47.183397931 -0400 +@@ -64,7 +64,7 @@ + # if you get setcgtty() warnings during execution, you are feeding gcc + # a non-ANSI -- either run fixincludes on it or use + # -traditional in CFLAGS +-# CC =3D gcc ++CC =3D gcc + # + # For Bull DPX/2 systems at B.O.S. 2.0 or higher use the following: + # +@@ -238,7 +238,7 @@ + # WINTTYLIB =3D -ltermcap + # WINTTYLIB =3D -lcurses + # WINTTYLIB =3D -lcurses16 +-# WINTTYLIB =3D -lncurses ++WINTTYLIB =3D -lncurses + #WINTTYLIB =3D -ltermlib + # + # libraries for X11 +diff -r -u nethack-3.6.0.orig/sys/unix/Makefile.utl nethack-3.6.0/sys/unix= /Makefile.utl +--- nethack-3.6.0.orig/sys/unix/Makefile.utl 2016-05-27 17:20:03.082318966= -0400 ++++ nethack-3.6.0/sys/unix/Makefile.utl 2016-05-27 20:01:54.605040799 -0400 +@@ -18,7 +18,7 @@ +=20 + # if you are using gcc as your compiler, + # uncomment the CC definition below if it's not in your environment +-# 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 foll= owing. +-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 +=20 + # these are the names of the output files from YACC/LEX. Under MS-DOS + # and similar systems, they may differ --=20 2.7.4 --MP_/7tW8.3.kozCRryb8X3HY01V-- --Sig_/oF/v=oaUaeTsb19Ok=W69aH Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJXTgiOAAoJEOal7jwZRnoNFT8P/1CXd8ZYM6LeWtHn+uBg8xtK dw01SadXiLzl18nl6SAAc/glaCIgnNqDFXeyKlmNJffrQsdJ3Kwce0u8LZgC5A0F vbobzHkKdywSXggEx5j35UKbU/M2ywoTBtq4bCSAkL3L8HlzZLwQPMxfwkb6Gohj I+lRNP6bNFWY5W/lZOdwJLofTyYj48sxsij0rPUbz/bdHuFfKRjIifEcURV6x+66 dzI0lwpR04taWNTPO8mkqnS36bn/IwqhJ3QQskd6FkBgGZxJNPkC+/6sYB/qgAvZ bvAFT1toB5GSJbGiFcjw9Z3fDFSD18oVTz4ZEm99FGDIit0LHRWfJv896p9K4xit spJaoHF6K3YhfVRRLvR2AXn1yussQV3tlAjvM7S3kmM2s1pE8T8aAqePC2gJj+Tu 5is/psDqw5zLNFkjVW0fr8FbgWdmi3c8GbYaN4hTOSlzqzTp6RYEr/XhZbCo8vuN /M06mYYT3thbNm4Az/IeuUHPfD1BidL+D+FFjpcIedoV++FIroNDc2XtwmkJy3T8 zFuB06yrqkxpKbirJHIIlzIHMaBh0W0M+mVrdeARPanYUxefmIyF+I8eIBT6KJCs E3lnbvAiD2CdHJ4z3H+Aqf3C25VLqRK/U0wfFKf94Vi/1RvFtq+FDEodE+sw6JwN YYYn6/SHao7W4n76acEM =geXx -----END PGP SIGNATURE----- --Sig_/oF/v=oaUaeTsb19Ok=W69aH--