2017-10-01 21:26:51 +02:00
|
|
|
{ stdenv, lib, fetchgit, cmake, writeScriptBin, callPackage
|
|
|
|
, perl, XMLLibXML, XMLLibXSLT, zlib
|
|
|
|
, enableStoneSense ? false, allegro5, mesa
|
2016-01-12 18:56:59 +01:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2018-01-18 19:53:42 +01:00
|
|
|
dfVersion = "0.44.05";
|
|
|
|
version = "${dfVersion}-alpha1";
|
2017-01-29 18:05:10 +01:00
|
|
|
rev = "refs/tags/${version}";
|
2018-01-18 19:53:42 +01:00
|
|
|
sha256 = "1hr3qsx7rd36syw7dfp4lh8kpmz1pvva757za2yn34hj1jm4nh52";
|
2016-08-13 02:12:20 +02:00
|
|
|
|
2016-04-30 02:02:26 +02:00
|
|
|
# revision of library/xml submodule
|
2018-01-18 19:53:42 +01:00
|
|
|
xmlRev = "3a9f401d196ee8ebc53edb9e15a13bfcb0879b4e";
|
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 ]
|
|
|
|
++ lib.optionals enableStoneSense [ allegro5 mesa ];
|
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 ];
|
|
|
|
};
|
|
|
|
}
|