3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/games/dwarf-fortress/dfhack/default.nix

78 lines
2.2 KiB
Nix
Raw Normal View History

2018-06-06 23:07:42 +01:00
{ stdenv, hostPlatform, lib, fetchFromGitHub, cmake, writeScriptBin, callPackage
, perl, XMLLibXML, XMLLibXSLT, zlib
, enableStoneSense ? false, allegro5, libGLU_combined
2018-06-11 00:10:25 +01:00
, SDL
}:
let
dfVersion = "0.44.11";
version = "${dfVersion}-alpha1";
# revision of library/xml submodule
xmlRev = "853bd161270f50b21fe4b751de339458f78f56d6";
arch =
if stdenv.system == "x86_64-linux" then "64"
else if stdenv.system == "i686-linux" then "32"
else throw "Unsupported architecture";
fakegit = writeScriptBin "git" ''
#! ${stdenv.shell}
if [ "$*" = "describe --tags --long" ]; then
echo "${version}-unknown"
elif [ "$*" = "rev-parse HEAD" ]; then
if [ "$(dirname "$(pwd)")" = "xml" ]; then
echo "${xmlRev}"
else
2018-06-06 23:07:42 +01:00
echo "refs/tags/${version}"
fi
elif [ "$*" = "rev-parse HEAD:library/xml" ]; then
echo "${xmlRev}"
else
exit 1
fi
'';
in stdenv.mkDerivation rec {
name = "dfhack-${version}";
# Beware of submodules
2018-06-06 23:07:42 +01:00
src = fetchFromGitHub {
owner = "DFHack";
repo = "dfhack";
sha256 = "1vzrpdw0pn18calayf9dwqpyg37cb7wkzkvskxjx9nak5ilxzywm";
2018-06-06 23:07:42 +01:00
rev = version;
2018-06-11 00:01:18 +01:00
fetchSubmodules = true;
};
nativeBuildInputs = [ cmake perl XMLLibXML XMLLibXSLT fakegit ];
# We don't use system libraries because dfhack needs old C++ ABI.
2018-06-11 00:10:25 +01:00
buildInputs = [ zlib SDL ]
++ lib.optionals enableStoneSense [ allegro5 libGLU_combined ];
preConfigure = ''
# Trick build system into believing we have .git
mkdir -p .git/modules/library/xml
touch .git/index .git/modules/library/xml/index
'';
preBuild = ''
export LD_LIBRARY_PATH="$PWD/depends/protobuf:$LD_LIBRARY_PATH"
'';
cmakeFlags = [ "-DDFHACK_BUILD_ARCH=${arch}" "-DDOWNLOAD_RUBY=OFF" ]
++ lib.optionals enableStoneSense [ "-DBUILD_STONESENSE=ON" "-DSTONESENSE_INTERNAL_SO=OFF" ];
enableParallelBuilding = true;
passthru = { inherit version dfVersion; };
meta = with stdenv.lib; {
description = "Memory hacking library for Dwarf Fortress and a set of tools that use it";
homepage = https://github.com/DFHack/dfhack/;
license = licenses.zlib;
platforms = [ "x86_64-linux" "i686-linux" ];
maintainers = with maintainers; [ robbinch a1russell abbradar numinit ];
};
}