summary refs log tree commit diff
path: root/pkgs/games/nethack
diff options
context:
space:
mode:
authorMatthew Bauer <mjbauer95@gmail.com>2016-02-28 21:04:23 -0600
committerMatthew Bauer <mjbauer95@gmail.com>2016-02-28 21:04:23 -0600
commit818f2cd19fcb0d450e2b0847b3dd3598007ba38a (patch)
treef0ed8826707b06095792540980189d91ea72532e /pkgs/games/nethack
parenta133ef9a0c866479d1b420549d4ce633e7b6f337 (diff)
downloadnixpkgs-818f2cd19fcb0d450e2b0847b3dd3598007ba38a.tar
nixpkgs-818f2cd19fcb0d450e2b0847b3dd3598007ba38a.tar.gz
nixpkgs-818f2cd19fcb0d450e2b0847b3dd3598007ba38a.tar.bz2
nixpkgs-818f2cd19fcb0d450e2b0847b3dd3598007ba38a.tar.lz
nixpkgs-818f2cd19fcb0d450e2b0847b3dd3598007ba38a.tar.xz
nixpkgs-818f2cd19fcb0d450e2b0847b3dd3598007ba38a.tar.zst
nixpkgs-818f2cd19fcb0d450e2b0847b3dd3598007ba38a.zip
nethack: fix darwin support
Diffstat (limited to 'pkgs/games/nethack')
-rw-r--r--pkgs/games/nethack/default.nix34
1 files changed, 20 insertions, 14 deletions
diff --git a/pkgs/games/nethack/default.nix b/pkgs/games/nethack/default.nix
index 05c39fb2f2b..ce12196d3c3 100644
--- a/pkgs/games/nethack/default.nix
+++ b/pkgs/games/nethack/default.nix
@@ -6,6 +6,7 @@ let
     else abort "Unknown platform for NetHack";
   unixHint =
     if stdenv.isLinux then "linux"
+    else if stdenv.isDarwin then "macosx10.10"
     # We probably want something different for Darwin
     else "unix";
   userDir = "~/.config/nethack";
@@ -24,25 +25,30 @@ in stdenv.mkDerivation {
 
   makeFlags = [ "PREFIX=$(out)" ];
 
+  patchPhase = ''
+    sed -e '/^ *cd /d' -i sys/unix/nethack.sh
+    sed \
+      -e 's/^YACC *=.*/YACC = bison -y/' \
+      -e 's/^LEX *=.*/LEX = flex/' \
+      -i sys/unix/Makefile.utl
+    sed \
+      -e 's,/bin/gzip,${gzip}/bin/gzip,g' \
+      -e 's,^WINTTYLIB=.*,WINTTYLIB=-lncurses,' \
+      -i sys/unix/hints/linux
+    sed \
+      -e 's,^CC=.*$,CC=cc,' \
+      -e 's,^HACKDIR=.*$,HACKDIR=\$(PREFIX)/games/lib/\$(GAME)dir,' \
+      -e 's,^SHELLDIR=.*$,SHELLDIR=\$(PREFIX)/games,' \
+      -i sys/unix/hints/macosx10.10
+    sed -e '/define CHDIR/d' -i include/config.h
+  '';
+
   configurePhase = ''
     cd sys/${platform}
     ${lib.optionalString (platform == "unix") ''
-      sed -e '/^ *cd /d' -i nethack.sh
-      ${lib.optionalString (unixHint == "linux") ''
-        sed \
-          -e 's,/bin/gzip,${gzip}/bin/gzip,g' \
-          -e 's,^WINTTYLIB=.*,WINTTYLIB=-lncurses,' \
-          -i hints/linux
-      ''}
       sh setup.sh hints/${unixHint}
     ''}
     cd ../..
-
-    sed -e '/define CHDIR/d' -i include/config.h
-    sed \
-      -e 's/^YACC *=.*/YACC = bison -y/' \
-      -e 's/^LEX *=.*/LEX = flex/' \
-      -i util/Makefile
   '';
 
   postInstall = ''
@@ -61,7 +67,7 @@ in stdenv.mkDerivation {
       chmod -R +w ${userDir}
     fi
 
-    RUNDIR=\$(mktemp -td nethack.\$USER.XXXXX)
+    RUNDIR=\$(mktemp -d)
 
     cleanup() {
       rm -rf \$RUNDIR