2021-01-11 07:54:33 +00:00
|
|
|
{ lib, stdenv, fetchurl, libX11, xorgproto, libXpm, libXt }:
|
2015-05-01 15:56:53 +01:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 13:41:18 +01:00
|
|
|
pname = "xsokoban";
|
2015-05-01 15:56:53 +01:00
|
|
|
version = "3.3c";
|
2009-01-11 22:05:19 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2019-08-15 13:41:18 +01:00
|
|
|
url = "https://www.cs.cornell.edu/andru/release/${pname}-${version}.tar.gz";
|
2009-01-11 22:05:19 +00:00
|
|
|
sha256 = "006lp8y22b9pi81x1a9ldfgkl1fbmkdzfw0lqw5y9svmisbafbr9";
|
|
|
|
};
|
|
|
|
|
2018-12-31 03:40:47 +00:00
|
|
|
buildInputs = [ libX11 xorgproto 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" ];
|
|
|
|
|
2017-06-16 13:18:20 +01:00
|
|
|
prePatch = ''
|
|
|
|
substituteInPlace Makefile.in --replace 4755 0755
|
|
|
|
'';
|
|
|
|
|
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
|
2017-06-16 16:41:33 +01:00
|
|
|
#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
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with 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
|
|
|
};
|
|
|
|
}
|