3
0
Fork 0
forked from mirrors/nixpkgs

nethack: update, adopt

This commit is contained in:
Nikolay Amiantov 2015-06-29 14:19:12 +03:00
parent 99750d89dd
commit 6e049800ed
2 changed files with 53 additions and 37 deletions
pkgs
games/nethack
top-level

View file

@ -1,57 +1,75 @@
a : { stdenv, fetchurl, writeScript, ncurses, gzip, flex, bison }:
let
fetchurl = a.fetchurl; stdenv.mkDerivation rec {
name = "nethack-3.4.3";
version = a.lib.attrByPath ["version"] "3.4.3" a;
buildInputs = with a; [
ncurses flex bison
];
in
rec {
src = fetchurl { src = fetchurl {
url = "mirror://sourceforge/nethack/nethack-343-src.tgz"; url = "mirror://sourceforge/nethack/nethack-343-src.tgz";
sha256 = "1r3ghqj82j0bar62z3b0lx9hhx33pj7p1ppxr2hg8bgfm79c6fdv"; sha256 = "1r3ghqj82j0bar62z3b0lx9hhx33pj7p1ppxr2hg8bgfm79c6fdv";
}; };
inherit buildInputs; buildInputs = [ ncurses ];
configureFlags = [];
/* doConfigure should be removed if not needed */ nativeBuildInputs = [ flex bison ];
phaseNames = ["preBuild" "doMakeInstall" "postInstall"];
preBuild = ''
preBuild = a.fullDepEntry (''
( cd sys/unix ; sh setup.sh ) ( 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 '/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 "${gzip}/bin/gzip"' -i include/config.h
sed -e '1i\#define COMPRESS_EXTENSION ".gz"' -i include/config.h sed -e '1i\#define COMPRESS_EXTENSION ".gz"' -i include/config.h
sed -e '/define CHDIR/d' -i include/config.h
sed -e '/extern char [*]tparm/d' -i win/tty/*.c sed -e '/extern char [*]tparm/d' -i win/tty/*.c
sed -e 's/-ltermlib/-lncurses/' -i src/Makefile sed -e 's/-ltermlib/-lncurses/' -i src/Makefile
sed -e 's/^YACC *=.*/YACC = bison -y/' -i util/Makefile sed -e 's/^YACC *=.*/YACC = bison -y/' -i util/Makefile
sed -e 's/^LEX *=.*/LEX = flex/' -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 sed -re 's@^(CH...).*@\1 = true@' -i Makefile
'') ["minInit" "doUnpack"];
postInstall = a.fullDepEntry ('' sed -e '/^ *cd /d' -i sys/unix/nethack.sh
'';
postInstall = ''
for i in logfile perm record save; do
rm -rf $out/games/lib/nethackdir/$i
done
mkdir -p $out/bin mkdir -p $out/bin
ln -s $out/games/nethack $out/bin/nethack cat <<EOF >$out/bin/nethack
sed -i $out/bin/nethack -e '5aNEWHACKDIR="$HOME/.nethack"' #! ${stdenv.shell} -e
sed -i $out/bin/nethack -e '6amkdir -p "$NEWHACKDIR/save"' if [ ! -d ~/.nethack ]; then
sed -i $out/bin/nethack -e '7afor i in $(find "$NEWHACKDIR" -type l); do if ! test -e $(readlink "$i"); then rm "$i"; fi; done;' mkdir -p ~/.nethack/save
sed -i $out/bin/nethack -e '8aln -s "$HACKDIR"/* "$NEWHACKDIR" &>/dev/null' for i in logfile perm record; do
sed -i $out/bin/nethack -e '9atest -L "$NEWHACKDIR/record" && rm "$NEWHACKDIR"/record' [ ! -e ~/.nethack/\$i ] && touch ~/.nethack/\$i
sed -i $out/bin/nethack -e '10aexport HACKDIR="$NEWHACKDIR"' done
'') ["minInit" "defEnsureDir"]; fi
makeFlags = [ cd ~/.nethack
"PREFIX=$out"
];
name = "nethack-" + version; cleanup() {
meta = { for i in $out/games/lib/nethackdir/*; do
description = "rogue-like game"; rm -rf \$(basename \$i)
done
}
trap cleanup EXIT
for i in $out/games/lib/nethackdir/*; do
ln -s \$i \$(basename \$i)
done
$out/games/nethack
EOF
chmod +x $out/bin/nethack
'';
makeFlags = [ "PREFIX=$(out)" ];
meta = with stdenv.lib; {
description = "Rogue-like game";
homepage = "http://nethack.org/";
license = "nethack";
platforms = platforms.unix;
maintainers = with maintainers; [ abbradar ];
}; };
} }

View file

@ -7624,9 +7624,7 @@ let
sslSupport = true; sslSupport = true;
}; };
nethack = builderDefsPackage (import ../games/nethack) { nethack = callPackage ../games/nethack { };
inherit ncurses flex bison;
};
nettle27 = callPackage ../development/libraries/nettle/27.nix { }; nettle27 = callPackage ../development/libraries/nettle/27.nix { };
nettle = callPackage ../development/libraries/nettle { }; nettle = callPackage ../development/libraries/nettle { };