2016-01-12 17:56:59 +00:00
|
|
|
{ stdenv, fetchgit, cmake, writeScriptBin
|
|
|
|
, perl, XMLLibXML, XMLLibXSLT
|
|
|
|
, zlib
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2016-11-23 15:04:57 +00:00
|
|
|
dfVersion = "0.43.05";
|
2017-07-27 13:54:23 +01:00
|
|
|
version = "${dfVersion}-r2";
|
2017-01-29 17:05:10 +00:00
|
|
|
rev = "refs/tags/${version}";
|
2017-07-27 13:54:23 +01:00
|
|
|
sha256 = "18zbxri5rch750m431pdmlk4xi7nc14iif3i7glxrgy2h5nfaw5c";
|
2016-08-13 01:12:20 +01:00
|
|
|
|
2016-04-30 01:02:26 +01:00
|
|
|
# revision of library/xml submodule
|
2017-07-27 13:54:23 +01:00
|
|
|
xmlRev = "3322beb2e7f4b28ff8e573e9bec738c77026b8e9";
|
2016-01-12 17:56:59 +00:00
|
|
|
|
2016-11-23 23:51:51 +00:00
|
|
|
arch =
|
|
|
|
if stdenv.system == "x86_64-linux" then "64"
|
|
|
|
else if stdenv.system == "i686-linux" then "32"
|
|
|
|
else throw "Unsupported architecture";
|
|
|
|
|
2016-01-12 17:56:59 +00:00
|
|
|
fakegit = writeScriptBin "git" ''
|
|
|
|
#! ${stdenv.shell}
|
|
|
|
if [ "$*" = "describe --tags --long" ]; then
|
2016-08-13 01:12:20 +01:00
|
|
|
echo "${version}-unknown"
|
2016-01-12 17:56:59 +00:00
|
|
|
elif [ "$*" = "rev-parse HEAD" ]; then
|
2016-03-03 12:33:13 +00:00
|
|
|
if [ "$(dirname "$(pwd)")" = "xml" ]; then
|
|
|
|
echo "${xmlRev}"
|
|
|
|
else
|
|
|
|
echo "${rev}"
|
|
|
|
fi
|
|
|
|
elif [ "$*" = "rev-parse HEAD:library/xml" ]; then
|
|
|
|
echo "${xmlRev}"
|
2016-01-12 17:56:59 +00:00
|
|
|
else
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
'';
|
|
|
|
|
2016-03-03 12:33:13 +00:00
|
|
|
in stdenv.mkDerivation rec {
|
|
|
|
name = "dfhack-${version}";
|
2016-01-12 17:56:59 +00:00
|
|
|
|
|
|
|
# Beware of submodules
|
|
|
|
src = fetchgit {
|
|
|
|
url = "https://github.com/DFHack/dfhack";
|
2016-11-23 15:04:57 +00:00
|
|
|
inherit rev sha256;
|
2016-01-12 17:56:59 +00:00
|
|
|
};
|
|
|
|
|
2016-11-23 23:51:51 +00:00
|
|
|
patches = [ ./skip-ruby.patch ];
|
2016-01-12 17:56:59 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = [ cmake perl XMLLibXML XMLLibXSLT fakegit ];
|
2016-11-23 23:51:51 +00:00
|
|
|
# We don't use system libraries because dfhack needs old C++ ABI.
|
|
|
|
buildInputs = [ zlib ];
|
|
|
|
|
2017-07-27 13:54:23 +01:00
|
|
|
preConfigure = ''
|
|
|
|
# Trick build system into believing we have .git
|
|
|
|
mkdir -p .git/modules/library/xml
|
|
|
|
touch .git/index .git/modules/library/xml/index
|
|
|
|
'';
|
|
|
|
|
2016-11-23 23:51:51 +00:00
|
|
|
preBuild = ''
|
|
|
|
export LD_LIBRARY_PATH="$PWD/depends/protobuf:$LD_LIBRARY_PATH"
|
|
|
|
'';
|
2016-01-12 17:56:59 +00:00
|
|
|
|
2016-11-23 23:51:51 +00:00
|
|
|
cmakeFlags = [ "-DDFHACK_BUILD_ARCH=${arch}" ];
|
2016-08-13 01:12:20 +01:00
|
|
|
|
2016-01-12 17:56:59 +00:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2016-08-13 01:12:20 +01:00
|
|
|
passthru = { inherit version dfVersion; };
|
2016-01-12 17:56:59 +00:00
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
description = "Memory hacking library for Dwarf Fortress and a set of tools that use it";
|
2016-04-30 00:58:00 +01:00
|
|
|
homepage = "https://github.com/DFHack/dfhack/";
|
2016-01-12 17:56:59 +00:00
|
|
|
license = licenses.zlib;
|
2016-11-23 23:51:51 +00:00
|
|
|
platforms = [ "x86_64-linux" "i686-linux" ];
|
2016-01-12 17:56:59 +00:00
|
|
|
maintainers = with maintainers; [ robbinch a1russell abbradar ];
|
|
|
|
};
|
|
|
|
}
|