git.iko.soy/typeable/nixpkgs
on master help sign in
dwarf-fortress-packages.dfhack: add stoneSense support
commit85056ee698bdf85dc0db9ca0865dc2b0a2c16ed4 authorHerwig Hochleitner <herwig@bendlas.net> dateSun 1 Oct 2017, 21:26 (9 years ago) parent24ea093
7 files changed+55−19
pkgs/games/dwarf-fortress/default.nix+1 pkgs/games/dwarf-fortress/dfhack/default.nix+8−6 pkgs/games/dwarf-fortress/dfhack/fix-stonesense.patch+23 pkgs/games/dwarf-fortress/dfhack/skip-ruby.patch−10 pkgs/games/dwarf-fortress/stonesense.nix+15 pkgs/games/dwarf-fortress/wrapper/default.nix+7−2 pkgs/games/dwarf-fortress/wrapper/dfhack.in+1−1
pkgs/games/dwarf-fortress/default.nix+1
@@ -12,6 +12,7 @@ let
1212 };
1313
1414 soundSense = callPackage ./soundsense.nix { };
15+ stoneSense = callPackage ./stonesense.nix { };
1516
1617 dwarf-fortress-unfuck = callPackage ./unfuck.nix { };
1718
pkgs/games/dwarf-fortress/dfhack/default.nix+8−6
@@ -1,6 +1,6 @@
1−{ stdenv, fetchgit, cmake, writeScriptBin
2−, perl, XMLLibXML, XMLLibXSLT
3−, zlib
1+{ stdenv, lib, fetchgit, cmake, writeScriptBin, callPackage
2+, perl, XMLLibXML, XMLLibXSLT, zlib
3+, enableStoneSense ? false, allegro5, mesa
44}:
55
66let
@@ -43,11 +43,12 @@ in stdenv.mkDerivation rec {
4343 inherit rev sha256;
4444 };
4545
46− patches = [ ./skip-ruby.patch ];
46+ patches = [ ./fix-stonesense.patch ];
4747
4848 nativeBuildInputs = [ cmake perl XMLLibXML XMLLibXSLT fakegit ];
4949 # We don't use system libraries because dfhack needs old C++ ABI.
50− buildInputs = [ zlib ];
50+ buildInputs = [ zlib ]
51+ ++ lib.optionals enableStoneSense [ allegro5 mesa ];
5152
5253 preConfigure = ''
5354 # Trick build system into believing we have .git
@@ -59,7 +60,8 @@ in stdenv.mkDerivation rec {
5960 export LD_LIBRARY_PATH="$PWD/depends/protobuf:$LD_LIBRARY_PATH"
6061 '';
6162
62− cmakeFlags = [ "-DDFHACK_BUILD_ARCH=${arch}" ];
63+ cmakeFlags = [ "-DDFHACK_BUILD_ARCH=${arch}" "-DDOWNLOAD_RUBY=OFF" ]
64+ ++ lib.optionals enableStoneSense [ "-DBUILD_STONESENSE=ON" "-DSTONESENSE_INTERNAL_SO=OFF" ];
6365
6466 enableParallelBuilding = true;
6567
pkgs/games/dwarf-fortress/dfhack/fix-stonesense.patchnew file+23
@@ -0,0 +1,23 @@
1+From f5be6fe5fb192f01ae4551ed9217e97fd7f6a0ae Mon Sep 17 00:00:00 2001
2+From: Herwig Hochleitner <hhochleitner@gmail.com>
3+Date: Sun, 1 Oct 2017 18:01:43 +0200
4+Subject: [PATCH] include <GL/glext.h>
5+
6+this fixes `GLhandleARB` not being defined
7+---
8+ plugins/stonesense/common.h | 2 ++
9+ 1 file changed, 2 insertions(+)
10+
11+diff --git a/plugins/stonesense/common.h b/plugins/stonesense/common.h
12+index eb36691..ef45389 100644
13+--- a/plugins/stonesense/common.h
14++++ b/plugins/stonesense/common.h
15+@@ -31,6 +31,8 @@ using namespace df::enums;
16+ #include <allegro5/allegro_opengl.h>
17+ #include <allegro5/utf8.h>
18+
19++#include <GL/glext.h>
20++
21+ // allegro leaks X headers, undef some of it here:
22+ #undef TileShape
23+ #undef None
pkgs/games/dwarf-fortress/dfhack/skip-ruby.patchdeleted−10
@@ -1,10 +0,0 @@
1−diff --git a/plugins/ruby/CMakeLists.txt b/plugins/ruby/CMakeLists.txt
2−index f1ef12ac..0976e18a 100644
3−--- a/plugins/ruby/CMakeLists.txt
4−+++ b/plugins/ruby/CMakeLists.txt
5−@@ -1,5 +1,5 @@
6− # Allow build system to turn off downloading of libruby.so.
7−-OPTION(DOWNLOAD_RUBY "Download prebuilt libruby.so for ruby plugin." ON)
8−+OPTION(DOWNLOAD_RUBY "Download prebuilt libruby.so for ruby plugin." OFF)
9−
10− IF (DOWNLOAD_RUBY)
pkgs/games/dwarf-fortress/stonesense.nixnew file+15
@@ -0,0 +1,15 @@
1+{ stdenv, fetchFromGitHub, cmake }:
2+
3+stdenv.mkDerivation rec {
4+ name = "stonesense";
5+ src = fetchFromGitHub {
6+ owner = "DFHack";
7+ repo = "stonesense";
8+ rev = "be793a080e66db1ff79ac284070632ec1a896708";
9+ sha256 = "1kibqblxp16z75zm48kk59w483933rkg4w339f28fcrbpg4sn92s";
10+ };
11+
12+ nativeBuildInputs = [ cmake ];
13+
14+ cmakeFlags = [ "-DDFHACK_BUILD_ARCH=64" ];
15+}
pkgs/games/dwarf-fortress/wrapper/default.nix+7−2
@@ -1,11 +1,16 @@
11{ stdenv, lib, buildEnv, dwarf-fortress-original, substituteAll
22, enableDFHack ? false, dfhack
33, enableSoundSense ? false, soundSense, jdk
4+, enableStoneSense ? false
45, themes ? {}
56, theme ? null
67}:
78
89let
10+ dfhack_ = dfhack.override {
11+ inherit enableStoneSense;
12+ };
13+
914 ptheme =
1015 if builtins.isString theme
1116 then builtins.getAttr theme themes
@@ -13,7 +18,7 @@ let
1318
1419 # These are in inverse order for first packages to override the next ones.
1520 pkgs = lib.optional (theme != null) ptheme
16− ++ lib.optional enableDFHack dfhack
21+ ++ lib.optional enableDFHack dfhack_
1722 ++ lib.optional enableSoundSense soundSense
1823 ++ [ dwarf-fortress-original ];
1924
@@ -26,7 +31,7 @@ let
2631
2732 postBuild = lib.optionalString enableDFHack ''
2833 rm $out/hack/symbols.xml
29− substitute ${dfhack}/hack/symbols.xml $out/hack/symbols.xml \
34+ substitute ${dfhack_}/hack/symbols.xml $out/hack/symbols.xml \
3035 --replace $(cat ${dwarf-fortress-original}/hash.md5.orig) \
3136 $(cat ${dwarf-fortress-original}/hash.md5)
3237 '';
pkgs/games/dwarf-fortress/wrapper/dfhack.in+1−1
@@ -2,7 +2,7 @@
22
33source @dfInit@
44
5−for i in dfhack.init-example dfhack-config/default hack/*; do
5+for i in dfhack.init-example dfhack-config/default hack/* stonesense/*; do
66 update_path "$i"
77done
88