diff options
author | eroen <eroen-overlay@occam.eroen.eu> | 2017-05-30 10:51:39 +0200 |
---|---|---|
committer | eroen <eroen-overlay@occam.eroen.eu> | 2017-05-30 10:51:39 +0200 |
commit | 0847f9457ea0ec5958fd92e116b22ba51ae3431d (patch) | |
tree | 64a4f7bbaf0214835e2cff00bc7d6b8fb961b5e0 | |
parent | dfhack - add comment (diff) | |
download | eroen-0847f9457ea0ec5958fd92e116b22ba51ae3431d.tar.gz eroen-0847f9457ea0ec5958fd92e116b22ba51ae3431d.tar.bz2 eroen-0847f9457ea0ec5958fd92e116b22ba51ae3431d.zip |
dfhack-0.43.05.1 - bump
6 files changed, 495 insertions, 0 deletions
diff --git a/games-util/dfhack/dfhack-0.43.05.1.ebuild b/games-util/dfhack/dfhack-0.43.05.1.ebuild new file mode 100644 index 0000000..b2df8b8 --- /dev/null +++ b/games-util/dfhack/dfhack-0.43.05.1.ebuild @@ -0,0 +1,107 @@ +# By eroen <eroen-overlay@occam.eroen.eu>, 2012 - 2017 +# Permission to use, copy, modify, and/or distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. + +EAPI=6 + +inherit versionator git-r3 cmake-utils + +df_PV=$(get_version_component_range 1-3) + +DESCRIPTION="Memory hacking library for Dwarf Fortress and a set of tools that use it" +HOMEPAGE="http://github.com/DFHack/dfhack" +EGIT_REPO_URI="https://github.com/DFHack/dfhack.git" +if [[ $PV == *.9999 ]]; then + EGIT_BRANCH="develop" +elif [[ $PV == *_alpha* || $PV == *_beta* ]]; then + EGIT_MIN_CLONE="single" + EGIT_COMMIT="${PV/_alpha/-alpha}" + EGIT_COMMIT="${EGIT_COMMIT/_beta/-beta}" +elif [[ $PV == *_pre* ]]; then + EGIT_MIN_CLONE_TYPE=mirror + EGIT_COMMIT="X" + xml_EGIT_COMMIT="X" +else + EGIT_COMMIT="${PV%.*}-r${PV##*.}" +fi + +KEYWORDS="-* ~amd64" # ~x86 + +CMAKE_MIN_VERSION=2.8.0 +CMAKE_REMOVE_MODULES_LIST="FindCurses FindDoxygen CMakeVS10FindMake" + +LICENSE="ZLIB MIT BSD-2 BSD CC-BY-SA-3.0" +SLOT="0" +IUSE="" + +# dfhack bundles lua (5.3 as of 0.43.05-alpha1) +HDEPEND=" + >=sys-devel/gcc-4.5 + dev-lang/perl + dev-perl/XML-LibXML + dev-perl/XML-LibXSLT + " +LIBRARY_DEPEND=" + sys-libs/zlib + " +DEPEND="${LIBRARY_DEPEND} + ${HDEPEND}" +RDEPEND="${LIBRARY_DEPEND} + ~games-roguelike/dwarf-fortress-$df_PV" + +PATCHES=( "$FILESDIR"/dfhack-$PV ) + +QA_PREBUILT="opt/dfhack/hack/libruby.so" + +src_unpack() { + git-r3_src_unpack + if [[ -n $xml_EGIT_COMMIT ]]; then + cd "$S/library/xml" || die + git checkout "$xml_EGIT_COMMIT" || die + fi +} + +src_prepare() { + default + local install="\${HOME}/.dwarf-fortress-${df_PV}_dfhack" exe="./libs/Dwarf_Fortress" + sed -e "s:^install=.*:install=${install}:" \ + -e "s:^exe=.*:exe=\"${exe}\":" \ + "$FILESDIR"/dfhack > "$T"/dfhack || die + cp "$FILESDIR"/dfhack-run "$T" || die +} + +src_configure() { + local mycmakeargs=( + -DDFHACK_BUILD_ARCH=$(usex amd64 64 "")$(usex x86 32 "") + -DEXTERNAL_TINYXML=NO # https://bugs.gentoo.org/show_bug.cgi?id=592696 + -DCMAKE_INSTALL_PREFIX=/opt/dfhack + -DDFHACK_DATA_DESTINATION=/opt/dfhack/hack + -DDFHACK_LUA_DESTINATION=/opt/dfhack/hack/lua + -DDFHACK_PLUGIN_DESTINATION=/opt/dfhack/hack/plugins + -DDFHACK_LIBRARY_DESTINATION=/opt/dfhack/hack + -DDFHACK_RUBY_DESTINATION=/opt/dfhack/hack/ruby + -DBUILD_RUBY=OFF # TODO: downloads libruby.so + -DBUILD_DEV_PLUGINS=ON + -DBUILD_SKELETON=ON + ) + + cmake-utils_src_configure +} + +DOCS=( ) +src_install() { + cmake-utils_src_install + + dobin "$T"/dfhack{,-run} +} + +pkg_postinst() { + elog "Due to Dwarf Fortress' special needs regarding working directory," + elog "specifying relative paths to DFHack plugins can give unintended results." + elog + elog "Your dfhack.init should be placed in \${HOME}/.dwarf-fortress-${df_PV}_dfhack/ ," + elog "otherwise the example configuration will be used." + elog + elog "To start DFHack, please run dfhack" +} diff --git a/games-util/dfhack/files/dfhack-0.43.05.1/0001-Respect-DFHACK_DATA_DESTINATION.patch b/games-util/dfhack/files/dfhack-0.43.05.1/0001-Respect-DFHACK_DATA_DESTINATION.patch new file mode 100644 index 0000000..14314a3 --- /dev/null +++ b/games-util/dfhack/files/dfhack-0.43.05.1/0001-Respect-DFHACK_DATA_DESTINATION.patch @@ -0,0 +1,95 @@ +From 8ca7c7e837a814db34cd932eeabbd429f758ca37 Mon Sep 17 00:00:00 2001 +From: eroen <eroen@occam.eroen.eu> +Date: Mon, 29 May 2017 21:09:45 +0200 +Subject: [PATCH 1/5] Respect DFHACK_DATA_DESTINATION + +--- + CMakeLists.txt | 2 +- + library/CMakeLists.txt | 3 +++ + library/Core.cpp | 14 ++++++++++---- + 3 files changed, 14 insertions(+), 5 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index e261443b..c3fedbf0 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -158,7 +158,7 @@ ENDIF() + # external tools will be installed here: + SET(DFHACK_BINARY_DESTINATION .) + # dfhack data goes here: +-SET(DFHACK_DATA_DESTINATION hack) ++SET(DFHACK_DATA_DESTINATION hack CACHE INTERNAL "") + # plugin libs go here: + SET(DFHACK_PLUGIN_DESTINATION hack/plugins) + # dfhack header files go here: +diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt +index ce73741a..6ca4811d 100644 +--- a/library/CMakeLists.txt ++++ b/library/CMakeLists.txt +@@ -75,6 +75,9 @@ RemoteServer.cpp + RemoteTools.cpp + ) + ++set_property( SOURCE "Core.cpp" APPEND PROPERTY COMPILE_DEFINITIONS ++ "DFHACK_DATA_DESTINATION=\"${DFHACK_DATA_DESTINATION}\"" ) ++ + SET(MAIN_SOURCES_WINDOWS + Console-windows.cpp + Hooks-windows.cpp +diff --git a/library/Core.cpp b/library/Core.cpp +index 198e49df..e20d01f2 100644 +--- a/library/Core.cpp ++++ b/library/Core.cpp +@@ -75,6 +75,7 @@ using namespace DFHack; + #include <stdio.h> + #include <iomanip> + #include <stdlib.h> ++#include <string.h> + #include <fstream> + #include "tinythread.h" + #include "md5wrapper.h" +@@ -383,7 +384,7 @@ static command_result runRubyScript(color_ostream &out, PluginManager *plug_mgr, + rbcmd += "'" + args[i] + "', "; + rbcmd += "]\n"; + +- rbcmd += "catch(:script_finished) { load './hack/scripts/" + name + ".rb' }"; ++ rbcmd += "catch(:script_finished) { load '" DFHACK_DATA_DESTINATION "/scripts/" + name + ".rb' }"; + + return plug_mgr->ruby->eval_ruby(out, rbcmd.c_str()); + } +@@ -501,6 +502,7 @@ void Core::getScriptPaths(std::vector<std::string> *dest) + } + dest->push_back(df_path + "/raw/scripts"); + dest->push_back(df_path + "/hack/scripts"); ++ dest->push_back(DFHACK_DATA_DESTINATION "/scripts"); + for (auto it = script_paths[1].begin(); it != script_paths[1].end(); ++it) + dest->push_back(*it); + } +@@ -1448,7 +1450,11 @@ void Core::fatal (std::string output) + std::string Core::getHackPath() + { + #ifdef LINUX_BUILD +- return p->getPath() + "/hack/"; ++ if(strncmp(DFHACK_DATA_DESTINATION, "hack", 5) == 0) ++ // This is the default value ++ return p->getPath() + "/hack/"; ++ else ++ return DFHACK_DATA_DESTINATION "/"; + #else + return p->getPath() + "\\hack\\"; + #endif +@@ -1467,9 +1473,9 @@ bool Core::Init() + + // find out what we are... + #ifdef LINUX_BUILD +- const char * path = "hack/symbols.xml"; ++ const char * path = DFHACK_DATA_DESTINATION "/symbols.xml"; + #else +- const char * path = "hack\\symbols.xml"; ++ const char * path = DFHACK_DATA_DESTINATION "\\symbols.xml"; + #endif + vif = new DFHack::VersionInfoFactory(); + cerr << "Identifying DF version.\n"; +-- +2.13.0 + diff --git a/games-util/dfhack/files/dfhack-0.43.05.1/0002-respect-DFHACK_LUA_DESTINATION.patch b/games-util/dfhack/files/dfhack-0.43.05.1/0002-respect-DFHACK_LUA_DESTINATION.patch new file mode 100644 index 0000000..04a351a --- /dev/null +++ b/games-util/dfhack/files/dfhack-0.43.05.1/0002-respect-DFHACK_LUA_DESTINATION.patch @@ -0,0 +1,75 @@ +From 6123ea9bf444b953ea6c08efe3645149d277167f Mon Sep 17 00:00:00 2001 +From: eroen <eroen@occam.eroen.eu> +Date: Mon, 29 May 2017 21:09:45 +0200 +Subject: [PATCH 2/5] respect DFHACK_LUA_DESTINATION + +--- + CMakeLists.txt | 3 ++- + depends/lua/CMakeLists.txt | 5 ++++- + depends/lua/include/{luaconf.h => luaconf.h.in} | 2 +- + 3 files changed, 7 insertions(+), 3 deletions(-) + rename depends/lua/include/{luaconf.h => luaconf.h.in} (99%) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index c3fedbf0..cc457df5 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -164,7 +164,7 @@ SET(DFHACK_PLUGIN_DESTINATION hack/plugins) + # dfhack header files go here: + SET(DFHACK_INCLUDES_DESTINATION hack/include) + # dfhack lua files go here: +-SET(DFHACK_LUA_DESTINATION hack/lua) ++SET(DFHACK_LUA_DESTINATION hack/lua CACHE INTERNAL "") + # the windows .lib file goes here: + SET(DFHACK_DEVLIB_DESTINATION hack) + +@@ -297,6 +297,7 @@ endif() + + find_package(ZLIB REQUIRED) + include_directories(depends/protobuf) ++include_directories("${CMAKE_CURRENT_BINARY_DIR}/depends/lua/include") + include_directories(depends/lua/include) + include_directories(depends/md5) + include_directories(depends/jsoncpp) +diff --git a/depends/lua/CMakeLists.txt b/depends/lua/CMakeLists.txt +index 8b9ce8e2..ad7a209e 100644 +--- a/depends/lua/CMakeLists.txt ++++ b/depends/lua/CMakeLists.txt +@@ -22,6 +22,10 @@ IF(UNIX) + ENDIF() + ENDIF() + ++configure_file("include/luaconf.h.in" "include/luaconf.h" @ONLY) ++SET_SOURCE_FILES_PROPERTIES("${CMAKE_CURRENT_BINARY_DIR}/include" PROPERTIES HEADER_FILE_ONLY TRUE) ++include_directories("${CMAKE_CURRENT_BINARY_DIR}/include") ++ + SET (HDR_LIBLUA + include/lapi.h + include/lauxlib.h +@@ -42,7 +46,6 @@ include/lstring.h + include/ltable.h + include/ltm.h + include/lua.h +-include/luaconf.h + include/lualib.h + include/lundump.h + include/lvm.h +diff --git a/depends/lua/include/luaconf.h b/depends/lua/include/luaconf.h.in +similarity index 99% +rename from depends/lua/include/luaconf.h +rename to depends/lua/include/luaconf.h.in +index 051d2a94..9d50d5ea 100644 +--- a/depends/lua/include/luaconf.h ++++ b/depends/lua/include/luaconf.h.in +@@ -192,7 +192,7 @@ + + #else /* }{ */ + +-#define LUA_LDIR "./hack/lua/" ++#define LUA_LDIR "@DFHACK_LUA_DESTINATION@" "/" + #define LUA_CDIR "./hack/" + #define LUA_PATH_DEFAULT \ + LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" "./?.lua" +-- +2.13.0 + diff --git a/games-util/dfhack/files/dfhack-0.43.05.1/0003-respect-DFHACK_PLUGIN_DESTINATION.patch b/games-util/dfhack/files/dfhack-0.43.05.1/0003-respect-DFHACK_PLUGIN_DESTINATION.patch new file mode 100644 index 0000000..1ce71ee --- /dev/null +++ b/games-util/dfhack/files/dfhack-0.43.05.1/0003-respect-DFHACK_PLUGIN_DESTINATION.patch @@ -0,0 +1,65 @@ +From 59569a834013677e528f8687193f3db60a0e0ee1 Mon Sep 17 00:00:00 2001 +From: eroen <eroen@occam.eroen.eu> +Date: Mon, 29 May 2017 21:09:45 +0200 +Subject: [PATCH 3/5] respect DFHACK_PLUGIN_DESTINATION + +--- + CMakeLists.txt | 2 +- + library/CMakeLists.txt | 2 ++ + library/PluginManager.cpp | 7 ++++++- + 3 files changed, 9 insertions(+), 2 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index cc457df5..1b8b1c4c 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -160,7 +160,7 @@ SET(DFHACK_BINARY_DESTINATION .) + # dfhack data goes here: + SET(DFHACK_DATA_DESTINATION hack CACHE INTERNAL "") + # plugin libs go here: +-SET(DFHACK_PLUGIN_DESTINATION hack/plugins) ++SET(DFHACK_PLUGIN_DESTINATION hack/plugins CACHE INTERNAL "") + # dfhack header files go here: + SET(DFHACK_INCLUDES_DESTINATION hack/include) + # dfhack lua files go here: +diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt +index 6ca4811d..21f4065b 100644 +--- a/library/CMakeLists.txt ++++ b/library/CMakeLists.txt +@@ -77,6 +77,8 @@ RemoteTools.cpp + + set_property( SOURCE "Core.cpp" APPEND PROPERTY COMPILE_DEFINITIONS + "DFHACK_DATA_DESTINATION=\"${DFHACK_DATA_DESTINATION}\"" ) ++set_property( SOURCE "PluginManager.cpp" APPEND PROPERTY COMPILE_DEFINITIONS ++ "DFHACK_PLUGIN_DESTINATION=\"${DFHACK_PLUGIN_DESTINATION}\"" ) + + SET(MAIN_SOURCES_WINDOWS + Console-windows.cpp +diff --git a/library/PluginManager.cpp b/library/PluginManager.cpp +index a4927a75..a4cefb13 100644 +--- a/library/PluginManager.cpp ++++ b/library/PluginManager.cpp +@@ -52,6 +52,7 @@ using namespace std; + using namespace tthread; + + #include <assert.h> ++#include <string.h> + + #define MUTEX_GUARD(lock) auto lock_##__LINE__ = make_mutex_guard(lock); + template <typename T> +@@ -70,7 +71,11 @@ tthread::lock_guard<T> make_mutex_guard (T *mutex) + + static string getPluginPath() + { +- return Core::getInstance().getHackPath() + "plugins/"; ++ if(strncmp(DFHACK_PLUGIN_DESTINATION, "hack/plugins", 13) == 0) ++ // This is the default value ++ return Core::getInstance().getHackPath() + "plugins/"; ++ else ++ return DFHACK_PLUGIN_DESTINATION "/"; + } + + static string getPluginPath (std::string name) +-- +2.13.0 + diff --git a/games-util/dfhack/files/dfhack-0.43.05.1/0004-respect-DFHACK_LIBRARY_DESTINATION.patch b/games-util/dfhack/files/dfhack-0.43.05.1/0004-respect-DFHACK_LIBRARY_DESTINATION.patch new file mode 100644 index 0000000..a43f0ec --- /dev/null +++ b/games-util/dfhack/files/dfhack-0.43.05.1/0004-respect-DFHACK_LIBRARY_DESTINATION.patch @@ -0,0 +1,65 @@ +From a44356e078c28133782cf818367653101fd70d0e Mon Sep 17 00:00:00 2001 +From: eroen <eroen@occam.eroen.eu> +Date: Mon, 29 May 2017 21:09:45 +0200 +Subject: [PATCH 4/5] respect DFHACK_LIBRARY_DESTINATION + +--- + CMakeLists.txt | 4 ++-- + plugins/ruby/CMakeLists.txt | 2 ++ + plugins/ruby/ruby.cpp | 6 +++--- + 3 files changed, 7 insertions(+), 5 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 1b8b1c4c..96a0808f 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -148,11 +148,11 @@ set(DFHACK_VERSION "${DF_VERSION}-${DFHACK_RELEASE}") + # the dfhack libraries will be installed here: + IF(UNIX) + # put the lib into DF/hack +- SET(DFHACK_LIBRARY_DESTINATION hack) ++ SET(DFHACK_LIBRARY_DESTINATION hack CACHE INTERNAL "") + SET(DFHACK_EGGY_DESTINATION libs) + ELSE() + # windows is crap, therefore we can't do nice things with it. leave the libs on a nasty pile... +- SET(DFHACK_LIBRARY_DESTINATION .) ++ SET(DFHACK_LIBRARY_DESTINATION . CACHE INTERNAL "") + SET(DFHACK_EGGY_DESTINATION .) + ENDIF() + # external tools will be installed here: +diff --git a/plugins/ruby/CMakeLists.txt b/plugins/ruby/CMakeLists.txt +index f1ef12ac..8272b5dd 100644 +--- a/plugins/ruby/CMakeLists.txt ++++ b/plugins/ruby/CMakeLists.txt +@@ -76,6 +76,8 @@ INCLUDE_DIRECTORIES("${dfhack_SOURCE_DIR}/depends/tthread") + + DFHACK_PLUGIN(ruby ruby.cpp LINK_LIBRARIES dfhack-tinythread) + ADD_DEPENDENCIES(ruby ruby-autogen-rb) ++set_property( SOURCE "ruby.cpp" APPEND PROPERTY COMPILE_DEFINITIONS ++ "DFHACK_LIBRARY_DESTINATION=\"${DFHACK_LIBRARY_DESTINATION}\"" ) + + IF(EXISTS ${RUBYLIB}) + INSTALL(FILES ${RUBYLIB} DESTINATION ${DFHACK_LIBRARY_DESTINATION} RENAME ${RUBYLIB_INSTALL_NAME}) +diff --git a/plugins/ruby/ruby.cpp b/plugins/ruby/ruby.cpp +index db96e3ed..6bdd74fa 100644 +--- a/plugins/ruby/ruby.cpp ++++ b/plugins/ruby/ruby.cpp +@@ -320,12 +320,12 @@ static int df_loadruby(void) + { + const char *libpaths[] = { + #if defined(WIN32) +- "./libruby.dll", ++ DFHACK_LIBRARY_DESTINATION "./libruby.dll", + #elif defined(__APPLE__) +- "hack/libruby.dylib", ++ DFHACK_LIBRARY_DESTINATION "/libruby.dylib", + "/System/Library/Frameworks/Ruby.framework/Ruby", + #else +- "hack/libruby.so", ++ DFHACK_LIBRARY_DESTINATION "hack/libruby.so", + "libruby.so", + #endif + NULL +-- +2.13.0 + diff --git a/games-util/dfhack/files/dfhack-0.43.05.1/0005-introduce-DFHACK_RUBY_DESTINATION.patch b/games-util/dfhack/files/dfhack-0.43.05.1/0005-introduce-DFHACK_RUBY_DESTINATION.patch new file mode 100644 index 0000000..afea350 --- /dev/null +++ b/games-util/dfhack/files/dfhack-0.43.05.1/0005-introduce-DFHACK_RUBY_DESTINATION.patch @@ -0,0 +1,88 @@ +From ea45bd18f45150638152c16668546fdd4ecfe28a Mon Sep 17 00:00:00 2001 +From: eroen <eroen@occam.eroen.eu> +Date: Mon, 29 May 2017 21:09:45 +0200 +Subject: [PATCH 5/5] introduce DFHACK_RUBY_DESTINATION + +--- + CMakeLists.txt | 2 ++ + plugins/ruby/CMakeLists.txt | 8 ++++++-- + plugins/ruby/ruby.cpp | 2 +- + plugins/ruby/{ruby.rb => ruby.rb.in} | 6 +++--- + 4 files changed, 12 insertions(+), 6 deletions(-) + rename plugins/ruby/{ruby.rb => ruby.rb.in} (97%) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 96a0808f..af96f986 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -165,6 +165,8 @@ SET(DFHACK_PLUGIN_DESTINATION hack/plugins CACHE INTERNAL "") + SET(DFHACK_INCLUDES_DESTINATION hack/include) + # dfhack lua files go here: + SET(DFHACK_LUA_DESTINATION hack/lua CACHE INTERNAL "") ++# dfhack ruby files go here: ++SET(DFHACK_RUBY_DESTINATION hack/ruby CACHE INTERNAL "") + # the windows .lib file goes here: + SET(DFHACK_DEVLIB_DESTINATION hack) + +diff --git a/plugins/ruby/CMakeLists.txt b/plugins/ruby/CMakeLists.txt +index 8272b5dd..ac8820f2 100644 +--- a/plugins/ruby/CMakeLists.txt ++++ b/plugins/ruby/CMakeLists.txt +@@ -77,7 +77,8 @@ INCLUDE_DIRECTORIES("${dfhack_SOURCE_DIR}/depends/tthread") + DFHACK_PLUGIN(ruby ruby.cpp LINK_LIBRARIES dfhack-tinythread) + ADD_DEPENDENCIES(ruby ruby-autogen-rb) + set_property( SOURCE "ruby.cpp" APPEND PROPERTY COMPILE_DEFINITIONS +- "DFHACK_LIBRARY_DESTINATION=\"${DFHACK_LIBRARY_DESTINATION}\"" ) ++ "DFHACK_LIBRARY_DESTINATION=\"${DFHACK_LIBRARY_DESTINATION}\"" ++ "DFHACK_RUBY_DESTINATION=\"${DFHACK_RUBY_DESTINATION}\"") + + IF(EXISTS ${RUBYLIB}) + INSTALL(FILES ${RUBYLIB} DESTINATION ${DFHACK_LIBRARY_DESTINATION} RENAME ${RUBYLIB_INSTALL_NAME}) +@@ -88,8 +89,11 @@ ELSE() + ENDIF() + ENDIF() + ++configure_file( ruby.rb.in ruby.rb @ONLY ) + INSTALL(DIRECTORY . +- DESTINATION hack/ruby ++ DESTINATION ${DFHACK_RUBY_DESTINATION} + FILES_MATCHING PATTERN "*.rb") ++INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/ruby.rb ++ DESTINATION ${DFHACK_RUBY_DESTINATION}) + + INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${RUBYAUTOGEN} DESTINATION hack/ruby) +diff --git a/plugins/ruby/ruby.cpp b/plugins/ruby/ruby.cpp +index 6bdd74fa..069159dc 100644 +--- a/plugins/ruby/ruby.cpp ++++ b/plugins/ruby/ruby.cpp +@@ -457,7 +457,7 @@ static void df_rubythread(void *p) + + // load the default ruby-level definitions in the background + state=0; +- rb_eval_string_protect("require './hack/ruby/ruby'", &state); ++ rb_eval_string_protect("require '" DFHACK_RUBY_DESTINATION "/ruby'", &state); + if (state) + dump_rb_error(); + +diff --git a/plugins/ruby/ruby.rb b/plugins/ruby/ruby.rb.in +similarity index 97% +rename from plugins/ruby/ruby.rb +rename to plugins/ruby/ruby.rb.in +index c696c23e..62be24c5 100644 +--- a/plugins/ruby/ruby.rb ++++ b/plugins/ruby/ruby.rb.in +@@ -251,8 +251,8 @@ def df + end + + # load autogenned file +-require './hack/ruby/ruby-autogen-defs' +-require(RUBY_PLATFORM =~ /mswin|mingw|cygwin/i ? './hack/ruby/ruby-autogen-win' : './hack/ruby/ruby-autogen-gcc') ++require '@DFHACK_RUBY_DESTINATION@/ruby-autogen-defs' ++require(RUBY_PLATFORM =~ /mswin|mingw|cygwin/i ? '@DFHACK_RUBY_DESTINATION@/ruby-autogen-win' : '@DFHACK_RUBY_DESTINATION@/ruby-autogen-gcc') + + # load all modules +-Dir['./hack/ruby/*.rb'].each { |m| require m.chomp('.rb') if m !~ /ruby-autogen/ } ++Dir['@DFHACK_RUBY_DESTINATION@/*.rb'].each { |m| require m.chomp('.rb') if m !~ /ruby-autogen/ } +-- +2.13.0 + |