diff options
author | eroen <eroen@occam.eroen.eu> | 2014-08-13 23:20:31 +0200 |
---|---|---|
committer | eroen <eroen@occam.eroen.eu> | 2014-08-14 11:15:40 +0200 |
commit | c0bdd80eacb9c64f82aad901be2faea6f906e61b (patch) | |
tree | dddc798bed7078cd6589ac30f4ff231b78eaec0e /games-util | |
parent | dfhack - move patches around a bit (diff) | |
download | eroen-c0bdd80eacb9c64f82aad901be2faea6f906e61b.tar.gz eroen-c0bdd80eacb9c64f82aad901be2faea6f906e61b.tar.bz2 eroen-c0bdd80eacb9c64f82aad901be2faea6f906e61b.zip |
dfhack - remove old patches
Diffstat (limited to 'games-util')
10 files changed, 0 insertions, 1358 deletions
diff --git a/games-util/dfhack/files/dfhack-9999/01-compile-static-libraries-as.patch b/games-util/dfhack/files/dfhack-9999/01-compile-static-libraries-as.patch deleted file mode 100644 index 2166a50..0000000 --- a/games-util/dfhack/files/dfhack-9999/01-compile-static-libraries-as.patch +++ /dev/null @@ -1,65 +0,0 @@ -Compile static libraries as PIC. - -From: eroen <eroen@occam.eroen.eu> - -Otherwise, we get position dependent textrels in the shared libraries -that link against them, which is slightly bad for performance (and very -bad for portability). - -Cross-platform support for handling this was added in cmake 2.8.9. ---- - CMakeLists.txt | 2 +- - depends/md5/CMakeLists.txt | 3 ++- - depends/tinyxml/CMakeLists.txt | 3 ++- - depends/tthread/CMakeLists.txt | 3 ++- - 4 files changed, 7 insertions(+), 4 deletions(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index c7c84e8..abff6a8 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -11,7 +11,7 @@ else(CMAKE_CONFIGURATION_TYPES) - endif(CMAKE_CONFIGURATION_TYPES) - - ## some generic CMake magic --cmake_minimum_required(VERSION 2.8 FATAL_ERROR) -+cmake_minimum_required(VERSION 2.8.9 FATAL_ERROR) - project(dfhack) - - if(MSVC) -diff --git a/depends/md5/CMakeLists.txt b/depends/md5/CMakeLists.txt -index 69e0cf0..df14e3c 100644 ---- a/depends/md5/CMakeLists.txt -+++ b/depends/md5/CMakeLists.txt -@@ -1,3 +1,4 @@ - project(dfhack-md5) - ADD_LIBRARY(dfhack-md5 STATIC EXCLUDE_FROM_ALL md5.cpp md5wrapper.cpp) --IDE_FOLDER(dfhack-md5 "Depends") -\ No newline at end of file -+set_target_properties(dfhack-md5 PROPERTIES POSITION_INDEPENDENT_CODE True) -+IDE_FOLDER(dfhack-md5 "Depends") -diff --git a/depends/tinyxml/CMakeLists.txt b/depends/tinyxml/CMakeLists.txt -index 7d92492..f97f4bc 100644 ---- a/depends/tinyxml/CMakeLists.txt -+++ b/depends/tinyxml/CMakeLists.txt -@@ -1,3 +1,4 @@ - project(dfhack-tinyxml) - ADD_LIBRARY(dfhack-tinyxml STATIC EXCLUDE_FROM_ALL tinystr.cpp tinyxml.cpp tinyxmlerror.cpp tinyxmlparser.cpp) --IDE_FOLDER(dfhack-tinyxml "Depends") -\ No newline at end of file -+set_target_properties(dfhack-tinyxml PROPERTIES POSITION_INDEPENDENT_CODE True) -+IDE_FOLDER(dfhack-tinyxml "Depends") -diff --git a/depends/tthread/CMakeLists.txt b/depends/tthread/CMakeLists.txt -index d34c19c..2757a6e 100644 ---- a/depends/tthread/CMakeLists.txt -+++ b/depends/tthread/CMakeLists.txt -@@ -1,6 +1,7 @@ - PROJECT(dfhack-tinythread) - ADD_LIBRARY(dfhack-tinythread STATIC EXCLUDE_FROM_ALL tinythread.cpp) -+set_target_properties(dfhack-tinythread PROPERTIES POSITION_INDEPENDENT_CODE True) - if(UNIX) - target_link_libraries(dfhack-tinythread pthread) - endif() --IDE_FOLDER(dfhack-tinythread "Depends") -\ No newline at end of file -+IDE_FOLDER(dfhack-tinythread "Depends") diff --git a/games-util/dfhack/files/dfhack-9999/02-drop-strange-build-options.patch b/games-util/dfhack/files/dfhack-9999/02-drop-strange-build-options.patch deleted file mode 100644 index cedac0f..0000000 --- a/games-util/dfhack/files/dfhack-9999/02-drop-strange-build-options.patch +++ /dev/null @@ -1,52 +0,0 @@ -drop strange build options - -From: eroen <eroen@occam.eroen.eu> - - ---- - CMakeLists.txt | 4 ++-- - depends/lua/CMakeLists.txt | 2 +- - library/CMakeLists.txt | 2 +- - 3 files changed, 4 insertions(+), 4 deletions(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index abff6a8..194eec7 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -105,8 +105,8 @@ OPTION(BUILD_PLUGINS "Build the plugins." ON) - IF(UNIX) - add_definitions(-DLINUX_BUILD) - SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g -Wall -Wno-unused-variable") -- SET(CMAKE_CXX_FLAGS "-fvisibility=hidden -m32 -march=i686 -mtune=generic -std=c++0x") -- SET(CMAKE_C_FLAGS "-fvisibility=hidden -m32 -march=i686 -mtune=generic") -+ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -std=c++0x") -+ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden") - ELSEIF(MSVC) - # for msvc, tell it to always use 8-byte pointers to member functions to avoid confusion - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /vmg /vmm /MP") -diff --git a/depends/lua/CMakeLists.txt b/depends/lua/CMakeLists.txt -index b77bce6..e39eb04 100644 ---- a/depends/lua/CMakeLists.txt -+++ b/depends/lua/CMakeLists.txt -@@ -12,7 +12,7 @@ ENDIF() - - IF(UNIX) - add_definitions(-DLINUX_BUILD) -- SET(CMAKE_C_FLAGS "-m32") -+ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") - ENDIF() - - SET (HDR_LIBLUA -diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt -index 64dafd5..2538360 100644 ---- a/library/CMakeLists.txt -+++ b/library/CMakeLists.txt -@@ -216,7 +216,7 @@ ADD_CUSTOM_TARGET(generate_headers DEPENDS ${dfapi_SOURCE_DIR}/include/df/codege - IF(UNIX) - # Don't produce debug info for generated stubs - SET_SOURCE_FILES_PROPERTIES(DataStatics.cpp DataStaticsCtor.cpp DataStaticsFields.cpp -- PROPERTIES COMPILE_FLAGS "-g0 -O1") -+ PROPERTIES COMPILE_FLAGS "-g0") - ELSE(WIN32) - SET_SOURCE_FILES_PROPERTIES(DataStatics.cpp DataStaticsCtor.cpp DataStaticsFields.cpp - PROPERTIES COMPILE_FLAGS "/O1 /bigobj") diff --git a/games-util/dfhack/files/dfhack-9999/03-configurable-install-paths.patch b/games-util/dfhack/files/dfhack-9999/03-configurable-install-paths.patch deleted file mode 100644 index 35c957e..0000000 --- a/games-util/dfhack/files/dfhack-9999/03-configurable-install-paths.patch +++ /dev/null @@ -1,96 +0,0 @@ -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 194eec7..4f196c9 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 2538360..18635ed 100644 ---- a/library/CMakeLists.txt -+++ b/library/CMakeLists.txt -@@ -302,9 +302,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) -@@ -330,7 +330,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 9d821f9..e6d3eff 100644 ---- a/plugins/ruby/CMakeLists.txt -+++ b/plugins/ruby/CMakeLists.txt -@@ -35,7 +35,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}/ruby-autogen.rb DESTINATION hack/ruby) -+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/ruby-autogen.rb DESTINATION ${DFHACK_RUBY_DESTINATION}) diff --git a/games-util/dfhack/files/dfhack-9999/04-compile-time-configurable.patch b/games-util/dfhack/files/dfhack-9999/04-compile-time-configurable.patch deleted file mode 100644 index 1c12d3b..0000000 --- a/games-util/dfhack/files/dfhack-9999/04-compile-time-configurable.patch +++ /dev/null @@ -1,142 +0,0 @@ -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 4f196c9..77a8d97 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 766752f..c73e094 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 2021a8b..e72decd 100644 ---- a/library/Core.cpp -+++ b/library/Core.cpp -@@ -879,7 +879,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 69b9b15..534ad9f 100644 ---- a/plugins/ruby/ruby.cpp -+++ b/plugins/ruby/ruby.cpp -@@ -315,7 +315,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); -@@ -418,7 +422,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 95ae109..510e288 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-9999/05-compile-time-configurable-0.patch b/games-util/dfhack/files/dfhack-9999/05-compile-time-configurable-0.patch deleted file mode 100644 index c35d8e3..0000000 --- a/games-util/dfhack/files/dfhack-9999/05-compile-time-configurable-0.patch +++ /dev/null @@ -1,54 +0,0 @@ -compile-time configurable paths - -From: eroen <eroen@occam.eroen.eu> - -hack/ -./ ---- - library/Core.cpp | 8 ++++++++ - plugins/zone.cpp | 2 ++ - 2 files changed, 10 insertions(+) - -diff --git a/library/Core.cpp b/library/Core.cpp -index e72decd..89130a9 100644 ---- a/library/Core.cpp -+++ b/library/Core.cpp -@@ -317,7 +317,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->eval_ruby(out, rbcmd.c_str()); - } -@@ -862,7 +866,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 5649da2..e89419a 100644 ---- a/plugins/zone.cpp -+++ b/plugins/zone.cpp -@@ -3177,8 +3177,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-9999/06-compile-time-configurable-1.patch b/games-util/dfhack/files/dfhack-9999/06-compile-time-configurable-1.patch deleted file mode 100644 index 084059b..0000000 --- a/games-util/dfhack/files/dfhack-9999/06-compile-time-configurable-1.patch +++ /dev/null @@ -1,104 +0,0 @@ -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-linux.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 77a8d97..73a4ac1 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -64,6 +64,10 @@ SET(DFHACK_RELEASE "r3" 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-linux.cpp b/library/Console-linux.cpp -index f32fa1c..be8d13b 100644 ---- a/library/Console-linux.cpp -+++ b/library/Console-linux.cpp -@@ -658,7 +658,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 89130a9..978fccd 100644 ---- a/library/Core.cpp -+++ b/library/Core.cpp -@@ -769,7 +769,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 || core == 0) -@@ -802,7 +806,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-9999/07-startup-scripts-configurable.patch b/games-util/dfhack/files/dfhack-9999/07-startup-scripts-configurable.patch deleted file mode 100644 index 28fbf71..0000000 --- a/games-util/dfhack/files/dfhack-9999/07-startup-scripts-configurable.patch +++ /dev/null @@ -1,288 +0,0 @@ -startup scripts - configurable paths - -From: eroen <eroen@occam.eroen.eu> - - ---- - CMakeLists.txt | 3 ++ - library/CMakeLists.txt | 13 +++++++ - package/linux/dfhack | 79 ------------------------------------------- - package/linux/dfhack-run | 8 ---- - package/linux/dfhack-run.in | 8 ++++ - package/linux/dfhack.in | 79 +++++++++++++++++++++++++++++++++++++++++++ - package/linux/egghack | 7 ---- - package/linux/egghack.in | 7 ++++ - 8 files changed, 110 insertions(+), 94 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 73a4ac1..031a2cd 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 18635ed..11a17ff 100644 ---- a/library/CMakeLists.txt -+++ b/library/CMakeLists.txt -@@ -301,10 +301,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 5ddd2a1..0000000 ---- a/package/linux/dfhack -+++ /dev/null -@@ -1,79 +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" -- --case "$1" in -- -g | --gdb) -- shift -- echo "set environment LD_PRELOAD=./hack/libdfhack.so" > 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=./hack/libdfhack.so setarch i386 -R valgrind $DF_HELGRIND_OPTS --tool=helgrind --log-file=helgrind.log ./libs/Dwarf_Fortress "$@" -- ret=$? -- ;; -- -v | --valgrind) -- shift -- LD_PRELOAD=./hack/libdfhack.so setarch i386 -R valgrind $DF_VALGRIND_OPTS --log-file=valgrind.log ./libs/Dwarf_Fortress "$@" -- ret=$? -- ;; -- -c | --callgrind) -- shift -- LD_PRELOAD=./hack/libdfhack.so 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=./hack/libdfhack.so ./libs/Dwarf_Fortress "$@" -- ret=$? -- ;; --esac -- --# Restore previous terminal settings --stty "$old_tty_settings" --echo -e "\n" -- --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..a969708 ---- /dev/null -+++ b/package/linux/dfhack.in -@@ -0,0 +1,79 @@ -+#!/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@" -+ -+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="@DFHACK_LIBRARY_DESTINATION@"/libdfhack.so "@DF_EXECUTABLE@" "${@}" -+ ret=$? -+ ;; -+esac -+ -+# Restore previous terminal settings -+stty "$old_tty_settings" -+echo -e "\n" -+ -+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-9999/08-ruby-plugin-configurable-paths.patch b/games-util/dfhack/files/dfhack-9999/08-ruby-plugin-configurable-paths.patch deleted file mode 100644 index 4753133..0000000 --- a/games-util/dfhack/files/dfhack-9999/08-ruby-plugin-configurable-paths.patch +++ /dev/null @@ -1,525 +0,0 @@ -ruby plugin - configurable paths - -From: eroen <eroen@occam.eroen.eu> - - ---- - plugins/ruby/CMakeLists.txt | 4 + - plugins/ruby/ruby.rb | 239 ------------------------------------------- - plugins/ruby/ruby.rb.in | 239 +++++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 243 insertions(+), 239 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 e6d3eff..b282751 100644 ---- a/plugins/ruby/CMakeLists.txt -+++ b/plugins/ruby/CMakeLists.txt -@@ -27,6 +27,8 @@ ADD_CUSTOM_COMMAND( - ) - ADD_CUSTOM_TARGET(ruby-autogen-rb DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/ruby-autogen.rb) - -+CONFIGURE_FILE(ruby.rb.in ruby.rb @ONLY) -+ - INCLUDE_DIRECTORIES("${dfhack_SOURCE_DIR}/depends/tthread") - - DFHACK_PLUGIN(ruby ruby.cpp LINK_LIBRARIES dfhack-tinythread) -@@ -34,6 +36,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 47924dc..0000000 ---- a/plugins/ruby/ruby.rb -+++ /dev/null -@@ -1,239 +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_dwarf -- 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 -- (2..5).each { |i| out.last << wl.words[name.words[i]].forms[name.parts_of_speech[i]] if name.words[i] >= 0 } -- 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 './hack/ruby/ruby-autogen' -- --# load all modules --Dir['./hack/ruby/*.rb'].each { |m| require m.chomp('.rb') } -diff --git a/plugins/ruby/ruby.rb.in b/plugins/ruby/ruby.rb.in -new file mode 100644 -index 0000000..2ae169c ---- /dev/null -+++ b/plugins/ruby/ruby.rb.in -@@ -0,0 +1,239 @@ -+# 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_dwarf -+ 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 -+ (2..5).each { |i| out.last << wl.words[name.words[i]].forms[name.parts_of_speech[i]] if name.words[i] >= 0 } -+ 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 '@DFHACK_RUBY_DESTINATION@/ruby-autogen' -+ -+# load all modules -+Dir['@DFHACK_RUBY_DESTINATION@/*.rb'].each { |m| require m.chomp('.rb') } diff --git a/games-util/dfhack/files/dfhack-9999/09-eggy-remove-annoying-banner.patch b/games-util/dfhack/files/dfhack-9999/09-eggy-remove-annoying-banner.patch deleted file mode 100644 index f2c4ce1..0000000 --- a/games-util/dfhack/files/dfhack-9999/09-eggy-remove-annoying-banner.patch +++ /dev/null @@ -1,22 +0,0 @@ -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 978fccd..3b10bce 100644 ---- a/library/Core.cpp -+++ b/library/Core.cpp -@@ -986,7 +986,7 @@ bool Core::Init() - HotkeyCond = new condition_variable(); - 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-9999/series b/games-util/dfhack/files/dfhack-9999/series deleted file mode 100644 index ea00d57..0000000 --- a/games-util/dfhack/files/dfhack-9999/series +++ /dev/null @@ -1,10 +0,0 @@ -# This series applies on GIT commit 18a91ef221f531307ac5ddbe29532a3d6e0a04ec -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 |