nixpkgs-suyu/pkgs/games/xsokoban/default.nix
Silvan Mosberger 57bccb3cb8 treewide: http -> https sources (#42676)
* treewide: http -> https sources

This updates the source urls of all top-level packages from http to
https where possible.

* buildtorrent: fix url and tab -> spaces
2018-06-28 20:43:35 +02:00

54 lines
1.3 KiB
Nix

{ stdenv, fetchurl, libX11, xproto, libXpm, libXt }:
stdenv.mkDerivation rec {
name = "xsokoban-${version}";
version = "3.3c";
src = fetchurl {
url = "https://www.cs.cornell.edu/andru/release/${name}.tar.gz";
sha256 = "006lp8y22b9pi81x1a9ldfgkl1fbmkdzfw0lqw5y9svmisbafbr9";
};
buildInputs = [ libX11 xproto libXpm libXt ];
NIX_CFLAGS_COMPILE = "-I${libXpm.dev}/include/X11";
hardeningDisable = [ "format" ];
prePatch = ''
substituteInPlace Makefile.in --replace 4755 0755
'';
preConfigure = ''
sed -e 's/getline/my_getline/' -i score.c
chmod a+rw config.h
cat >>config.h <<EOF
#define HERE "@nixos-packaged"
#define WWW 0
#define OWNER "$(whoami)"
#define ROOTDIR "$out/lib/xsokoban"
#define ANYLEVEL 1
#define SCOREFILE ".xsokoban-score"
#define LOCKFILE ".xsokoban-score-lock"
EOF
sed -i main.c \
-e 's/getpass[(][^)]*[)]/PASSWORD/' \
-e '/if [(]owner[)]/iowner=1;'
'';
preBuild = ''
sed -i Makefile \
-e "s@/usr/local/@$out/@" \
-e "s@ /bin/@ @"
mkdir -p $out/bin $out/share $out/man/man1 $out/lib
'';
meta = with stdenv.lib; {
description = "X sokoban";
license = licenses.publicDomain;
maintainers = [ maintainers.raskin ];
platforms = platforms.linux;
};
}