Skip to content

Commit 714cf78

Browse files
committedNov 24, 2016
dwarf-fortress.dfhack: enable 64-bit build, fix segfault
1 parent 79ea04c commit 714cf78

File tree

6 files changed

+37
-130
lines changed

6 files changed

+37
-130
lines changed
 

Diff for: ‎pkgs/games/dwarf-fortress/default.nix

+1-3
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,13 @@
33
let
44
callPackage = pkgs.newScope self;
55
callPackage_i686 = pkgsi686Linux.newScope self;
6+
oldAbiStdenv = pkgs.overrideInStdenv pkgs.stdenv [ pkgs.useOldCXXAbi ];
67

78
self = rec {
89
dwarf-fortress-original = callPackage ./game.nix { };
910

1011
dfhack = callPackage ./dfhack {
1112
inherit (pkgs.perlPackages) XMLLibXML XMLLibXSLT;
12-
protobuf = with pkgs; protobuf.override {
13-
stdenv = overrideInStdenv stdenv [ useOldCXXAbi ];
14-
};
1513
};
1614

1715
dwarf-fortress-unfuck = callPackage ./unfuck.nix { };

Diff for: ‎pkgs/games/dwarf-fortress/dfhack/default.nix

+14-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{ stdenv, fetchgit, cmake, writeScriptBin
22
, perl, XMLLibXML, XMLLibXSLT
33
, zlib
4-
, jsoncpp, protobuf, tinyxml
54
}:
65

76
let
@@ -15,6 +14,11 @@ let
1514
# revision of library/xml submodule
1615
xmlRev = "84f6e968a9ec5515f9dbef96b445e3fc83f83e8b";
1716

17+
arch =
18+
if stdenv.system == "x86_64-linux" then "64"
19+
else if stdenv.system == "i686-linux" then "32"
20+
else throw "Unsupported architecture";
21+
1822
fakegit = writeScriptBin "git" ''
1923
#! ${stdenv.shell}
2024
if [ "$*" = "describe --tags --long" ]; then
@@ -41,13 +45,17 @@ in stdenv.mkDerivation rec {
4145
inherit rev sha256;
4246
};
4347

44-
patches = [ ./use-system-libraries.patch ];
48+
patches = [ ./skip-ruby.patch ];
4549

4650
nativeBuildInputs = [ cmake perl XMLLibXML XMLLibXSLT fakegit ];
47-
# we can't use native Lua; upstream uses private headers
48-
buildInputs = [ zlib jsoncpp protobuf tinyxml ];
51+
# We don't use system libraries because dfhack needs old C++ ABI.
52+
buildInputs = [ zlib ];
53+
54+
preBuild = ''
55+
export LD_LIBRARY_PATH="$PWD/depends/protobuf:$LD_LIBRARY_PATH"
56+
'';
4957

50-
cmakeFlags = [ "-DEXTERNAL_TINYXML=ON" ];
58+
cmakeFlags = [ "-DDFHACK_BUILD_ARCH=${arch}" ];
5159

5260
enableParallelBuilding = true;
5361

@@ -57,7 +65,7 @@ in stdenv.mkDerivation rec {
5765
description = "Memory hacking library for Dwarf Fortress and a set of tools that use it";
5866
homepage = "https://github.com/DFHack/dfhack/";
5967
license = licenses.zlib;
60-
platforms = [ "i686-linux" ];
68+
platforms = [ "x86_64-linux" "i686-linux" ];
6169
maintainers = with maintainers; [ robbinch a1russell abbradar ];
6270
};
6371
}

Diff for: ‎pkgs/games/dwarf-fortress/dfhack/skip-ruby.patch

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
diff -ru3 dfhack-ae59b4f/plugins/ruby/CMakeLists.txt dfhack-ae59b4f-new/plugins/ruby/CMakeLists.txt
2+
--- dfhack-ae59b4f/plugins/ruby/CMakeLists.txt 1970-01-01 03:00:01.000000000 +0300
3+
+++ dfhack-ae59b4f-new/plugins/ruby/CMakeLists.txt 2016-11-23 15:29:09.907286546 +0300
4+
@@ -1,3 +1,4 @@
5+
+IF(FALSE)
6+
IF (APPLE)
7+
SET(RUBYLIB ${CMAKE_CURRENT_SOURCE_DIR}/osx${DFHACK_BUILD_ARCH}/libruby.dylib)
8+
SET(RUBYLIB_INSTALL_NAME "libruby.dylib")
9+
@@ -48,6 +49,7 @@
10+
"482c1c418f4ee1a5f04203eee1cda0ef")
11+
ENDIF()
12+
ENDIF()
13+
+ENDIF()
14+
15+
IF (APPLE OR UNIX)
16+
SET(RUBYAUTOGEN ruby-autogen-gcc.rb)

Diff for: ‎pkgs/games/dwarf-fortress/dfhack/use-system-libraries.patch

-113
This file was deleted.

Diff for: ‎pkgs/games/dwarf-fortress/unfuck.nix

+3
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ stdenv.mkDerivation {
3030

3131
enableParallelBuilding = true;
3232

33+
# Breaks dfhack because of inlining.
34+
hardeningDisable = [ "fortify" ];
35+
3336
passthru.dfVersion = "0.43.05";
3437

3538
meta = with stdenv.lib; {

Diff for: ‎pkgs/games/dwarf-fortress/wrapper/default.nix

+3-8
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,12 @@ let
1717

1818
env = buildEnv {
1919
name = "dwarf-fortress-env-${dwarf-fortress-original.dfVersion}";
20+
2021
paths = pkgs;
22+
pathsToLink = [ "/" "/hack" ];
2123
ignoreCollisions = true;
24+
2225
postBuild = lib.optionalString enableDFHack ''
23-
# #4621
24-
if [ -L "$out/hack" ]; then
25-
rm $out/hack
26-
mkdir $out/hack
27-
for i in ${dfhack}/hack/*; do
28-
ln -s $i $out/hack
29-
done
30-
fi
3126
rm $out/hack/symbols.xml
3227
substitute ${dfhack}/hack/symbols.xml $out/hack/symbols.xml \
3328
--replace $(cat ${dwarf-fortress-original}/hash.md5.orig) \

0 commit comments

Comments
 (0)