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