diff options
Diffstat (limited to 'games-util/dfhack/files/dfhack-9999/06-compile-time-configurable-1.patch')
| -rw-r--r-- | games-util/dfhack/files/dfhack-9999/06-compile-time-configurable-1.patch | 104 |
1 files changed, 0 insertions, 104 deletions
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 084059b7..00000000 --- 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 - |
