xsokoban: reimplement using mkDerivation

This commit is contained in:
Joachim Fasting 2015-05-01 16:56:53 +02:00
parent 048f00a9dc
commit 241515a6b7
2 changed files with 33 additions and 36 deletions

View File

@ -1,51 +1,46 @@
a @ {libX11, xproto, libXpm, libXt, ...} : { stdenv, fetchurl, libX11, xproto, libXpm, libXt }:
let
fetchurl = a.fetchurl; stdenv.mkDerivation rec {
name = "xsokoban-${version}";
version = "3.3c";
version = a.lib.attrByPath ["version"] "3.3c" a;
buildInputs = with a; [
a.libX11 a.xproto a.libXpm a.libXt
];
in
rec {
src = fetchurl { src = fetchurl {
url = "http://www.cs.cornell.edu/andru/release/xsokoban-${version}.tar.gz"; url = "http://www.cs.cornell.edu/andru/release/${name}.tar.gz";
sha256 = "006lp8y22b9pi81x1a9ldfgkl1fbmkdzfw0lqw5y9svmisbafbr9"; sha256 = "006lp8y22b9pi81x1a9ldfgkl1fbmkdzfw0lqw5y9svmisbafbr9";
}; };
inherit buildInputs; buildInputs = [ libX11 xproto libXpm libXt ];
configureFlags = [];
/* doConfigure should be removed if not needed */ preConfigure = ''
phaseNames = ["preConfigure" "doConfigure" "preBuild" "doMakeInstall"];
preConfigure = a.fullDepEntry (''
sed -e 's/getline/my_getline/' -i score.c sed -e 's/getline/my_getline/' -i score.c
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${a.libXpm}/include/X11" export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${libXpm}/include/X11"
for i in $NIX_CFLAGS_COMPILE; do echo $i; ls ''${i#-I}; done for i in $NIX_CFLAGS_COMPILE; do echo $i; ls ''${i#-I}; done
chmod a+rw config.h chmod a+rw config.h
echo '#define HERE "@nixos-packaged"' >> config.h cat >>config.h <<EOF
echo '#define WWW 0' >> config.h #define HERE "@nixos-packaged"
echo '#define OWNER "'$(whoami)'"' >> config.h #define WWW 0
echo '#define ROOTDIR "'$out/lib/xsokoban'"' >> config.h #define OWNER "'$(whoami)'"
echo '#define ANYLEVEL 1' >> config.h #define ROOTDIR "'$out/lib/xsokoban'"
echo '#define SCOREFILE ".xsokoban-score"' >> config.h #define ANYLEVEL 1
echo '#define LOCKFILE ".xsokoban-score-lock"' >> config.h #define SCOREFILE ".xsokoban-score"
#define LOCKFILE ".xsokoban-score-lock"
EOF
sed -e 's/getpass[(][^)]*[)]/PASSWORD/' -i main.c sed -i main.c \
sed -e '/if [(]owner[)]/iowner=1;' -i main.c -e 's/getpass[(][^)]*[)]/PASSWORD/' \
'') ["minInit" "doUnpack"]; -e '/if [(]owner[)]/iowner=1;'
'';
preBuild = a.fullDepEntry ('' preBuild = ''
sed -e "s@/usr/local/@$out/@" -i Makefile sed -i Makefile \
sed -e "s@ /bin/@ @" -i Makefile -e "s@/usr/local/@$out/@" \
-e "s@ /bin/@ @"
mkdir -p $out/bin $out/share $out/man/man1 $out/lib mkdir -p $out/bin $out/share $out/man/man1 $out/lib
'') ["minInit" "doConfigure" "defEnsureDir"]; '';
name = "xsokoban-" + version; meta = with stdenv.lib; {
meta = {
description = "X sokoban"; description = "X sokoban";
license = a.stdenv.lib.licenses.publicDomain; license = licenses.publicDomain;
maintainers = [ a.stdenv.lib.maintainers.raskin ]; maintainers = [ maintainers.raskin ];
}; };
} }

View File

@ -14288,7 +14288,9 @@ let
xsnow = callPackage ../games/xsnow { }; xsnow = callPackage ../games/xsnow { };
xsokoban = builderDefsPackage (callPackage ../games/xsokoban) {}; xsokoban = callPackage ../games/xsokoban {
inherit (xlibs) libX11 xproto libXpm libXt;
};
zandronum = callPackage ../games/zandronum { }; zandronum = callPackage ../games/zandronum { };
zandronum-server = callPackage ../games/zandronum/server.nix { }; zandronum-server = callPackage ../games/zandronum/server.nix { };