From 95d28d524715e0683778a456a864a84c74113f97 Mon Sep 17 00:00:00 2001 From: Michael Raskin <7c6f434c@mail.ru> Date: Tue, 12 May 2009 04:27:10 +0000 Subject: [PATCH] Adding nethack svn path=/nixpkgs/trunk/; revision=15560 --- pkgs/games/nethack/default.nix | 56 ++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 pkgs/games/nethack/default.nix diff --git a/pkgs/games/nethack/default.nix b/pkgs/games/nethack/default.nix new file mode 100644 index 000000000000..6b9c25708f6d --- /dev/null +++ b/pkgs/games/nethack/default.nix @@ -0,0 +1,56 @@ +a : +let + fetchurl = a.fetchurl; + + version = a.lib.getAttr ["version"] "3.4.3" a; + buildInputs = with a; [ + ncurses flex bison + ]; +in +rec { + src = fetchurl { + url = "mirror://sourceforge/nethack/nethack-343-src.tgz"; + sha256 = "1r3ghqj82j0bar62z3b0lx9hhx33pj7p1ppxr2hg8bgfm79c6fdv"; + }; + + inherit buildInputs; + configureFlags = []; + + /* doConfigure should be removed if not needed */ + phaseNames = ["preBuild" "doMakeInstall" "postInstall"]; + + preBuild = a.FullDepEntry ('' + ( cd sys/unix ; sh setup.sh ) + sed -e 's@.*define HACKDIR.*@\#define HACKDIR "/tmp/nethack"@' -i include/config.h + sed -e '/define COMPRESS/d' -i include/config.h + sed -e '1i\#define COMPRESS "/usr/local/bin/gzip"' -i include/config.h + sed -e '1i\#define COMPRESS_EXTENSION ".gz"' -i include/config.h + + sed -e '/extern char [*]tparm/d' -i win/tty/*.c + sed -e 's/-ltermlib/-lncurses/' -i src/Makefile + sed -e 's/^YACC *=.*/YACC = bison -y/' -i util/Makefile + sed -e 's/^LEX *=.*/LEX = flex/' -i util/Makefile + + sed -e 's@GAMEDIR = @GAMEDIR = /tmp/nethack@' -i Makefile + sed -re 's@^(CH...).*@\1 = true@' -i Makefile + '') ["minInit" "doUnpack"]; + + postInstall = a.FullDepEntry ('' + ensureDir $out/bin + ln -s $out/games/nethack $out/bin/nethack + sed -i $out/bin/nethack -e '5aNEWHACKDIR="$HOME/.nethack"' + sed -i $out/bin/nethack -e '6amkdir -p "$NEWHACKDIR/save"' + sed -i $out/bin/nethack -e '7aln -s "$HACKDIR"/* "$NEWHACKDIR" &>/dev/null' + sed -i $out/bin/nethack -e '8atest -L "$NEWHACKDIR/record" && rm "$NEWHACKDIR"/record' + sed -i $out/bin/nethack -e '9aexport HACKDIR="$NEWHACKDIR"' + '') ["minInit" "defEnsureDir"]; + + makeFlags = [ + "PREFIX=$out" + ]; + + name = "nethack-" + version; + meta = { + description = "rogue-like game"; + }; +}