dwarf-fortress: Init TWBT at 6.46

This commit is contained in:
Svein Ove Aas 2018-07-05 16:36:27 +01:00
parent 1bb95d8409
commit 5012ce727a
4 changed files with 83 additions and 31 deletions

View File

@ -31,6 +31,8 @@ let
legends-browser = callPackage ./legends-browser {};
twbt = callPackage ./twbt {};
themes = callPackage ./themes {
stdenv = stdenvNoCC;
};

View File

@ -1,6 +1,7 @@
{ stdenv, hostPlatform, lib, fetchFromGitHub, cmake, writeScriptBin, callPackage
{ stdenv, buildEnv, hostPlatform, lib, fetchurl, fetchFromGitHub, cmake, writeScriptBin, callPackage
, perl, XMLLibXML, XMLLibXSLT, zlib
, enableStoneSense ? false, allegro5, libGLU_combined
, enableTWBT ? true, twbt
, SDL
}:
@ -33,40 +34,47 @@ let
fi
'';
in stdenv.mkDerivation rec {
dfhack = stdenv.mkDerivation rec {
name = "dfhack-base-${version}";
# Beware of submodules
src = fetchFromGitHub {
owner = "DFHack";
repo = "dfhack";
sha256 = "1vzrpdw0pn18calayf9dwqpyg37cb7wkzkvskxjx9nak5ilxzywm";
rev = version;
fetchSubmodules = true;
};
nativeBuildInputs = [ cmake perl XMLLibXML XMLLibXSLT fakegit ];
# We don't use system libraries because dfhack needs old C++ ABI.
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;
};
in
buildEnv {
name = "dfhack-${version}";
# Beware of submodules
src = fetchFromGitHub {
owner = "DFHack";
repo = "dfhack";
sha256 = "1vzrpdw0pn18calayf9dwqpyg37cb7wkzkvskxjx9nak5ilxzywm";
rev = version;
fetchSubmodules = true;
};
nativeBuildInputs = [ cmake perl XMLLibXML XMLLibXSLT fakegit ];
# We don't use system libraries because dfhack needs old C++ ABI.
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; };
paths = [ dfhack ] ++ lib.optionals enableTWBT [ twbt.lib ];
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/;

View File

@ -0,0 +1,35 @@
{ stdenvNoCC, fetchurl, unzip }:
stdenvNoCC.mkDerivation rec {
name = "twbt-${version}";
version = "6.46";
dfVersion = "0.44.10";
src = fetchurl {
url = "https://github.com/mifki/df-twbt/releases/download/v${version}/twbt-${version}-linux.zip";
sha256 = "1a4k26z5n547k5j3ij2kx834963rc8vwgwcmbmzmhi893bryb1k6";
};
sourceRoot = ".";
outputs = [ "lib" "art" "out" ];
buildInputs = [ unzip ];
installPhase = ''
mkdir -p $lib/hack/{plugins,lua} $art/data/art
cp -a */twbt.plug.so $lib/hack/plugins/
cp -a *.lua $lib/hack/lua/
cp -a *.png $art/data/art/
'';
meta = with stdenvNoCC.lib; {
description = "A plugin for Dwarf Fortress / DFHack that improves various aspects the game interface.";
maintainers = with maintainers; [ Baughn ];
license = licenses.mit;
platforms = platforms.linux;
homepage = https://github.com/mifki/df-twbt;
};
}

View File

@ -2,6 +2,7 @@
, enableDFHack ? false, dfhack
, enableSoundSense ? false, soundSense, jdk
, enableStoneSense ? false
, enableTWBT ? false, twbt
, themes ? {}
, theme ? null
}:
@ -9,6 +10,7 @@
let
dfhack_ = dfhack.override {
inherit enableStoneSense;
inherit enableTWBT;
};
ptheme =
@ -16,10 +18,15 @@ let
then builtins.getAttr theme themes
else theme;
twbtOnlyWithDFHack = assert (enableDFHack || !enableTWBT); true;
unBool = b: if b then "YES" else "NO";
# These are in inverse order for first packages to override the next ones.
themePkg = lib.optional (theme != null) ptheme;
pkgs = lib.optional enableDFHack dfhack_
++ lib.optional enableSoundSense soundSense
++ lib.optional enableTWBT twbt.art
++ [ dwarf-fortress-original ];
env = buildEnv {