dwarf-fortress-packages.dfhack: add stoneSense support

This commit is contained in:
Herwig Hochleitner 2017-10-01 21:26:51 +02:00
parent 24ea093806
commit 85056ee698
7 changed files with 55 additions and 19 deletions

View File

@ -12,6 +12,7 @@ let
};
soundSense = callPackage ./soundsense.nix { };
stoneSense = callPackage ./stonesense.nix { };
dwarf-fortress-unfuck = callPackage ./unfuck.nix { };

View File

@ -1,6 +1,6 @@
{ stdenv, fetchgit, cmake, writeScriptBin
, perl, XMLLibXML, XMLLibXSLT
, zlib
{ stdenv, lib, fetchgit, cmake, writeScriptBin, callPackage
, perl, XMLLibXML, XMLLibXSLT, zlib
, enableStoneSense ? false, allegro5, mesa
}:
let
@ -43,11 +43,12 @@ in stdenv.mkDerivation rec {
inherit rev sha256;
};
patches = [ ./skip-ruby.patch ];
patches = [ ./fix-stonesense.patch ];
nativeBuildInputs = [ cmake perl XMLLibXML XMLLibXSLT fakegit ];
# We don't use system libraries because dfhack needs old C++ ABI.
buildInputs = [ zlib ];
buildInputs = [ zlib ]
++ lib.optionals enableStoneSense [ allegro5 mesa ];
preConfigure = ''
# Trick build system into believing we have .git
@ -59,7 +60,8 @@ in stdenv.mkDerivation rec {
export LD_LIBRARY_PATH="$PWD/depends/protobuf:$LD_LIBRARY_PATH"
'';
cmakeFlags = [ "-DDFHACK_BUILD_ARCH=${arch}" ];
cmakeFlags = [ "-DDFHACK_BUILD_ARCH=${arch}" "-DDOWNLOAD_RUBY=OFF" ]
++ lib.optionals enableStoneSense [ "-DBUILD_STONESENSE=ON" "-DSTONESENSE_INTERNAL_SO=OFF" ];
enableParallelBuilding = true;

View File

@ -0,0 +1,23 @@
From f5be6fe5fb192f01ae4551ed9217e97fd7f6a0ae Mon Sep 17 00:00:00 2001
From: Herwig Hochleitner <hhochleitner@gmail.com>
Date: Sun, 1 Oct 2017 18:01:43 +0200
Subject: [PATCH] include <GL/glext.h>
this fixes `GLhandleARB` not being defined
---
plugins/stonesense/common.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/plugins/stonesense/common.h b/plugins/stonesense/common.h
index eb36691..ef45389 100644
--- a/plugins/stonesense/common.h
+++ b/plugins/stonesense/common.h
@@ -31,6 +31,8 @@ using namespace df::enums;
#include <allegro5/allegro_opengl.h>
#include <allegro5/utf8.h>
+#include <GL/glext.h>
+
// allegro leaks X headers, undef some of it here:
#undef TileShape
#undef None

View File

@ -1,10 +0,0 @@
diff --git a/plugins/ruby/CMakeLists.txt b/plugins/ruby/CMakeLists.txt
index f1ef12ac..0976e18a 100644
--- a/plugins/ruby/CMakeLists.txt
+++ b/plugins/ruby/CMakeLists.txt
@@ -1,5 +1,5 @@
# Allow build system to turn off downloading of libruby.so.
-OPTION(DOWNLOAD_RUBY "Download prebuilt libruby.so for ruby plugin." ON)
+OPTION(DOWNLOAD_RUBY "Download prebuilt libruby.so for ruby plugin." OFF)
IF (DOWNLOAD_RUBY)

View File

@ -0,0 +1,15 @@
{ stdenv, fetchFromGitHub, cmake }:
stdenv.mkDerivation rec {
name = "stonesense";
src = fetchFromGitHub {
owner = "DFHack";
repo = "stonesense";
rev = "be793a080e66db1ff79ac284070632ec1a896708";
sha256 = "1kibqblxp16z75zm48kk59w483933rkg4w339f28fcrbpg4sn92s";
};
nativeBuildInputs = [ cmake ];
cmakeFlags = [ "-DDFHACK_BUILD_ARCH=64" ];
}

View File

@ -1,11 +1,16 @@
{ stdenv, lib, buildEnv, dwarf-fortress-original, substituteAll
, enableDFHack ? false, dfhack
, enableSoundSense ? false, soundSense, jdk
, enableStoneSense ? false
, themes ? {}
, theme ? null
}:
let
dfhack_ = dfhack.override {
inherit enableStoneSense;
};
ptheme =
if builtins.isString theme
then builtins.getAttr theme themes
@ -13,7 +18,7 @@ let
# These are in inverse order for first packages to override the next ones.
pkgs = lib.optional (theme != null) ptheme
++ lib.optional enableDFHack dfhack
++ lib.optional enableDFHack dfhack_
++ lib.optional enableSoundSense soundSense
++ [ dwarf-fortress-original ];
@ -26,7 +31,7 @@ let
postBuild = lib.optionalString enableDFHack ''
rm $out/hack/symbols.xml
substitute ${dfhack}/hack/symbols.xml $out/hack/symbols.xml \
substitute ${dfhack_}/hack/symbols.xml $out/hack/symbols.xml \
--replace $(cat ${dwarf-fortress-original}/hash.md5.orig) \
$(cat ${dwarf-fortress-original}/hash.md5)
'';

View File

@ -2,7 +2,7 @@
source @dfInit@
for i in dfhack.init-example dfhack-config/default hack/*; do
for i in dfhack.init-example dfhack-config/default hack/* stonesense/*; do
update_path "$i"
done