2017-10-01 21:26:51 +02:00
|
|
|
{ stdenv, lib, fetchgit, cmake, writeScriptBin, callPackage
|
|
|
|
, perl, XMLLibXML, XMLLibXSLT, zlib
|
2018-02-24 14:12:44 +01:00
|
|
|
, enableStoneSense ? false, allegro5, libGLU_combined
|
2016-01-12 18:56:59 +01:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2018-04-12 23:36:29 +02:00
|
|
|
dfVersion = "0.44.09";
|
|
|
|
version = "${dfVersion}-r1";
|
2017-01-29 18:05:10 +01:00
|
|
|
rev = "refs/tags/${version}";
|
2018-03-12 16:43:51 +01:00
|
|
|
sha256 = "1cwifdhi48a976xc472nf6q2k0ibwqffil5a4llcymcxdbgxdcc9";
|
2016-08-13 02:12:20 +02:00
|
|
|
|
2016-04-30 02:02:26 +02:00
|
|
|
# revision of library/xml submodule
|
2018-04-12 23:36:29 +02:00
|
|
|
xmlRev = "3c0bf63674d5430deadaf7befaec42f0ec1e8bc5";
|
2016-01-12 18:56:59 +01:00
|
|
|
|
2016-11-24 00:51:51 +01: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 18:56:59 +01:00
|
|
|
fakegit = writeScriptBin "git" ''
|
|
|
|
#! ${stdenv.shell}
|
|
|
|
if [ "$*" = "describe --tags --long" ]; then
|
2016-08-13 02:12:20 +02:00
|
|
|
echo "${version}-unknown"
|
2016-01-12 18:56:59 +01:00
|
|
|
elif [ "$*" = "rev-parse HEAD" ]; then
|
2016-03-03 13:33:13 +01:00
|
|
|
if [ "$(dirname "$(pwd)")" = "xml" ]; then
|
|
|
|
echo "${xmlRev}"
|
|
|
|
else
|
|
|
|
echo "${rev}"
|
|
|
|
fi
|
|
|
|
elif [ "$*" = "rev-parse HEAD:library/xml" ]; then
|
|
|
|
echo "${xmlRev}"
|
2016-01-12 18:56:59 +01:00
|
|
|
else
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
'';
|
|
|
|
|
2016-03-03 13:33:13 +01:00
|
|
|
in stdenv.mkDerivation rec {
|
|
|
|
name = "dfhack-${version}";
|
2016-01-12 18:56:59 +01:00
|
|
|
|
|
|
|
# Beware of submodules
|
|
|
|
src = fetchgit {
|
|
|
|
url = "https://github.com/DFHack/dfhack";
|
2016-11-23 16:04:57 +01:00
|
|
|
inherit rev sha256;
|
2016-01-12 18:56:59 +01:00
|
|
|
};
|
|
|
|
|
2017-10-01 21:26:51 +02:00
|
|
|
patches = [ ./fix-stonesense.patch ];
|
2016-01-12 18:56:59 +01:00
|
|
|
|
|
|
|
nativeBuildInputs = [ cmake perl XMLLibXML XMLLibXSLT fakegit ];
|
2016-11-24 00:51:51 +01:00
|
|
|
# We don't use system libraries because dfhack needs old C++ ABI.
|
2017-10-01 21:26:51 +02:00
|
|
|
buildInputs = [ zlib ]
|
2018-02-24 14:12:44 +01:00
|
|
|
++ lib.optionals enableStoneSense [ allegro5 libGLU_combined ];
|
2016-11-24 00:51:51 +01:00
|
|
|
|
2017-07-27 14:54:23 +02: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-24 00:51:51 +01:00
|
|
|
preBuild = ''
|
|
|
|
export LD_LIBRARY_PATH="$PWD/depends/protobuf:$LD_LIBRARY_PATH"
|
|
|
|
'';
|
2016-01-12 18:56:59 +01:00
|
|
|
|
2017-10-01 21:26:51 +02:00
|
|
|
cmakeFlags = [ "-DDFHACK_BUILD_ARCH=${arch}" "-DDOWNLOAD_RUBY=OFF" ]
|
|
|
|
++ lib.optionals enableStoneSense [ "-DBUILD_STONESENSE=ON" "-DSTONESENSE_INTERNAL_SO=OFF" ];
|
2016-08-13 02:12:20 +02:00
|
|
|
|
2016-01-12 18:56:59 +01:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2016-08-13 02:12:20 +02:00
|
|
|
passthru = { inherit version dfVersion; };
|
2016-01-12 18:56:59 +01:00
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
description = "Memory hacking library for Dwarf Fortress and a set of tools that use it";
|
2017-08-01 22:03:30 +02:00
|
|
|
homepage = https://github.com/DFHack/dfhack/;
|
2016-01-12 18:56:59 +01:00
|
|
|
license = licenses.zlib;
|
2016-11-24 00:51:51 +01:00
|
|
|
platforms = [ "x86_64-linux" "i686-linux" ];
|
2016-01-12 18:56:59 +01:00
|
|
|
maintainers = with maintainers; [ robbinch a1russell abbradar ];
|
|
|
|
};
|
|
|
|
}
|