dwarf-fortress.dfhack: enable 64-bit build, fix segfault
This commit is contained in:
parent
79ea04c6c7
commit
714cf7803c
|
@ -3,15 +3,13 @@
|
|||
let
|
||||
callPackage = pkgs.newScope self;
|
||||
callPackage_i686 = pkgsi686Linux.newScope self;
|
||||
oldAbiStdenv = pkgs.overrideInStdenv pkgs.stdenv [ pkgs.useOldCXXAbi ];
|
||||
|
||||
self = rec {
|
||||
dwarf-fortress-original = callPackage ./game.nix { };
|
||||
|
||||
dfhack = callPackage ./dfhack {
|
||||
inherit (pkgs.perlPackages) XMLLibXML XMLLibXSLT;
|
||||
protobuf = with pkgs; protobuf.override {
|
||||
stdenv = overrideInStdenv stdenv [ useOldCXXAbi ];
|
||||
};
|
||||
};
|
||||
|
||||
dwarf-fortress-unfuck = callPackage ./unfuck.nix { };
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
{ stdenv, fetchgit, cmake, writeScriptBin
|
||||
, perl, XMLLibXML, XMLLibXSLT
|
||||
, zlib
|
||||
, jsoncpp, protobuf, tinyxml
|
||||
}:
|
||||
|
||||
let
|
||||
|
@ -15,6 +14,11 @@ let
|
|||
# revision of library/xml submodule
|
||||
xmlRev = "84f6e968a9ec5515f9dbef96b445e3fc83f83e8b";
|
||||
|
||||
arch =
|
||||
if stdenv.system == "x86_64-linux" then "64"
|
||||
else if stdenv.system == "i686-linux" then "32"
|
||||
else throw "Unsupported architecture";
|
||||
|
||||
fakegit = writeScriptBin "git" ''
|
||||
#! ${stdenv.shell}
|
||||
if [ "$*" = "describe --tags --long" ]; then
|
||||
|
@ -41,13 +45,17 @@ in stdenv.mkDerivation rec {
|
|||
inherit rev sha256;
|
||||
};
|
||||
|
||||
patches = [ ./use-system-libraries.patch ];
|
||||
patches = [ ./skip-ruby.patch ];
|
||||
|
||||
nativeBuildInputs = [ cmake perl XMLLibXML XMLLibXSLT fakegit ];
|
||||
# we can't use native Lua; upstream uses private headers
|
||||
buildInputs = [ zlib jsoncpp protobuf tinyxml ];
|
||||
# We don't use system libraries because dfhack needs old C++ ABI.
|
||||
buildInputs = [ zlib ];
|
||||
|
||||
cmakeFlags = [ "-DEXTERNAL_TINYXML=ON" ];
|
||||
preBuild = ''
|
||||
export LD_LIBRARY_PATH="$PWD/depends/protobuf:$LD_LIBRARY_PATH"
|
||||
'';
|
||||
|
||||
cmakeFlags = [ "-DDFHACK_BUILD_ARCH=${arch}" ];
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
|
@ -57,7 +65,7 @@ in stdenv.mkDerivation rec {
|
|||
description = "Memory hacking library for Dwarf Fortress and a set of tools that use it";
|
||||
homepage = "https://github.com/DFHack/dfhack/";
|
||||
license = licenses.zlib;
|
||||
platforms = [ "i686-linux" ];
|
||||
platforms = [ "x86_64-linux" "i686-linux" ];
|
||||
maintainers = with maintainers; [ robbinch a1russell abbradar ];
|
||||
};
|
||||
}
|
||||
|
|
16
pkgs/games/dwarf-fortress/dfhack/skip-ruby.patch
Normal file
16
pkgs/games/dwarf-fortress/dfhack/skip-ruby.patch
Normal file
|
@ -0,0 +1,16 @@
|
|||
diff -ru3 dfhack-ae59b4f/plugins/ruby/CMakeLists.txt dfhack-ae59b4f-new/plugins/ruby/CMakeLists.txt
|
||||
--- dfhack-ae59b4f/plugins/ruby/CMakeLists.txt 1970-01-01 03:00:01.000000000 +0300
|
||||
+++ dfhack-ae59b4f-new/plugins/ruby/CMakeLists.txt 2016-11-23 15:29:09.907286546 +0300
|
||||
@@ -1,3 +1,4 @@
|
||||
+IF(FALSE)
|
||||
IF (APPLE)
|
||||
SET(RUBYLIB ${CMAKE_CURRENT_SOURCE_DIR}/osx${DFHACK_BUILD_ARCH}/libruby.dylib)
|
||||
SET(RUBYLIB_INSTALL_NAME "libruby.dylib")
|
||||
@@ -48,6 +49,7 @@
|
||||
"482c1c418f4ee1a5f04203eee1cda0ef")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
+ENDIF()
|
||||
|
||||
IF (APPLE OR UNIX)
|
||||
SET(RUBYAUTOGEN ruby-autogen-gcc.rb)
|
|
@ -1,113 +0,0 @@
|
|||
diff -ru3 dfhack-ae59b4f/CMakeLists.txt dfhack-ae59b4f-new/CMakeLists.txt
|
||||
--- dfhack-ae59b4f/CMakeLists.txt 1970-01-01 03:00:01.000000000 +0300
|
||||
+++ dfhack-ae59b4f-new/CMakeLists.txt 2016-11-23 15:21:56.134538785 +0300
|
||||
@@ -202,8 +202,6 @@
|
||||
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /Od")
|
||||
ENDIF()
|
||||
|
||||
-# use shared libraries for protobuf
|
||||
-ADD_DEFINITIONS(-DPROTOBUF_USE_DLLS)
|
||||
ADD_DEFINITIONS(-DLUA_BUILD_AS_DLL)
|
||||
|
||||
if(APPLE)
|
||||
@@ -297,10 +295,8 @@
|
||||
endif()
|
||||
|
||||
find_package(ZLIB REQUIRED)
|
||||
-include_directories(depends/protobuf)
|
||||
include_directories(depends/lua/include)
|
||||
include_directories(depends/md5)
|
||||
-include_directories(depends/jsoncpp)
|
||||
|
||||
# Support linking against external tinyxml
|
||||
# If we find an external tinyxml, set the DFHACK_TINYXML variable to "tinyxml"
|
||||
diff -ru3 dfhack-ae59b4f/depends/CMakeLists.txt dfhack-ae59b4f-new/depends/CMakeLists.txt
|
||||
--- dfhack-ae59b4f/depends/CMakeLists.txt 1970-01-01 03:00:01.000000000 +0300
|
||||
+++ dfhack-ae59b4f-new/depends/CMakeLists.txt 2016-11-23 15:21:56.134538785 +0300
|
||||
@@ -1,7 +1,6 @@
|
||||
#list depends here.
|
||||
add_subdirectory(lua)
|
||||
add_subdirectory(md5)
|
||||
-add_subdirectory(protobuf)
|
||||
|
||||
# Don't build tinyxml if it's being externally linked against.
|
||||
if(NOT TinyXML_FOUND)
|
||||
@@ -9,7 +8,6 @@
|
||||
endif()
|
||||
|
||||
add_subdirectory(tthread)
|
||||
-add_subdirectory(jsoncpp)
|
||||
# build clsocket static and only as a dependency. Setting those options here overrides its own default settings.
|
||||
OPTION(CLSOCKET_SHARED "Build clsocket lib as shared." OFF)
|
||||
OPTION(CLSOCKET_DEP_ONLY "Build for use inside other CMake projects as dependency." ON)
|
||||
diff -ru3 dfhack-ae59b4f/library/CMakeLists.txt dfhack-ae59b4f-new/library/CMakeLists.txt
|
||||
--- dfhack-ae59b4f/library/CMakeLists.txt 1970-01-01 03:00:01.000000000 +0300
|
||||
+++ dfhack-ae59b4f-new/library/CMakeLists.txt 2016-11-23 15:22:24.995519136 +0300
|
||||
@@ -236,14 +236,14 @@
|
||||
|
||||
ADD_CUSTOM_COMMAND(
|
||||
OUTPUT ${PROJECT_PROTO_TMP_FILES}
|
||||
- COMMAND protoc-bin -I=${CMAKE_CURRENT_SOURCE_DIR}/proto/
|
||||
+ COMMAND protoc -I=${CMAKE_CURRENT_SOURCE_DIR}/proto/
|
||||
--cpp_out=dllexport_decl=DFHACK_EXPORT:${CMAKE_CURRENT_SOURCE_DIR}/proto/tmp/
|
||||
${PROJECT_PROTOS}
|
||||
COMMAND ${PERL_EXECUTABLE} ${CMAKE_SOURCE_DIR}/depends/copy-if-different.pl
|
||||
${PROJECT_PROTO_TMP_FILES}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/proto/
|
||||
COMMENT "Generating core protobufs"
|
||||
- DEPENDS protoc-bin ${PROJECT_PROTOS}
|
||||
+ DEPENDS ${PROJECT_PROTOS}
|
||||
)
|
||||
|
||||
ADD_CUSTOM_TARGET(generate_proto_core DEPENDS ${PROJECT_PROTO_TMP_FILES})
|
||||
diff -ru3 dfhack-ae59b4f/plugins/CMakeLists.txt dfhack-ae59b4f-new/plugins/CMakeLists.txt
|
||||
--- dfhack-ae59b4f/plugins/CMakeLists.txt 1970-01-01 03:00:01.000000000 +0300
|
||||
+++ dfhack-ae59b4f-new/plugins/CMakeLists.txt 2016-11-23 15:22:47.291503960 +0300
|
||||
@@ -60,7 +60,7 @@
|
||||
|
||||
ADD_CUSTOM_COMMAND(
|
||||
OUTPUT ${PROJECT_PROTO_TMP_FILES}
|
||||
- COMMAND protoc-bin -I=${dfhack_SOURCE_DIR}/library/proto/
|
||||
+ COMMAND protoc -I=${dfhack_SOURCE_DIR}/library/proto/
|
||||
-I=${CMAKE_CURRENT_SOURCE_DIR}/proto/
|
||||
--cpp_out=${CMAKE_CURRENT_SOURCE_DIR}/proto/tmp/
|
||||
${PROJECT_PROTOS}
|
||||
@@ -68,7 +68,7 @@
|
||||
${PROJECT_PROTO_TMP_FILES}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/proto/
|
||||
COMMENT "Generating plugin protobufs"
|
||||
- DEPENDS protoc-bin ${PROJECT_PROTOS}
|
||||
+ DEPENDS ${PROJECT_PROTOS}
|
||||
)
|
||||
ADD_CUSTOM_TARGET(generate_proto DEPENDS ${PROJECT_PROTO_TMP_FILES})
|
||||
|
||||
diff -ru3 dfhack-ae59b4f/plugins/ruby/CMakeLists.txt dfhack-ae59b4f-new/plugins/ruby/CMakeLists.txt
|
||||
--- dfhack-ae59b4f/plugins/ruby/CMakeLists.txt 1970-01-01 03:00:01.000000000 +0300
|
||||
+++ dfhack-ae59b4f-new/plugins/ruby/CMakeLists.txt 2016-11-23 15:29:09.907286546 +0300
|
||||
@@ -1,3 +1,4 @@
|
||||
+IF(FALSE)
|
||||
IF (APPLE)
|
||||
SET(RUBYLIB ${CMAKE_CURRENT_SOURCE_DIR}/osx${DFHACK_BUILD_ARCH}/libruby.dylib)
|
||||
SET(RUBYLIB_INSTALL_NAME "libruby.dylib")
|
||||
@@ -48,6 +49,7 @@
|
||||
"482c1c418f4ee1a5f04203eee1cda0ef")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
+ENDIF()
|
||||
|
||||
IF (APPLE OR UNIX)
|
||||
SET(RUBYAUTOGEN ruby-autogen-gcc.rb)
|
||||
diff -ru3 dfhack-ae59b4f/plugins/stockpiles/CMakeLists.txt dfhack-ae59b4f-new/plugins/stockpiles/CMakeLists.txt
|
||||
--- dfhack-ae59b4f/plugins/stockpiles/CMakeLists.txt 1970-01-01 03:00:01.000000000 +0300
|
||||
+++ dfhack-ae59b4f-new/plugins/stockpiles/CMakeLists.txt 2016-11-23 15:21:56.134538785 +0300
|
||||
@@ -33,8 +33,8 @@
|
||||
#Generate sources from our proto files and store them in the source tree
|
||||
ADD_CUSTOM_COMMAND(
|
||||
OUTPUT ${PROJECT_PROTO_SRCS} ${PROJECT_PROTO_HDRS}
|
||||
-COMMAND protoc-bin -I=${CMAKE_CURRENT_SOURCE_DIR}/proto/ --cpp_out=${CMAKE_CURRENT_SOURCE_DIR}/proto/ ${PROJECT_PROTOS}
|
||||
-DEPENDS protoc-bin ${PROJECT_PROTOS}
|
||||
+COMMAND protoc -I=${CMAKE_CURRENT_SOURCE_DIR}/proto/ --cpp_out=${CMAKE_CURRENT_SOURCE_DIR}/proto/ ${PROJECT_PROTOS}
|
||||
+DEPENDS ${PROJECT_PROTOS}
|
||||
)
|
||||
|
||||
IF(WIN32)
|
|
@ -30,6 +30,9 @@ stdenv.mkDerivation {
|
|||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
# Breaks dfhack because of inlining.
|
||||
hardeningDisable = [ "fortify" ];
|
||||
|
||||
passthru.dfVersion = "0.43.05";
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
|
|
|
@ -17,17 +17,12 @@ let
|
|||
|
||||
env = buildEnv {
|
||||
name = "dwarf-fortress-env-${dwarf-fortress-original.dfVersion}";
|
||||
|
||||
paths = pkgs;
|
||||
pathsToLink = [ "/" "/hack" ];
|
||||
ignoreCollisions = true;
|
||||
|
||||
postBuild = lib.optionalString enableDFHack ''
|
||||
# #4621
|
||||
if [ -L "$out/hack" ]; then
|
||||
rm $out/hack
|
||||
mkdir $out/hack
|
||||
for i in ${dfhack}/hack/*; do
|
||||
ln -s $i $out/hack
|
||||
done
|
||||
fi
|
||||
rm $out/hack/symbols.xml
|
||||
substitute ${dfhack}/hack/symbols.xml $out/hack/symbols.xml \
|
||||
--replace $(cat ${dwarf-fortress-original}/hash.md5.orig) \
|
||||
|
|
Loading…
Reference in a new issue