diff options
author | eroen <eroen@occam.eroen.eu> | 2014-12-15 21:30:00 +0100 |
---|---|---|
committer | eroen <eroen@occam.eroen.eu> | 2014-12-15 21:30:30 +0100 |
commit | 3068d6b4e1390dd8cf920c46fe0f6e435bbf0d10 (patch) | |
tree | 5535f9853fd565e9ebbb370ad7ffe8ef40f7d455 /games-util | |
parent | libgraphics-40.19 - bump (diff) | |
download | eroen-3068d6b4e1390dd8cf920c46fe0f6e435bbf0d10.tar.gz eroen-3068d6b4e1390dd8cf920c46fe0f6e435bbf0d10.tar.bz2 eroen-3068d6b4e1390dd8cf920c46fe0f6e435bbf0d10.zip |
dfhack-0.40.19.1 - bump
Diffstat (limited to 'games-util')
13 files changed, 1341 insertions, 0 deletions
diff --git a/games-util/dfhack/dfhack-0.40.19.1.ebuild b/games-util/dfhack/dfhack-0.40.19.1.ebuild new file mode 120000 index 0000000..1f96891 --- /dev/null +++ b/games-util/dfhack/dfhack-0.40.19.1.ebuild @@ -0,0 +1 @@ +dfhack-0.40.13.1.ebuild
\ No newline at end of file diff --git a/games-util/dfhack/files/dfhack-0.40.19/01-compile-static-libraries-as.patch b/games-util/dfhack/files/dfhack-0.40.19/01-compile-static-libraries-as.patch new file mode 120000 index 0000000..948dd49 --- /dev/null +++ b/games-util/dfhack/files/dfhack-0.40.19/01-compile-static-libraries-as.patch @@ -0,0 +1 @@ +../dfhack-0.40.13/01-compile-static-libraries-as.patch
\ No newline at end of file diff --git a/games-util/dfhack/files/dfhack-0.40.19/02-drop-strange-build-options.patch b/games-util/dfhack/files/dfhack-0.40.19/02-drop-strange-build-options.patch new file mode 120000 index 0000000..31d6413 --- /dev/null +++ b/games-util/dfhack/files/dfhack-0.40.19/02-drop-strange-build-options.patch @@ -0,0 +1 @@ +../dfhack-0.40.13/02-drop-strange-build-options.patch
\ No newline at end of file diff --git a/games-util/dfhack/files/dfhack-0.40.19/03-configurable-install-paths.patch b/games-util/dfhack/files/dfhack-0.40.19/03-configurable-install-paths.patch new file mode 100644 index 0000000..226f845 --- /dev/null +++ b/games-util/dfhack/files/dfhack-0.40.19/03-configurable-install-paths.patch @@ -0,0 +1,96 @@ +configurable install paths + +From: eroen <eroen@occam.eroen.eu> + + +--- + CMakeLists.txt | 20 +++++++++++--------- + library/CMakeLists.txt | 6 +++--- + plugins/ruby/CMakeLists.txt | 4 ++-- + 3 files changed, 16 insertions(+), 14 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index c6654e0..45ebce6 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -68,30 +68,32 @@ add_definitions(-DDFHACK_VERSION="${DFHACK_VERSION}") + # the dfhack libraries will be installed here: + IF(UNIX) + # put the lib into DF/hack +- SET(DFHACK_LIBRARY_DESTINATION hack) +- SET(DFHACK_EGGY_DESTINATION libs) ++ SET(DFHACK_LIBRARY_DESTINATION hack CACHE PATH "DFHACK_LIBRARY_DESTINATION") ++ SET(DFHACK_EGGY_DESTINATION libs CACHE PATH "DFHACK_EGGY_DESTINATION") + 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_EGGY_DESTINATION .) + ENDIF() + # external tools will be installed here: +-SET(DFHACK_BINARY_DESTINATION .) ++SET(DFHACK_BINARY_DESTINATION . CACHE PATH "DFHACK_BINARY_DESTINATION") + # dfhack data goes here: +-SET(DFHACK_DATA_DESTINATION hack) ++SET(DFHACK_DATA_DESTINATION hack CACHE PATH "DFHACK_DATA_DESTINATION") + # plugin libs go here: +-SET(DFHACK_PLUGIN_DESTINATION hack/plugins) ++SET(DFHACK_PLUGIN_DESTINATION hack/plugins CACHE PATH "DFHACK_PLUGIN_DESTINATION") + # dfhack header files go here: +-SET(DFHACK_INCLUDES_DESTINATION hack/include) ++SET(DFHACK_INCLUDES_DESTINATION hack/include CACHE PATH "DFHACK_INCLUDES_DESTINATION") + # dfhack lua files go here: +-SET(DFHACK_LUA_DESTINATION hack/lua) ++SET(DFHACK_LUA_DESTINATION hack/lua CACHE PATH "DFHACK_LUA_DESTINATION") ++# dfhack ruby files go here: ++SET(DFHACK_RUBY_DESTINATION hack/ruby CACHE PATH "DFHACK_RUBY_DESTINATION") + # the windows .lib file goes here: + SET(DFHACK_DEVLIB_DESTINATION hack) + + # user documentation goes here: +-SET(DFHACK_USERDOC_DESTINATION hack) ++SET(DFHACK_USERDOC_DESTINATION hack CACHE PATH "DFHACK_USERDOC_DESTINATION") + # developer documentation goes here: +-SET(DFHACK_DEVDOC_DESTINATION hack) ++SET(DFHACK_DEVDOC_DESTINATION hack CACHE PATH "DFHACK_DEVDOC_DESTINATION") + + ## some options for the user/developer to play with + OPTION(BUILD_LIBRARY "Build the library that goes into DF." ON) +diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt +index 9317ac3..20bb2f6 100644 +--- a/library/CMakeLists.txt ++++ b/library/CMakeLists.txt +@@ -309,9 +309,9 @@ IF(UNIX) + else() + # On linux, copy our version of the df launch script which sets LD_PRELOAD + install(PROGRAMS ${dfhack_SOURCE_DIR}/package/linux/dfhack +- DESTINATION .) ++ DESTINATION ${DFHACK_BINARY_DESTINATION}) + install(PROGRAMS ${dfhack_SOURCE_DIR}/package/linux/dfhack-run +- DESTINATION .) ++ DESTINATION ${DFHACK_BINARY_DESTINATION}) + endif() + ELSE() + if(NOT BUILD_EGGY) +@@ -337,7 +337,7 @@ install(FILES xml/symbols.xml + DESTINATION ${DFHACK_DATA_DESTINATION}) #linux: share/dfhack + #install the example autoexec file + install(FILES ../dfhack.init-example +- DESTINATION ${DFHACK_BINARY_DESTINATION}) ++ DESTINATION ${DFHACK_USERDOC_DESTINATION}) + + install(TARGETS dfhack-run dfhack-client binpatch + LIBRARY DESTINATION ${DFHACK_LIBRARY_DESTINATION} +diff --git a/plugins/ruby/CMakeLists.txt b/plugins/ruby/CMakeLists.txt +index eaa08b1..914ebf4 100644 +--- a/plugins/ruby/CMakeLists.txt ++++ b/plugins/ruby/CMakeLists.txt +@@ -36,7 +36,7 @@ ADD_DEPENDENCIES(ruby ruby-autogen-rb) + INSTALL(FILES ${RUBYLIB} DESTINATION ${DFHACK_LIBRARY_DESTINATION}) + + INSTALL(DIRECTORY . +- DESTINATION hack/ruby ++ DESTINATION ${DFHACK_RUBY_DESTINATION} + FILES_MATCHING PATTERN "*.rb") + +-INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${RUBYAUTOGEN} DESTINATION hack/ruby) ++INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${RUBYAUTOGEN} DESTINATION ${DFHACK_RUBY_DESTINATION}) diff --git a/games-util/dfhack/files/dfhack-0.40.19/04-compile-time-configurable.patch b/games-util/dfhack/files/dfhack-0.40.19/04-compile-time-configurable.patch new file mode 100644 index 0000000..6c8b880 --- /dev/null +++ b/games-util/dfhack/files/dfhack-0.40.19/04-compile-time-configurable.patch @@ -0,0 +1,142 @@ +compile-time configurable paths + +From: eroen <eroen@occam.eroen.eu> + +./hack/symbols.xml +- Breaks startup + +./hack/lua +./hack/ruby +- Make noise on startup +--- + CMakeLists.txt | 4 ++++ + depends/lua/include/luaconf.h | 8 ++++++++ + library/Core.cpp | 6 +++++- + plugins/ruby/ruby.cpp | 8 ++++++++ + plugins/sort.cpp | 8 ++++++++ + 5 files changed, 33 insertions(+), 1 deletion(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 45ebce6..a167bcb 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -69,6 +69,7 @@ add_definitions(-DDFHACK_VERSION="${DFHACK_VERSION}") + IF(UNIX) + # put the lib into DF/hack + SET(DFHACK_LIBRARY_DESTINATION hack CACHE PATH "DFHACK_LIBRARY_DESTINATION") ++ ADD_DEFINITIONS(-DDFHACK_LIBRARY_DESTINATION="${DFHACK_LIBRARY_DESTINATION}") + SET(DFHACK_EGGY_DESTINATION libs CACHE PATH "DFHACK_EGGY_DESTINATION") + ELSE() + # windows is crap, therefore we can't do nice things with it. leave the libs on a nasty pile... +@@ -79,14 +80,17 @@ ENDIF() + SET(DFHACK_BINARY_DESTINATION . CACHE PATH "DFHACK_BINARY_DESTINATION") + # dfhack data goes here: + SET(DFHACK_DATA_DESTINATION hack CACHE PATH "DFHACK_DATA_DESTINATION") ++ADD_DEFINITIONS(-DDFHACK_DATA_DESTINATION="${DFHACK_DATA_DESTINATION}") + # plugin libs go here: + SET(DFHACK_PLUGIN_DESTINATION hack/plugins CACHE PATH "DFHACK_PLUGIN_DESTINATION") + # dfhack header files go here: + SET(DFHACK_INCLUDES_DESTINATION hack/include CACHE PATH "DFHACK_INCLUDES_DESTINATION") + # dfhack lua files go here: + SET(DFHACK_LUA_DESTINATION hack/lua CACHE PATH "DFHACK_LUA_DESTINATION") ++ADD_DEFINITIONS(-DDFHACK_LUA_DESTINATION="${DFHACK_LUA_DESTINATION}") + # dfhack ruby files go here: + SET(DFHACK_RUBY_DESTINATION hack/ruby CACHE PATH "DFHACK_RUBY_DESTINATION") ++ADD_DEFINITIONS(-DDFHACK_RUBY_DESTINATION="${DFHACK_RUBY_DESTINATION}") + # the windows .lib file goes here: + SET(DFHACK_DEVLIB_DESTINATION hack) + +diff --git a/depends/lua/include/luaconf.h b/depends/lua/include/luaconf.h +index af09ffb..b0e8a8a 100644 +--- a/depends/lua/include/luaconf.h ++++ b/depends/lua/include/luaconf.h +@@ -98,8 +98,16 @@ + + #else /* }{ */ + ++#ifdef DFHACK_LUA_DESTINATION ++#define LUA_LDIR DFHACK_LUA_DESTINATION "/" ++#else + #define LUA_LDIR "./hack/lua/" ++#endif ++#ifdef DFHACK_DATA_DESTINATION ++#define LUA_CDIR DFHACK_DATA_DESTINATION "/" ++#else + #define LUA_CDIR "./hack/" ++#endif + #define LUA_PATH_DEFAULT \ + LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" "./?.lua" + #define LUA_CPATH_DEFAULT \ +diff --git a/library/Core.cpp b/library/Core.cpp +index 29aba23..7a45bf2 100644 +--- a/library/Core.cpp ++++ b/library/Core.cpp +@@ -991,7 +991,11 @@ bool Core::Init() + + // find out what we are... + #ifdef LINUX_BUILD +- const char * path = "hack/symbols.xml"; ++ #ifdef DFHACK_DATA_DESTINATION ++ const char * path = DFHACK_DATA_DESTINATION "/symbols.xml"; ++ #else ++ const char * path = "hack/symbols.xml"; ++ #endif + #else + const char * path = "hack\\symbols.xml"; + #endif +diff --git a/plugins/ruby/ruby.cpp b/plugins/ruby/ruby.cpp +index 93d6501..789a031 100644 +--- a/plugins/ruby/ruby.cpp ++++ b/plugins/ruby/ruby.cpp +@@ -326,7 +326,11 @@ static int df_loadruby(void) + #elif defined(__APPLE__) + "/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/libruby.1.dylib"; + #else ++ #ifdef DFHACK_LIBRARY_DESTINATION ++ DFHACK_LIBRARY_DESTINATION "/libruby.so"; ++ #else + "hack/libruby.so"; ++ #endif + #endif + + libruby_handle = OpenPlugin(libpath); +@@ -434,7 +438,11 @@ static void df_rubythread(void *p) + + // load the default ruby-level definitions in the background + state=0; ++ #ifdef DFHACK_RUBY_DESTINATION ++ rb_eval_string_protect("require '" DFHACK_RUBY_DESTINATION "/ruby'", &state); ++ #else + rb_eval_string_protect("require './hack/ruby/ruby'", &state); ++ #endif + if (state) + dump_rb_error(); + +diff --git a/plugins/sort.cpp b/plugins/sort.cpp +index e4aad61..c386f5b 100644 +--- a/plugins/sort.cpp ++++ b/plugins/sort.cpp +@@ -64,7 +64,11 @@ DFhackCExport command_result plugin_init (color_ostream &out, std::vector <Plugi + " The '>' prefix reverses the sort order for defined values.\n" + " Unit order examples:\n" + " name, age, arrival, squad, squad_position, profession\n" ++ #ifdef DFHACK_LUA_DESTINATION ++ "The orderings are defined in " DFHACK_LUA_DESTINATION "/plugins/sort/*.lua\n" ++ #else + "The orderings are defined in hack/lua/plugins/sort/*.lua\n" ++ #endif + )); + commands.push_back(PluginCommand( + "sort-items", "Sort the visible item list.", sort_items, item_list_hotkey, +@@ -74,7 +78,11 @@ DFhackCExport command_result plugin_init (color_ostream &out, std::vector <Plugi + " The '>' prefix reverses the sort order for defined values.\n" + " Item order examples:\n" + " description, material, wear, type, quality\n" ++ #ifdef DFHACK_LUA_DESTINATION ++ "The orderings are defined in " DFHACK_LUA_DESTINATION "/plugins/sort/*.lua\n" ++ #else + "The orderings are defined in hack/lua/plugins/sort/*.lua\n" ++ #endif + )); + return CR_OK; + } diff --git a/games-util/dfhack/files/dfhack-0.40.19/05-compile-time-configurable-0.patch b/games-util/dfhack/files/dfhack-0.40.19/05-compile-time-configurable-0.patch new file mode 100644 index 0000000..11402c8 --- /dev/null +++ b/games-util/dfhack/files/dfhack-0.40.19/05-compile-time-configurable-0.patch @@ -0,0 +1,66 @@ +compile-time configurable paths + +From: eroen <eroen@occam.eroen.eu> + +hack/ +./ +--- + library/Core.cpp | 12 ++++++++++++ + plugins/zone.cpp | 2 ++ + 2 files changed, 14 insertions(+) + +diff --git a/library/Core.cpp b/library/Core.cpp +index 7a45bf2..4d714b6 100644 +--- a/library/Core.cpp ++++ b/library/Core.cpp +@@ -323,7 +323,11 @@ static command_result runRubyScript(color_ostream &out, PluginManager *plug_mgr, + rbcmd += "'" + args[i] + "', "; + rbcmd += "]\n"; + ++#ifdef DFHACK_DATA_DESTINATION ++ rbcmd += "catch(:script_finished) { load '" DFHACK_DATA_DESTINATION "/scripts/" + name + ".rb' }"; ++#else + rbcmd += "catch(:script_finished) { load './hack/scripts/" + name + ".rb' }"; ++#endif + + return plug_mgr->ruby->eval_ruby(out, rbcmd.c_str()); + } +@@ -411,7 +415,11 @@ string findScript(string path, string name) { + if (fileExists(file)) { + return file; + } ++ #ifdef DFHACK_DATA_DESTINATION ++ file = string(DFHACK_DATA_DESTINATION) + "/scripts/" + name; ++ #else + file = path + "/hack/scripts/" + name; ++ #endif + if (fileExists(file)) { + return file; + } +@@ -974,7 +982,11 @@ void Core::fatal (std::string output, bool deactivate) + std::string Core::getHackPath() + { + #ifdef LINUX_BUILD ++ #ifdef DFHACK_DATA_DESTINATION ++ return DFHACK_DATA_DESTINATION "/"; ++ #else + return p->getPath() + "/hack/"; ++ #endif + #else + return p->getPath() + "\\hack\\"; + #endif +diff --git a/plugins/zone.cpp b/plugins/zone.cpp +index c88e821..0ea0ec4 100644 +--- a/plugins/zone.cpp ++++ b/plugins/zone.cpp +@@ -3194,8 +3194,10 @@ command_result df_autobutcher(color_ostream &out, vector <string> & parameters) + { + string run = "dfhack-run autobutcher "; + #ifdef LINUX_BUILD ++#ifndef DFHACK_DATA_DESTINATION + run = "./dfhack-run autobutcher "; + #endif ++#endif + // force creation of config + out << run << "start" << endl; + diff --git a/games-util/dfhack/files/dfhack-0.40.19/06-compile-time-configurable-1.patch b/games-util/dfhack/files/dfhack-0.40.19/06-compile-time-configurable-1.patch new file mode 100644 index 0000000..4ab3921 --- /dev/null +++ b/games-util/dfhack/files/dfhack-0.40.19/06-compile-time-configurable-1.patch @@ -0,0 +1,104 @@ +compile-time configurable state directory + +From: eroen <eroen@occam.eroen.eu> + +It'd be nice to write stuff somewhere writeable. +--- + CMakeLists.txt | 4 ++++ + library/Console-posix.cpp | 4 ++++ + library/Core.cpp | 8 ++++++++ + library/Hooks-egg.cpp | 4 ++++ + library/Hooks-linux.cpp | 4 ++++ + 5 files changed, 24 insertions(+) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index a167bcb..ad36fdf 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -64,6 +64,10 @@ SET(DFHACK_RELEASE "r1" CACHE STRING "Current release revision.") + set(DFHACK_VERSION "${DF_VERSION}-${DFHACK_RELEASE}") + add_definitions(-DDFHACK_VERSION="${DFHACK_VERSION}") + ++## where persistent things are written (and read) at runtime ++SET(DFHACK_STATEDIR "." CACHE PATH "DFHACK_STATEDIR") ++ADD_DEFINITIONS(-DDFHACK_STATEDIR="${DFHACK_STATEDIR}") ++ + ## where to install things (after the build is done, classic 'make install' or package structure) + # the dfhack libraries will be installed here: + IF(UNIX) +diff --git a/library/Console-posix.cpp b/library/Console-posix.cpp +index fcc56b2..afbcd41 100644 +--- a/library/Console-posix.cpp ++++ b/library/Console-posix.cpp +@@ -744,7 +744,11 @@ bool Console::init(bool sharing) + inited = false; + return false; + } ++ #ifdef DFHACK_STATEDIR ++ if (!freopen(DFHACK_STATEDIR "/stdout.log", "w", stdout)) ++ #else + if (!freopen("stdout.log", "w", stdout)) ++ #endif + ; + d = new Private(); + // make our own weird streams so our IO isn't redirected +diff --git a/library/Core.cpp b/library/Core.cpp +index 4d714b6..73455d4 100644 +--- a/library/Core.cpp ++++ b/library/Core.cpp +@@ -883,7 +883,11 @@ void fIOthread(void * iodata) + PluginManager * plug_mgr = ((IODATA*) iodata)->plug_mgr; + + CommandHistory main_history; ++ #ifdef DFHACK_STATEDIR ++ main_history.load(DFHACK_STATEDIR "/dfhack.history"); ++ #else + main_history.load("dfhack.history"); ++ #endif + + Console & con = core->getConsole(); + if (plug_mgr == 0) +@@ -916,7 +920,11 @@ void fIOthread(void * iodata) + { + // a proper, non-empty command was entered + main_history.add(command); ++ #ifdef DFHACK_STATEDIR ++ main_history.save(DFHACK_STATEDIR "/dfhack.history"); ++ #else + main_history.save("dfhack.history"); ++ #endif + } + + auto rv = core->runCommand(con, command); +diff --git a/library/Hooks-egg.cpp b/library/Hooks-egg.cpp +index c98cf5d..90df6af 100644 +--- a/library/Hooks-egg.cpp ++++ b/library/Hooks-egg.cpp +@@ -37,7 +37,11 @@ distribution. + DFhackCExport int egg_init(void) + { + // reroute stderr ++ #ifdef DFHACK_STATEDIR ++ freopen(DFHACK_STATEDIR "/stderr.log", "w", stderr); ++ #else + freopen("stderr.log", "w", stderr); ++ #endif + // we don't reroute stdout until we figure out if this should be done at all + // See: Console-linux.cpp + fprintf(stderr,"dfhack: hooking successful\n"); +diff --git a/library/Hooks-linux.cpp b/library/Hooks-linux.cpp +index 31c0323..42d86f3 100644 +--- a/library/Hooks-linux.cpp ++++ b/library/Hooks-linux.cpp +@@ -114,7 +114,11 @@ static int (*_SDL_Init)(uint32_t flags) = 0; + DFhackCExport int SDL_Init(uint32_t flags) + { + // reroute stderr ++ #ifdef DFHACK_STATEDIR ++ freopen(DFHACK_STATEDIR "/stderr.log", "w", stderr); ++ #else + freopen("stderr.log", "w", stderr); ++ #endif + // we don't reroute stdout until we figure out if this should be done at all + // See: Console-linux.cpp + diff --git a/games-util/dfhack/files/dfhack-0.40.19/07-startup-scripts-configurable.patch b/games-util/dfhack/files/dfhack-0.40.19/07-startup-scripts-configurable.patch new file mode 100644 index 0000000..ca02a0a --- /dev/null +++ b/games-util/dfhack/files/dfhack-0.40.19/07-startup-scripts-configurable.patch @@ -0,0 +1,292 @@ +startup scripts - configurable paths + +From: eroen <eroen@occam.eroen.eu> + + +--- + CMakeLists.txt | 3 ++ + library/CMakeLists.txt | 13 +++++++ + package/linux/dfhack | 81 ------------------------------------------- + package/linux/dfhack-run | 8 ---- + package/linux/dfhack-run.in | 8 ++++ + package/linux/dfhack.in | 81 +++++++++++++++++++++++++++++++++++++++++++ + package/linux/egghack | 7 ---- + package/linux/egghack.in | 7 ++++ + 8 files changed, 112 insertions(+), 96 deletions(-) + delete mode 100755 package/linux/dfhack + delete mode 100755 package/linux/dfhack-run + create mode 100755 package/linux/dfhack-run.in + create mode 100755 package/linux/dfhack.in + delete mode 100755 package/linux/egghack + create mode 100755 package/linux/egghack.in + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index ad36fdf..068b4d5 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -68,6 +68,9 @@ add_definitions(-DDFHACK_VERSION="${DFHACK_VERSION}") + SET(DFHACK_STATEDIR "." CACHE PATH "DFHACK_STATEDIR") + ADD_DEFINITIONS(-DDFHACK_STATEDIR="${DFHACK_STATEDIR}") + ++## what to call to start DF, configured into startup scripts ++SET(DF_EXECUTABLE "./libs/Dwarf_Fortress" CACHE STRING "DF_EXECUTABLE") ++ + ## where to install things (after the build is done, classic 'make install' or package structure) + # the dfhack libraries will be installed here: + IF(UNIX) +diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt +index 20bb2f6..24149ec 100644 +--- a/library/CMakeLists.txt ++++ b/library/CMakeLists.txt +@@ -308,10 +308,23 @@ IF(UNIX) + DESTINATION .) + else() + # On linux, copy our version of the df launch script which sets LD_PRELOAD ++ configure_file(${dfhack_SOURCE_DIR}/package/linux/dfhack.in ++ ${dfhack_SOURCE_DIR}/package/linux/dfhack ++ @ONLY) ++ configure_file(${dfhack_SOURCE_DIR}/package/linux/dfhack-run.in ++ ${dfhack_SOURCE_DIR}/package/linux/dfhack-run ++ @ONLY) ++ configure_file(${dfhack_SOURCE_DIR}/package/linux/egghack.in ++ ${dfhack_SOURCE_DIR}/package/linux/egghack ++ @ONLY) + install(PROGRAMS ${dfhack_SOURCE_DIR}/package/linux/dfhack + DESTINATION ${DFHACK_BINARY_DESTINATION}) + install(PROGRAMS ${dfhack_SOURCE_DIR}/package/linux/dfhack-run + DESTINATION ${DFHACK_BINARY_DESTINATION}) ++ if(BUILD_EGGY) ++ install(PROGRAMS ${dfhack_SOURCE_DIR}/package/linux/egghack ++ DESTINATION ${DFHACK_BINARY_DESTINATION}) ++ endif() + endif() + ELSE() + if(NOT BUILD_EGGY) +diff --git a/package/linux/dfhack b/package/linux/dfhack +deleted file mode 100755 +index 44677d8..0000000 +--- a/package/linux/dfhack ++++ /dev/null +@@ -1,81 +0,0 @@ +-#!/bin/sh +- +-# NOTE: This is dfhack's modification of the normal invocation script, +-# changed to properly set LD_PRELOAD so as to run DFHACK. +-# +-# You can run DF under gdb by passing -g or --gdb as the first argument. +-# +-# If the file ".dfhackrc" exists in the DF directory or your home directory +-# it will be sourced by this script, to let you set environmental variables. +-# If it exists in both places it will first source the one in your home +-# directory, then the on in the game directory. +-# +-# Shell variables .dfhackrc can set to affect this script: +-# DF_GDB_OPTS: Options to pass to gdb, if it's being run +-# DF_VALGRIND_OPTS: Options to pass to valgrind, if it's being run +-# DF_HELGRIND_OPTS: Options to pass to helgrind, if it's being run +-# DF_POST_CMD: Shell command to be run at very end of script +- +-DF_DIR=$(dirname "$0") +-cd "${DF_DIR}" +-export SDL_DISABLE_LOCK_KEYS=1 # Work around for bug in Debian/Ubuntu SDL patch. +-#export SDL_VIDEO_CENTERED=1 # Centre the screen. Messes up resizing. +- +-# User config files +-RC=".dfhackrc" +- +-if [ -r "$HOME/$RC" ]; then +- . $HOME/$RC +-fi +-if [ -r "./$RC" ]; then +- . "./$RC" +-fi +- +-# Save current terminal settings +-old_tty_settings=$(stty -g) +- +-# Now run +- +-export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"./hack/libs":"./hack" +- +-PRELOAD_LIB=./hack/libdfhack.so +- +-case "$1" in +- -g | --gdb) +- shift +- echo "set environment LD_PRELOAD=$PRELOAD_LIB" > gdbcmd.tmp +- echo "set environment MALLOC_PERTURB_=45" >> gdbcmd.tmp +- gdb $DF_GDB_OPTS -x gdbcmd.tmp ./libs/Dwarf_Fortress "$@" +- rm gdbcmd.tmp +- ret=$? +- ;; +- -h | --helgrind) +- shift +- LD_PRELOAD=$PRELOAD_LIB setarch i386 -R valgrind $DF_HELGRIND_OPTS --tool=helgrind --log-file=helgrind.log ./libs/Dwarf_Fortress "$@" +- ret=$? +- ;; +- -v | --valgrind) +- shift +- LD_PRELOAD=$PRELOAD_LIB setarch i386 -R valgrind $DF_VALGRIND_OPTS --log-file=valgrind.log ./libs/Dwarf_Fortress "$@" +- ret=$? +- ;; +- -c | --callgrind) +- shift +- LD_PRELOAD=$PRELOAD_LIB setarch i386 -R valgrind $DF_CALLGRIND_OPTS --tool=callgrind --separate-threads=yes --dump-instr=yes --instr-atstart=no --log-file=callgrind.log ./libs/Dwarf_Fortress "$@" +- ret=$? +- ;; +- *) +- setarch i386 -R env LD_PRELOAD=$PRELOAD_LIB ./libs/Dwarf_Fortress "$@" 2>&1 | tee dfhack.log +- ret=$? +- ;; +-esac +- +-# Restore previous terminal settings +-stty "$old_tty_settings" +-echo +- +-if [ -n "$DF_POST_CMD" ]; then +- eval $DF_POST_CMD +-fi +- +-exit $ret +diff --git a/package/linux/dfhack-run b/package/linux/dfhack-run +deleted file mode 100755 +index 55001cf..0000000 +--- a/package/linux/dfhack-run ++++ /dev/null +@@ -1,8 +0,0 @@ +-#!/bin/sh +- +-DF_DIR=$(dirname "$0") +-cd "${DF_DIR}" +- +-export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"./hack/libs":"./hack" +- +-exec hack/dfhack-run "$@" +diff --git a/package/linux/dfhack-run.in b/package/linux/dfhack-run.in +new file mode 100755 +index 0000000..f013053 +--- /dev/null ++++ b/package/linux/dfhack-run.in +@@ -0,0 +1,8 @@ ++#!/bin/sh ++ ++DF_DIR=$(dirname "$0") ++cd "${DF_DIR}" ++ ++export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}":"@DFHACK_LIBRARY_DESTINATION@"/libs:"@DFHACK_LIBRARY_DESTINATION@" ++ ++exec "@DFHACK_LIBRARY_DESTINATION@"/dfhack-run "${@}" +diff --git a/package/linux/dfhack.in b/package/linux/dfhack.in +new file mode 100755 +index 0000000..c8eccaa +--- /dev/null ++++ b/package/linux/dfhack.in +@@ -0,0 +1,81 @@ ++#!/bin/sh ++ ++# NOTE: This is dfhack's modification of the normal invocation script, ++# changed to properly set LD_PRELOAD so as to run DFHACK. ++# ++# You can run DF under gdb by passing -g or --gdb as the first argument. ++# ++# If the file ".dfhackrc" exists in the DF directory or your home directory ++# it will be sourced by this script, to let you set environmental variables. ++# If it exists in both places it will first source the one in your home ++# directory, then the on in the game directory. ++# ++# Shell variables .dfhackrc can set to affect this script: ++# DF_GDB_OPTS: Options to pass to gdb, if it's being run ++# DF_VALGRIND_OPTS: Options to pass to valgrind, if it's being run ++# DF_HELGRIND_OPTS: Options to pass to helgrind, if it's being run ++# DF_POST_CMD: Shell command to be run at very end of script ++ ++DF_DIR=$(dirname "$0") ++cd "${DF_DIR}" ++export SDL_DISABLE_LOCK_KEYS=1 # Work around for bug in Debian/Ubuntu SDL patch. ++#export SDL_VIDEO_CENTERED=1 # Centre the screen. Messes up resizing. ++ ++# User config files ++RC=".dfhackrc" ++ ++if [ -r "$HOME/$RC" ]; then ++ . $HOME/$RC ++fi ++if [ -r "./$RC" ]; then ++ . "./$RC" ++fi ++ ++# Save current terminal settings ++old_tty_settings=$(stty -g) ++ ++# Now run ++ ++export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}":"@DFHACK_LIBRARY_DESTINATION@"/libs:"@DFHACK_LIBRARY_DESTINATION@" ++ ++PRELOAD_LIB="@DFHACK_LIBRARY_DESTINATION@"/libdfhack.so ++ ++case "$1" in ++ -g | --gdb) ++ shift ++ echo "set environment LD_PRELOAD=@DFHACK_LIBRARY_DESTINATION@/libdfhack.so" > gdbcmd.tmp ++ echo "set environment MALLOC_PERTURB_=45" >> gdbcmd.tmp ++ gdb ${DF_GDB_OPTS} -x gdbcmd.tmp "@DF_EXECUTABLE@" "${@}" ++ rm gdbcmd.tmp ++ ret=$? ++ ;; ++ -h | --helgrind) ++ shift ++ LD_PRELOAD="@DFHACK_LIBRARY_DESTINATION@"/libdfhack.so setarch i386 -R valgrind ${DF_HELGRIND_OPTS} --tool=helgrind --log-file=helgrind.log "@DF_EXECUTABLE@" "${@}" ++ ret=$? ++ ;; ++ -v | --valgrind) ++ shift ++ LD_PRELOAD="@DFHACK_LIBRARY_DESTINATION@"/libdfhack.so setarch i386 -R valgrind ${DF_VALGRIND_OPTS} --log-file=valgrind.log "@DF_EXECUTABLE@" "${@}" ++ ret=$? ++ ;; ++ -c | --callgrind) ++ shift ++ LD_PRELOAD="@DFHACK_LIBRARY_DESTINATION@"/libdfhack.so setarch i386 -R valgrind ${DF_CALLGRIND_OPTS} --tool=callgrind --separate-threads=yes --dump-instr=yes --instr-atstart=no --log-file=callgrind.log "@DF_EXECUTABLE@" "${@}" ++ ret=$? ++ ;; ++ *) ++ setarch i386 -R env LD_PRELOAD=$PRELOAD_LIB "@DF_EXECUTABLE@" "$@" 2>&1 | tee dfhack.log ++ ret=$? ++ ;; ++esac ++ ++# Restore previous terminal settings ++stty "$old_tty_settings" ++echo ++ ++if [ -n "$DF_POST_CMD" ]; then ++ eval $DF_POST_CMD ++fi ++ ++exit $ret +diff --git a/package/linux/egghack b/package/linux/egghack +deleted file mode 100755 +index 5b3b03b..0000000 +--- a/package/linux/egghack ++++ /dev/null +@@ -1,7 +0,0 @@ +-#!/bin/sh +-DF_DIR=$(dirname "$0") +-cd "${DF_DIR}" +-export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"./hack/libs":"./hack" +-export SDL_DISABLE_LOCK_KEYS=1 # Work around for bug in Debian/Ubuntu SDL patch. +-#export SDL_VIDEO_CENTERED=1 # Centre the screen. Messes up resizing. +-./libs/Dwarf_Fortress $* # Go, go, go! :) +diff --git a/package/linux/egghack.in b/package/linux/egghack.in +new file mode 100755 +index 0000000..4bf4c9d +--- /dev/null ++++ b/package/linux/egghack.in +@@ -0,0 +1,7 @@ ++#!/bin/sh ++DF_DIR=$(dirname "$0") ++cd "${DF_DIR}" ++export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}":"@DFHACK_LIBRARY_DESTINATION@"/libs:"@DFHACK_LIBRARY_DESTINATION@" ++export SDL_DISABLE_LOCK_KEYS=1 # Work around for bug in Debian/Ubuntu SDL patch. ++#export SDL_VIDEO_CENTERED=1 # Centre the screen. Messes up resizing. ++"@DF_EXECUTABLE@" ${*} # Go, go, go! :) diff --git a/games-util/dfhack/files/dfhack-0.40.19/08-ruby-plugin-configurable-paths.patch b/games-util/dfhack/files/dfhack-0.40.19/08-ruby-plugin-configurable-paths.patch new file mode 100644 index 0000000..3dd547b --- /dev/null +++ b/games-util/dfhack/files/dfhack-0.40.19/08-ruby-plugin-configurable-paths.patch @@ -0,0 +1,541 @@ +ruby plugin - configurable paths + +From: eroen <eroen@occam.eroen.eu> + + +--- + plugins/ruby/CMakeLists.txt | 4 + + plugins/ruby/ruby.rb | 247 ------------------------------------------- + plugins/ruby/ruby.rb.in | 247 +++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 251 insertions(+), 247 deletions(-) + delete mode 100644 plugins/ruby/ruby.rb + create mode 100644 plugins/ruby/ruby.rb.in + +diff --git a/plugins/ruby/CMakeLists.txt b/plugins/ruby/CMakeLists.txt +index 914ebf4..836eb82 100644 +--- a/plugins/ruby/CMakeLists.txt ++++ b/plugins/ruby/CMakeLists.txt +@@ -28,6 +28,8 @@ ADD_CUSTOM_COMMAND( + ) + ADD_CUSTOM_TARGET(ruby-autogen-rb DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${RUBYAUTOGEN}) + ++CONFIGURE_FILE(ruby.rb.in ruby.rb @ONLY) ++ + INCLUDE_DIRECTORIES("${dfhack_SOURCE_DIR}/depends/tthread") + + DFHACK_PLUGIN(ruby ruby.cpp LINK_LIBRARIES dfhack-tinythread) +@@ -35,6 +37,8 @@ ADD_DEPENDENCIES(ruby ruby-autogen-rb) + + INSTALL(FILES ${RUBYLIB} DESTINATION ${DFHACK_LIBRARY_DESTINATION}) + ++INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/ruby.rb DESTINATION ${DFHACK_RUBY_DESTINATION}) ++ + INSTALL(DIRECTORY . + DESTINATION ${DFHACK_RUBY_DESTINATION} + FILES_MATCHING PATTERN "*.rb") +diff --git a/plugins/ruby/ruby.rb b/plugins/ruby/ruby.rb +deleted file mode 100644 +index 850ca09..0000000 +--- a/plugins/ruby/ruby.rb ++++ /dev/null +@@ -1,247 +0,0 @@ +-# redefine standard i/o methods to use the dfhack console +-module Kernel +- def puts(*a) +- a.flatten.each { |l| +- DFHack.print_str(l.to_s.chomp + "\n") +- } +- nil +- end +- +- def puts_err(*a) +- a.flatten.each { |l| +- DFHack.print_err(l.to_s.chomp + "\n") +- } +- nil +- end +- +- def p(*a) +- a.each { |e| +- puts_err e.inspect +- } +- nil +- end +-end +- +-module DFHack +- VERSION = version +- +- class OnupdateCallback +- attr_accessor :callback, :timelimit, :minyear, :minyeartick, :description +- def initialize(descr, cb, tl, initdelay=0) +- @description = descr +- @callback = cb +- @ticklimit = tl +- @minyear = (tl ? df.cur_year : 0) +- @minyeartick = (tl ? df.cur_year_tick+initdelay : 0) +- end +- +- # run callback if timedout +- def check_run(year, yeartick, yearlen) +- if @ticklimit +- return unless year > @minyear or (year == @minyear and yeartick >= @minyeartick) +- @minyear = year +- @minyeartick = yeartick + @ticklimit +- if @minyeartick > yearlen +- @minyear += 1 +- @minyeartick -= yearlen +- end +- end +- # t0 = Time.now +- @callback.call +- # dt = Time.now - t0 ; puts "rb cb #@description took #{'%.02f' % dt}s" if dt > 0.1 +- rescue Exception +- df.onupdate_unregister self +- puts_err "onupdate #@description unregistered: #$!", $!.backtrace +- end +- +- def <=>(o) +- [@minyear, @minyeartick] <=> [o.minyear, o.minyeartick] +- end +- end +- +- class << self +- attr_accessor :onupdate_list, :onstatechange_list +- +- # register a callback to be called every gframe or more +- # ex: DFHack.onupdate_register('fastdwarf') { DFHack.world.units[0].counters.job_counter = 0 } +- # if ticklimit is given, do not call unless this much game ticks have passed. Handles advmode time stretching. +- def onupdate_register(descr, ticklimit=nil, initialtickdelay=0, &b) +- raise ArgumentError, 'need a description as 1st arg' unless descr.kind_of?(::String) +- @onupdate_list ||= [] +- @onupdate_list << OnupdateCallback.new(descr, b, ticklimit, initialtickdelay) +- DFHack.onupdate_active = true +- if onext = @onupdate_list.sort.first +- DFHack.onupdate_minyear = onext.minyear +- DFHack.onupdate_minyeartick = onext.minyeartick +- end +- @onupdate_list.last +- end +- +- # delete the callback for onupdate ; use the value returned by onupdate_register or the description +- def onupdate_unregister(b) +- b = @onupdate_list.find { |bb| bb.description == b } if b.kind_of?(String) +- @onupdate_list.delete b +- if @onupdate_list.empty? +- DFHack.onupdate_active = false +- DFHack.onupdate_minyear = DFHack.onupdate_minyeartick = DFHack.onupdate_minyeartickadv = -1 +- end +- end +- +- # same as onupdate_register, but remove the callback once it returns true +- def onupdate_register_once(*a) +- handle = onupdate_register(*a) { +- onupdate_unregister(handle) if yield +- } +- end +- +- TICKS_PER_YEAR = 1200*28*12 +- # this method is called by ruby.cpp if df.onupdate_active is true +- def onupdate +- @onupdate_list ||= [] +- +- y = cur_year +- ytmax = TICKS_PER_YEAR +- if df.gamemode == :ADVENTURE and df.respond_to?(:cur_year_tick_advmode) +- yt = cur_year_tick_advmode +- ytmax *= 144 +- else +- yt = cur_year_tick +- end +- +- @onupdate_list.each { |o| +- o.check_run(y, yt, ytmax) +- } +- +- if onext = @onupdate_list.sort.first +- DFHack.onupdate_minyear = onext.minyear +- if ytmax > TICKS_PER_YEAR +- DFHack.onupdate_minyeartick = -1 +- DFHack.onupdate_minyeartickadv = onext.minyeartick +- else +- DFHack.onupdate_minyeartick = onext.minyeartick +- DFHack.onupdate_minyeartickadv = -1 +- end +- end +- end +- +- # register a callback to be called every gframe or more +- # ex: DFHack.onstatechange_register { |newstate| puts "state changed to #{newstate}" } +- def onstatechange_register(&b) +- @onstatechange_list ||= [] +- @onstatechange_list << b +- @onstatechange_list.last +- end +- +- # delete the callback for onstatechange ; use the value returned by onstatechange_register +- def onstatechange_unregister(b) +- @onstatechange_list.delete b +- end +- +- # same as onstatechange_register, but auto-unregisters if the block returns true +- def onstatechange_register_once +- handle = onstatechange_register { |st| +- onstatechange_unregister(handle) if yield(st) +- } +- end +- +- +- # this method is called by dfhack every 'onstatechange' +- def onstatechange(newstate) +- @onstatechange_list ||= [] +- @onstatechange_list.each { |cb| cb.call(newstate) } +- end +- +- # return true if the argument is under the cursor +- def at_cursor?(obj) +- same_pos?(obj, cursor) +- end +- +- # returns true if both arguments are at the same x/y/z +- def same_pos?(pos1, pos2) +- pos1 = pos1.pos if pos1.respond_to?(:pos) +- pos2 = pos2.pos if pos2.respond_to?(:pos) +- pos1.x == pos2.x and pos1.y == pos2.y and pos1.z == pos2.z +- end +- +- # try to match a user-specified name to one from the raws +- # uses case-switching and substring matching +- # eg match_rawname('coal', ['COAL_BITUMINOUS', 'BAUXITE']) => 'COAL_BITUMINOUS' +- def match_rawname(name, rawlist) +- rawlist.each { |r| return r if name == r } +- rawlist.each { |r| return r if name.downcase == r.downcase } +- may = rawlist.find_all { |r| r.downcase.index(name.downcase) } +- may.first if may.length == 1 +- end +- +- def translate_name(name, english=true, onlylastpart=false) +- out = [] +- +- if not onlylastpart +- out << name.first_name if name.first_name != '' +- if name.nickname != '' +- case respond_to?(:d_init) && d_init.nickname[gametype] +- when :REPLACE_ALL; return "`#{name.nickname}'" +- when :REPLACE_FIRST; out.pop +- end +- out << "`#{name.nickname}'" +- end +- end +- return out.join(' ') unless name.words.find { |w| w >= 0 } +- +- if not english +- tsl = world.raws.language.translations[name.language] +- if name.words[0] >= 0 or name.words[1] >= 0 +- out << '' +- out.last << tsl.words[name.words[0]] if name.words[0] >= 0 +- out.last << tsl.words[name.words[1]] if name.words[1] >= 0 +- end +- if name.words[5] >= 0 +- out << '' +- (2..5).each { |i| out.last << tsl.words[name.words[i]] if name.words[i] >= 0 } +- end +- if name.words[6] >= 0 +- out << tsl.words[name.words[6]] +- end +- else +- wl = world.raws.language +- if name.words[0] >= 0 or name.words[1] >= 0 +- out << '' +- out.last << wl.words[name.words[0]].forms[name.parts_of_speech[0]] if name.words[0] >= 0 +- out.last << wl.words[name.words[1]].forms[name.parts_of_speech[1]] if name.words[1] >= 0 +- end +- if name.words[5] >= 0 +- out << 'the' +- out.last.capitalize! if out.length == 1 +- out << wl.words[name.words[2]].forms[name.parts_of_speech[2]] if name.words[2] >= 0 +- out << wl.words[name.words[3]].forms[name.parts_of_speech[3]] if name.words[3] >= 0 +- if name.words[4] >= 0 +- out << wl.words[name.words[4]].forms[name.parts_of_speech[4]] +- out.last << '-' +- else +- out << '' +- end +- out.last << wl.words[name.words[5]].forms[name.parts_of_speech[5]] +- end +- if name.words[6] >= 0 +- out << 'of' +- out.last.capitalize! if out.length == 1 +- out << wl.words[name.words[6]].forms[name.parts_of_speech[6]] +- end +- end +- +- out.join(' ') +- end +- end +-end +- +-# global alias so we can write 'df.world.units.all[0]' +-def df +- DFHack +-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') +- +-# load all modules +-Dir['./hack/ruby/*.rb'].each { |m| require m.chomp('.rb') if m !~ /ruby-autogen/ } +diff --git a/plugins/ruby/ruby.rb.in b/plugins/ruby/ruby.rb.in +new file mode 100644 +index 0000000..c458e19 +--- /dev/null ++++ b/plugins/ruby/ruby.rb.in +@@ -0,0 +1,247 @@ ++# redefine standard i/o methods to use the dfhack console ++module Kernel ++ def puts(*a) ++ a.flatten.each { |l| ++ DFHack.print_str(l.to_s.chomp + "\n") ++ } ++ nil ++ end ++ ++ def puts_err(*a) ++ a.flatten.each { |l| ++ DFHack.print_err(l.to_s.chomp + "\n") ++ } ++ nil ++ end ++ ++ def p(*a) ++ a.each { |e| ++ puts_err e.inspect ++ } ++ nil ++ end ++end ++ ++module DFHack ++ VERSION = version ++ ++ class OnupdateCallback ++ attr_accessor :callback, :timelimit, :minyear, :minyeartick, :description ++ def initialize(descr, cb, tl, initdelay=0) ++ @description = descr ++ @callback = cb ++ @ticklimit = tl ++ @minyear = (tl ? df.cur_year : 0) ++ @minyeartick = (tl ? df.cur_year_tick+initdelay : 0) ++ end ++ ++ # run callback if timedout ++ def check_run(year, yeartick, yearlen) ++ if @ticklimit ++ return unless year > @minyear or (year == @minyear and yeartick >= @minyeartick) ++ @minyear = year ++ @minyeartick = yeartick + @ticklimit ++ if @minyeartick > yearlen ++ @minyear += 1 ++ @minyeartick -= yearlen ++ end ++ end ++ # t0 = Time.now ++ @callback.call ++ # dt = Time.now - t0 ; puts "rb cb #@description took #{'%.02f' % dt}s" if dt > 0.1 ++ rescue Exception ++ df.onupdate_unregister self ++ puts_err "onupdate #@description unregistered: #$!", $!.backtrace ++ end ++ ++ def <=>(o) ++ [@minyear, @minyeartick] <=> [o.minyear, o.minyeartick] ++ end ++ end ++ ++ class << self ++ attr_accessor :onupdate_list, :onstatechange_list ++ ++ # register a callback to be called every gframe or more ++ # ex: DFHack.onupdate_register('fastdwarf') { DFHack.world.units[0].counters.job_counter = 0 } ++ # if ticklimit is given, do not call unless this much game ticks have passed. Handles advmode time stretching. ++ def onupdate_register(descr, ticklimit=nil, initialtickdelay=0, &b) ++ raise ArgumentError, 'need a description as 1st arg' unless descr.kind_of?(::String) ++ @onupdate_list ||= [] ++ @onupdate_list << OnupdateCallback.new(descr, b, ticklimit, initialtickdelay) ++ DFHack.onupdate_active = true ++ if onext = @onupdate_list.sort.first ++ DFHack.onupdate_minyear = onext.minyear ++ DFHack.onupdate_minyeartick = onext.minyeartick ++ end ++ @onupdate_list.last ++ end ++ ++ # delete the callback for onupdate ; use the value returned by onupdate_register or the description ++ def onupdate_unregister(b) ++ b = @onupdate_list.find { |bb| bb.description == b } if b.kind_of?(String) ++ @onupdate_list.delete b ++ if @onupdate_list.empty? ++ DFHack.onupdate_active = false ++ DFHack.onupdate_minyear = DFHack.onupdate_minyeartick = DFHack.onupdate_minyeartickadv = -1 ++ end ++ end ++ ++ # same as onupdate_register, but remove the callback once it returns true ++ def onupdate_register_once(*a) ++ handle = onupdate_register(*a) { ++ onupdate_unregister(handle) if yield ++ } ++ end ++ ++ TICKS_PER_YEAR = 1200*28*12 ++ # this method is called by ruby.cpp if df.onupdate_active is true ++ def onupdate ++ @onupdate_list ||= [] ++ ++ y = cur_year ++ ytmax = TICKS_PER_YEAR ++ if df.gamemode == :ADVENTURE and df.respond_to?(:cur_year_tick_advmode) ++ yt = cur_year_tick_advmode ++ ytmax *= 144 ++ else ++ yt = cur_year_tick ++ end ++ ++ @onupdate_list.each { |o| ++ o.check_run(y, yt, ytmax) ++ } ++ ++ if onext = @onupdate_list.sort.first ++ DFHack.onupdate_minyear = onext.minyear ++ if ytmax > TICKS_PER_YEAR ++ DFHack.onupdate_minyeartick = -1 ++ DFHack.onupdate_minyeartickadv = onext.minyeartick ++ else ++ DFHack.onupdate_minyeartick = onext.minyeartick ++ DFHack.onupdate_minyeartickadv = -1 ++ end ++ end ++ end ++ ++ # register a callback to be called every gframe or more ++ # ex: DFHack.onstatechange_register { |newstate| puts "state changed to #{newstate}" } ++ def onstatechange_register(&b) ++ @onstatechange_list ||= [] ++ @onstatechange_list << b ++ @onstatechange_list.last ++ end ++ ++ # delete the callback for onstatechange ; use the value returned by onstatechange_register ++ def onstatechange_unregister(b) ++ @onstatechange_list.delete b ++ end ++ ++ # same as onstatechange_register, but auto-unregisters if the block returns true ++ def onstatechange_register_once ++ handle = onstatechange_register { |st| ++ onstatechange_unregister(handle) if yield(st) ++ } ++ end ++ ++ ++ # this method is called by dfhack every 'onstatechange' ++ def onstatechange(newstate) ++ @onstatechange_list ||= [] ++ @onstatechange_list.each { |cb| cb.call(newstate) } ++ end ++ ++ # return true if the argument is under the cursor ++ def at_cursor?(obj) ++ same_pos?(obj, cursor) ++ end ++ ++ # returns true if both arguments are at the same x/y/z ++ def same_pos?(pos1, pos2) ++ pos1 = pos1.pos if pos1.respond_to?(:pos) ++ pos2 = pos2.pos if pos2.respond_to?(:pos) ++ pos1.x == pos2.x and pos1.y == pos2.y and pos1.z == pos2.z ++ end ++ ++ # try to match a user-specified name to one from the raws ++ # uses case-switching and substring matching ++ # eg match_rawname('coal', ['COAL_BITUMINOUS', 'BAUXITE']) => 'COAL_BITUMINOUS' ++ def match_rawname(name, rawlist) ++ rawlist.each { |r| return r if name == r } ++ rawlist.each { |r| return r if name.downcase == r.downcase } ++ may = rawlist.find_all { |r| r.downcase.index(name.downcase) } ++ may.first if may.length == 1 ++ end ++ ++ def translate_name(name, english=true, onlylastpart=false) ++ out = [] ++ ++ if not onlylastpart ++ out << name.first_name if name.first_name != '' ++ if name.nickname != '' ++ case respond_to?(:d_init) && d_init.nickname[gametype] ++ when :REPLACE_ALL; return "`#{name.nickname}'" ++ when :REPLACE_FIRST; out.pop ++ end ++ out << "`#{name.nickname}'" ++ end ++ end ++ return out.join(' ') unless name.words.find { |w| w >= 0 } ++ ++ if not english ++ tsl = world.raws.language.translations[name.language] ++ if name.words[0] >= 0 or name.words[1] >= 0 ++ out << '' ++ out.last << tsl.words[name.words[0]] if name.words[0] >= 0 ++ out.last << tsl.words[name.words[1]] if name.words[1] >= 0 ++ end ++ if name.words[5] >= 0 ++ out << '' ++ (2..5).each { |i| out.last << tsl.words[name.words[i]] if name.words[i] >= 0 } ++ end ++ if name.words[6] >= 0 ++ out << tsl.words[name.words[6]] ++ end ++ else ++ wl = world.raws.language ++ if name.words[0] >= 0 or name.words[1] >= 0 ++ out << '' ++ out.last << wl.words[name.words[0]].forms[name.parts_of_speech[0]] if name.words[0] >= 0 ++ out.last << wl.words[name.words[1]].forms[name.parts_of_speech[1]] if name.words[1] >= 0 ++ end ++ if name.words[5] >= 0 ++ out << 'the' ++ out.last.capitalize! if out.length == 1 ++ out << wl.words[name.words[2]].forms[name.parts_of_speech[2]] if name.words[2] >= 0 ++ out << wl.words[name.words[3]].forms[name.parts_of_speech[3]] if name.words[3] >= 0 ++ if name.words[4] >= 0 ++ out << wl.words[name.words[4]].forms[name.parts_of_speech[4]] ++ out.last << '-' ++ else ++ out << '' ++ end ++ out.last << wl.words[name.words[5]].forms[name.parts_of_speech[5]] ++ end ++ if name.words[6] >= 0 ++ out << 'of' ++ out.last.capitalize! if out.length == 1 ++ out << wl.words[name.words[6]].forms[name.parts_of_speech[6]] ++ end ++ end ++ ++ out.join(' ') ++ end ++ end ++end ++ ++# global alias so we can write 'df.world.units.all[0]' ++def df ++ DFHack ++end ++ ++# load autogenned file ++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['@DFHACK_RUBY_DESTINATION@/*.rb'].each { |m| require m.chomp('.rb') if m !~ /ruby-autogen/ } diff --git a/games-util/dfhack/files/dfhack-0.40.19/09-eggy-remove-annoying-banner.patch b/games-util/dfhack/files/dfhack-0.40.19/09-eggy-remove-annoying-banner.patch new file mode 100644 index 0000000..c3ada17 --- /dev/null +++ b/games-util/dfhack/files/dfhack-0.40.19/09-eggy-remove-annoying-banner.patch @@ -0,0 +1,22 @@ +eggy - remove annoying banner + +From: eroen <eroen@occam.eroen.eu> + + +--- + library/Core.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/library/Core.cpp b/library/Core.cpp +index 73455d4..e4c4788 100644 +--- a/library/Core.cpp ++++ b/library/Core.cpp +@@ -1113,7 +1113,7 @@ bool Core::Init() + // set up hotkey capture + thread * HK = new thread(fHKthread, (void *) temp); + screen_window = new Windows::top_level_window(); +- screen_window->addChild(new Windows::dfhack_dummy(5,10)); ++ //screen_window->addChild(new Windows::dfhack_dummy(5,10)); + started = true; + + cerr << "Starting the TCP listener.\n"; diff --git a/games-util/dfhack/files/dfhack-0.40.19/10-unbreak-egg.patch b/games-util/dfhack/files/dfhack-0.40.19/10-unbreak-egg.patch new file mode 100644 index 0000000..0d23872 --- /dev/null +++ b/games-util/dfhack/files/dfhack-0.40.19/10-unbreak-egg.patch @@ -0,0 +1,24 @@ +Unbreak egg + +From: eroen <eroen@occam.eroen.eu> + +See: + commit fc24d24ccc2147fff61e309bcb2167b9709249b6 + Merge Console-linux and Console-darwin into Console-posix +--- + library/CMakeLists.txt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt +index 24149ec..50ac9f2 100644 +--- a/library/CMakeLists.txt ++++ b/library/CMakeLists.txt +@@ -99,7 +99,7 @@ Hooks-darwin.cpp + ) + + SET(MAIN_SOURCES_LINUX_EGGY +-Console-linux.cpp ++Console-posix.cpp + Hooks-egg.cpp + PlugLoad-linux.cpp + Process-linux.cpp diff --git a/games-util/dfhack/files/dfhack-0.40.19/11-dfhack-init-example.patch b/games-util/dfhack/files/dfhack-0.40.19/11-dfhack-init-example.patch new file mode 100644 index 0000000..0225d38 --- /dev/null +++ b/games-util/dfhack/files/dfhack-0.40.19/11-dfhack-init-example.patch @@ -0,0 +1,39 @@ +dfhack.init.example + +From: eroen <eroen@occam.eroen.eu> + + +--- + library/CMakeLists.txt | 2 +- + library/Core.cpp | 4 ++++ + 2 files changed, 5 insertions(+), 1 deletion(-) + +diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt +index 50ac9f2..eac23db 100644 +--- a/library/CMakeLists.txt ++++ b/library/CMakeLists.txt +@@ -350,7 +350,7 @@ install(FILES xml/symbols.xml + DESTINATION ${DFHACK_DATA_DESTINATION}) #linux: share/dfhack + #install the example autoexec file + install(FILES ../dfhack.init-example +- DESTINATION ${DFHACK_USERDOC_DESTINATION}) ++ DESTINATION ${DFHACK_DATA_DESTINATION}) + + install(TARGETS dfhack-run dfhack-client binpatch + LIBRARY DESTINATION ${DFHACK_LIBRARY_DESTINATION} +diff --git a/library/Core.cpp b/library/Core.cpp +index e4c4788..cfbc5d4 100644 +--- a/library/Core.cpp ++++ b/library/Core.cpp +@@ -861,7 +861,11 @@ static void run_dfhack_init(color_ostream &out, Core *core) + if (!core->loadScriptFile(out, "dfhack.init", true)) + { + core->runCommand(out, "gui/no-dfhack-init"); ++#ifdef DFHACK_DATA_DESTINATION ++ core->loadScriptFile(out, DFHACK_DATA_DESTINATION "/dfhack.init-example", true); ++#else + core->loadScriptFile(out, "dfhack.init-example", true); ++#endif + } + } + diff --git a/games-util/dfhack/files/dfhack-0.40.19/series b/games-util/dfhack/files/dfhack-0.40.19/series new file mode 100644 index 0000000..daacc4a --- /dev/null +++ b/games-util/dfhack/files/dfhack-0.40.19/series @@ -0,0 +1,12 @@ +# This series applies on GIT commit 10fa55570ec46de0bb9b958b940887072531f65f +01-compile-static-libraries-as.patch +02-drop-strange-build-options.patch +03-configurable-install-paths.patch +04-compile-time-configurable.patch +05-compile-time-configurable-0.patch +06-compile-time-configurable-1.patch +07-startup-scripts-configurable.patch +08-ruby-plugin-configurable-paths.patch +09-eggy-remove-annoying-banner.patch +10-unbreak-egg.patch +11-dfhack-init-example.patch |