2015-05-01 15:56:53 +01:00
|
|
|
{ stdenv, fetchurl, libX11, xproto, libXpm, libXt }:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
name = "xsokoban-${version}";
|
|
|
|
version = "3.3c";
|
2009-01-11 22:05:19 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2015-05-01 15:56:53 +01:00
|
|
|
url = "http://www.cs.cornell.edu/andru/release/${name}.tar.gz";
|
2009-01-11 22:05:19 +00:00
|
|
|
sha256 = "006lp8y22b9pi81x1a9ldfgkl1fbmkdzfw0lqw5y9svmisbafbr9";
|
|
|
|
};
|
|
|
|
|
2015-05-01 15:56:53 +01:00
|
|
|
buildInputs = [ libX11 xproto libXpm libXt ];
|
2009-01-11 22:05:19 +00:00
|
|
|
|
2016-12-04 23:59:43 +00:00
|
|
|
NIX_CFLAGS_COMPILE = "-I${libXpm.dev}/include/X11";
|
|
|
|
|
|
|
|
hardeningDisable = [ "format" ];
|
|
|
|
|
2015-05-01 15:56:53 +01:00
|
|
|
preConfigure = ''
|
2012-11-26 14:24:21 +00:00
|
|
|
sed -e 's/getline/my_getline/' -i score.c
|
2016-12-04 23:59:43 +00:00
|
|
|
|
2009-01-11 22:05:19 +00:00
|
|
|
chmod a+rw config.h
|
2015-05-01 15:56:53 +01:00
|
|
|
cat >>config.h <<EOF
|
|
|
|
#define HERE "@nixos-packaged"
|
|
|
|
#define WWW 0
|
|
|
|
#define OWNER "'$(whoami)'"
|
2016-12-04 23:59:43 +00:00
|
|
|
#define ROOTDIR "$out/lib/xsokoban"
|
2015-05-01 15:56:53 +01:00
|
|
|
#define ANYLEVEL 1
|
|
|
|
#define SCOREFILE ".xsokoban-score"
|
|
|
|
#define LOCKFILE ".xsokoban-score-lock"
|
|
|
|
EOF
|
2009-01-11 22:05:19 +00:00
|
|
|
|
2015-05-01 15:56:53 +01:00
|
|
|
sed -i main.c \
|
|
|
|
-e 's/getpass[(][^)]*[)]/PASSWORD/' \
|
|
|
|
-e '/if [(]owner[)]/iowner=1;'
|
|
|
|
'';
|
2014-11-05 09:49:37 +00:00
|
|
|
|
2015-05-01 15:56:53 +01:00
|
|
|
preBuild = ''
|
|
|
|
sed -i Makefile \
|
|
|
|
-e "s@/usr/local/@$out/@" \
|
|
|
|
-e "s@ /bin/@ @"
|
2012-01-18 20:16:00 +00:00
|
|
|
mkdir -p $out/bin $out/share $out/man/man1 $out/lib
|
2015-05-01 15:56:53 +01:00
|
|
|
'';
|
2009-01-11 22:05:19 +00:00
|
|
|
|
2015-05-01 15:56:53 +01:00
|
|
|
meta = with stdenv.lib; {
|
2009-01-11 22:05:19 +00:00
|
|
|
description = "X sokoban";
|
2015-05-01 15:56:53 +01:00
|
|
|
license = licenses.publicDomain;
|
|
|
|
maintainers = [ maintainers.raskin ];
|
2016-12-04 23:59:43 +00:00
|
|
|
platforms = platforms.linux;
|
2009-01-11 22:05:19 +00:00
|
|
|
};
|
|
|
|
}
|