nethack: enable cross-compilation

also parallel building
This commit is contained in:
Linus Heckemann 2018-09-20 19:32:36 +02:00
parent 6af4a8e6d7
commit 86b1f5c710

View file

@ -1,5 +1,6 @@
{ stdenv, lib, fetchurl, coreutils, ncurses, gzip, flex, bison
, less, makeWrapper
, buildPackages
, x11Mode ? false, qtMode ? false, libXaw, libXext, mkfontdir, pkgconfig, qt5
}:
@ -72,6 +73,12 @@ in stdenv.mkDerivation rec {
-DCOMPRESS_EXTENSION=\\".gz\\",' \
-i sys/unix/hints/linux-qt4
''}
${lib.optionalString (stdenv.buildPlatform != stdenv.hostPlatform) ''
${buildPackages.perl}/bin/perl -p \
-e 's,[a-z./]+/(makedefs|dgn_comp|lev_comp|dlb)(?!\.),${buildPackages.nethack}/libexec/nethack/\1,g' \
-i sys/unix/Makefile.*
''}
sed -i -e '/rm -f $(MAKEDEFS)/d' sys/unix/Makefile.src
'';
configurePhase = ''
@ -82,6 +89,8 @@ in stdenv.mkDerivation rec {
popd
'';
enableParallelBuilding = true;
postInstall = ''
mkdir -p $out/games/lib/nethackuserdir
for i in xlogfile logfile perm record save; do
@ -118,6 +127,7 @@ in stdenv.mkDerivation rec {
chmod +x $out/bin/nethack
${lib.optionalString x11Mode "mv $out/bin/nethack $out/bin/nethack-x11"}
${lib.optionalString qtMode "mv $out/bin/nethack $out/bin/nethack-qt"}
install -Dm 555 util/{makedefs,dgn_comp,lev_comp,dlb} -t $out/libexec/nethack/
'';
postFixup = lib.optionalString qtMode ''