summaryrefslogtreecommitdiff
path: root/games-util/dfhack/files/dfhack-0.40.24.2/07-startup-scripts-configurable.patch
diff options
context:
space:
mode:
Diffstat (limited to 'games-util/dfhack/files/dfhack-0.40.24.2/07-startup-scripts-configurable.patch')
-rw-r--r--games-util/dfhack/files/dfhack-0.40.24.2/07-startup-scripts-configurable.patch292
1 files changed, 292 insertions, 0 deletions
diff --git a/games-util/dfhack/files/dfhack-0.40.24.2/07-startup-scripts-configurable.patch b/games-util/dfhack/files/dfhack-0.40.24.2/07-startup-scripts-configurable.patch
new file mode 100644
index 00000000..447b6c9b
--- /dev/null
+++ b/games-util/dfhack/files/dfhack-0.40.24.2/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 021795b..766c604 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 4184a21..a08ef3a 100644
+--- a/library/CMakeLists.txt
++++ b/library/CMakeLists.txt
+@@ -314,10 +314,23 @@ IF(UNIX)
+ ENDIF(INSTALL_NEW_LIBSTDCXX)
+ 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 c31c1de..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="$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 "$@"
+- 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..021dfac
+--- /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="$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="$PRELOAD_LIB" setarch i386 -R valgrind $DF_HELGRIND_OPTS --tool=helgrind --log-file=helgrind.log "@DF_EXECUTABLE@" "$@"
++ ret=$?
++ ;;
++ -v | --valgrind)
++ shift
++ LD_PRELOAD="$PRELOAD_LIB" setarch i386 -R valgrind $DF_VALGRIND_OPTS --log-file=valgrind.log "@DF_EXECUTABLE@" "$@"
++ 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 "@DF_EXECUTABLE@" "$@"
++ ret=$?
++ ;;
++ *)
++ setarch i386 -R env LD_PRELOAD="$PRELOAD_LIB" "@DF_EXECUTABLE@" "$@"
++ 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! :)