summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--games-util/dfhack/dfhack-0.40.13.1.ebuild279
l---------games-util/dfhack/files/dfhack-0.40.131
l---------games-util/dfhack/files/dfhack-0.40.13/01-compile-static-libraries-as.patch1
l---------games-util/dfhack/files/dfhack-0.40.13/02-drop-strange-build-options.patch1
l---------games-util/dfhack/files/dfhack-0.40.13/03-configurable-install-paths.patch1
l---------games-util/dfhack/files/dfhack-0.40.13/04-compile-time-configurable.patch1
l---------games-util/dfhack/files/dfhack-0.40.13/05-compile-time-configurable-0.patch1
l---------games-util/dfhack/files/dfhack-0.40.13/06-compile-time-configurable-1.patch1
-rw-r--r--games-util/dfhack/files/dfhack-0.40.13/07-startup-scripts-configurable.patch292
l---------games-util/dfhack/files/dfhack-0.40.13/08-ruby-plugin-configurable-paths.patch1
l---------games-util/dfhack/files/dfhack-0.40.13/09-eggy-remove-annoying-banner.patch1
l---------games-util/dfhack/files/dfhack-0.40.13/10-unbreak-egg.patch1
l---------games-util/dfhack/files/dfhack-0.40.13/11-dfhack-init-example.patch1
13 files changed, 581 insertions, 1 deletions
diff --git a/games-util/dfhack/dfhack-0.40.13.1.ebuild b/games-util/dfhack/dfhack-0.40.13.1.ebuild
new file mode 100644
index 00000000..a94486f8
--- /dev/null
+++ b/games-util/dfhack/dfhack-0.40.13.1.ebuild
@@ -0,0 +1,279 @@
+# By eroen, 2012-2014
+#
+# Permission to use, copy, modify, and/or distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# $Header: $
+
+EAPI=5
+inherit base eutils multilib git-r3 cmake-utils games
+
+df_PV=${PV%.${PV#*.*.*.}}
+df_PV=${df_PV#0.}
+df_PV=${df_PV%%_*}
+
+DESCRIPTION="Memory hacking library for Dwarf Fortress and a set of tools that
+use it"
+HOMEPAGE="http://github.com/DFHack/dfhack"
+EGIT_REPO_URI="git://github.com/DFHack/dfhack.git"
+#EGIT_BRANCH=
+EGIT_COMMIT=${PV%.${PV#*.*.*.}}-r${PV#*.*.*.} # 0.40.08.2 -> 0.40.08-r2
+SRC_URI="http://cloud.github.com/downloads/jjyg/dfhack/libruby187.tar.gz"
+
+KEYWORDS="~amd64" # ~x86
+
+CMAKE_MIN_VERSION=2.8.9
+CMAKE_REMOVE_MODULES_LIST="FindCurses FindDoxygen CMakeVS10FindMake"
+
+LICENSE="ZLIB MIT BSD-2"
+SLOT=${df_PV}
+IUSE="api dfusion doc egg isoworld minimal stonesense"
+
+HDEPEND="
+ dev-perl/XML-LibXML
+ dev-perl/XML-LibXSLT
+ doc? ( app-doc/doxygen )
+ "
+LIBRARY_DEPEND="
+ || ( sys-libs/zlib[abi_x86_32]
+ ( sys-libs/zlib
+ app-emulation/emul-linux-x86-baselibs ) )
+ stonesense? ( media-libs/fontconfig[abi_x86_32]
+ app-emulation/emul-linux-x86-baselibs[development]
+ media-libs/freetype[abi_x86_32]
+ x11-libs/libICE[abi_x86_32]
+ x11-libs/libSM[abi_x86_32]
+ x11-libs/libX11[abi_x86_32]
+ x11-libs/libXcursor[abi_x86_32]
+ x11-libs/libXext[abi_x86_32]
+ x11-libs/libXinerama[abi_x86_32]
+ x11-libs/libXrandr[abi_x86_32]
+ )
+ "
+DEPEND="${LIBRARY_DEPEND}
+ ${HDEPEND}"
+RDEPEND="${LIBRARY_DEPEND}
+ stonesense? ( app-emulation/emul-linux-x86-opengl
+ app-emulation/emul-linux-x86-xlibs
+ )
+ "
+# Circular dependency when building egg.
+PDEPEND="~games-simulation/dwarffortress-${df_PV}"
+
+## missing multilib
+#dev-lang/lua - binary bundled
+#dev-libs/protobuf - bundled
+## stonesense
+#allegro - binary bundled
+# dev-libs/atk (libatk-1.0.so.0) - gtklibs
+# dev-libs/glib (libgthread-2.0.so.0,libglib-2.0.so.0,libgobject-2.0.so.0,libgmodule-2.0.so.0,libgio-2.0.so.0) - baselibs
+# media-libs/fontconfig (libfontconfig.so.1)
+# media-libs/freetype (libfreetype.so.6)
+# media-libs/jpeg:62 (libjpeg.so.62) - baselibs
+# virtual/glu (libGLU.so.1) - opengl
+# media-libs/libpng:1.2 (libpng12.so.0) - baselibs
+# virtual/opengl (libGL.so.1)
+# sys-libs/zlib (libz.so.1) - baselibs
+# x11-libs/cairo (libcairo.so.2) - gtklibs
+# x11-libs/gdk-pixbuf (libgdk_pixbuf) - gtklibs
+# x11-libs/gtk+ (libgdk-x11-2.0.so.0,libgtk-x11-2.0.so.0) - gtklibs
+# x11-libs/libICE (libICE.so.6)
+# x11-libs/libSM (libSM.so.6)
+# x11-libs/libX11 (libX11.so.6)
+# x11-libs/libXcursor (libXcursor.so.1)
+# x11-libs/libXext (libXext.so.6)
+# x11-libs/libXinerama (libXinerama.so.1)
+# x11-libs/libXrandr (libXrandr.so.2)
+# x11-libs/pango (libpangocairo-1.0.so.0,libpango-1.0.so.0,libpangoft2-1.0.so.0) - gtklibs
+
+pkg_setup() {
+ multilib_toolchain_setup x86
+
+ df_executable="dwarffortress-${df_PV}"
+ dfhack_datadir="${GAMES_DATADIR}/${P}"
+ dfhack_docdir="/usr/share/doc/${P}"
+ dfhack_statedir="${GAMES_STATEDIR}/${P}"
+
+ dfhack_libdir=$(games_get_libdir)/dwarffortress-${df_PV}
+
+ QA_FLAGS_IGNORED=("${dfhack_libdir#/}"/libruby.so)
+ QA_PRESTRIPPED=("${dfhack_libdir#/}"/libruby.so)
+ QA_SONAME_NO_SYMLINK=("${dfhack_libdir#/}"/libruby.so)
+}
+
+src_unpack() {
+ git-r3_src_unpack
+ unpack ${A}
+ mv "${WORKDIR}"/libruby1.8.so.1.8.7 "${WORKDIR}"/libruby.so || die
+}
+
+src_prepare() {
+ # rm -r patches-master-$(date -I)/
+ # stg export -n -d patches-master-$(date -I) -e patch
+ # rm /usr/local/portage/games-util/dfhack/files/dfhack-0.40.06.9999/*
+ # cp patches-master-$(date -I)/* /usr/local/portage/games-util/dfhack/files/dfhack-0.40.06.9999/
+ epatch "${FILESDIR}"/${PN}-0.${df_PV}/*.patch
+
+ pushd "${S}"/depends/clsocket
+ epatch "${FILESDIR}"/clsocket/0001-Compile-static-library-as-PIC.patch
+ popd
+
+ #if use stonesense; then
+ # pushd "${S}"/plugins/stonesense
+ # epatch "${FILESDIR}"/stonesense-${PV}/01-null-isn-t-an-int32.patch
+ # epatch "${FILESDIR}"/stonesense-${PV}/02-configurable-install-paths.patch
+ # epatch "${FILESDIR}"/stonesense-${PV}/03-don-t-segfault-if-logfile-is.patch
+ # epatch "${FILESDIR}"/stonesense-${PV}/04-compile-time-configuration-of.patch
+ # epatch "${FILESDIR}"/stonesense-${PV}/05-compile-time-configurable-log.patch
+ # epatch "${FILESDIR}"/stonesense-${PV}/06-fix-b0rked-xml-file.patch
+ # epatch "${FILESDIR}"/stonesense-${PV}/07-compile-time-configurable-dump.patch
+ # epatch "${FILESDIR}"/stonesense-${PV}/08-compile-time-configurable.patch
+ # # Patches that no longer fit upstream, not updated yet.
+ # #epatch "${FILESDIR}"/stonesense/0003-screenshots-in-home-dir.patch
+ # popd
+ #fi
+ #if use isoworld; then
+ # pushd "${S}"/plugins/isoworld
+ # epatch "${FILESDIR}"/isoworld-${PV}/01-missing-include-dir.patch
+ # popd
+ # ewarn "The isoworld plugin requires agui, and will probably fail to build"
+ #fi
+
+ # Fix other scripts
+# if use dfusion; then
+# sed -f - -i plugins/Dfusion/luafiles/{init.lua,friendship/{init.lua,plugin.lua,install.lua},triggers/{plugin.lua,functions_menu.lua},friendship_civ/init.lua,common.lua,embark/{init.lua,plugin.lua},migrants/{init.lua,plugin.lua},xml_struct.lua,xml_types.lua} <<- EOF || die
+# s:("dfusion/:("${datadir}/dfusion/:
+# s:('dfusion/:('${datadir}/dfusion/:
+# EOF
+# sed -i "s:libs/Dwarf_Fortress:Dwarf_Fortress:" plugins/Dfusion/luafiles/common.lua
+# fi
+
+ ##Issues:
+ # - dfusion is strange. It's always been that, though.
+ # - prebuilt ruby
+ # - bundled lua
+ # - isoworld requires agui
+ # - prebuilt allegro for stonesense.
+ # - stonesense conf file: /usr/share/games/dfhack-9999/stonesense/init.txt
+ # Set in ./Config.cpp, installed together with the rest of the directory.
+ # - output files
+ # - - Make symlinks to (unversioned) /var
+
+ # Doesn't build:
+ sed -e '/autolabor2/d' \
+ -e '/rprobe/d' \
+ -i plugins/devel/CMakeLists.txt || die
+}
+
+src_configure() {
+ # cmake -Wno-dev -LA .. | grep -v '^--' | sed -e 's/:\S*=/=/' -e 's/.*/"-D&"/'
+ mycmakeargs=(
+ #"-DBUILD_DEVEL=OFF"
+ "$(cmake-utils_use_build api DEVEL)"
+ #"-DBUILD_DEV_PLUGINS=OFF"
+ "$(cmake-utils_use_build !minimal DEV_PLUGINS)"
+ #"-DBUILD_DFUSION=ON"
+ "$(cmake-utils_use_build dfusion DFUSION)"
+ #"-DBUILD_DOXYGEN=OFF"
+ "$(cmake-utils_use_build doc DOXYGEN)"
+ #"-DBUILD_DWARFEXPORT=ON"
+ "$(cmake-utils_use_build !minimal DWARFEXPORT)"
+ #"-DBUILD_EGGY=OFF"
+ "$(cmake-utils_use_build egg EGGY)"
+ #"-DBUILD_ISOWORLD=OFF"
+ "$(cmake-utils_use_build isoworld ISOWORLD)"
+ "-DBUILD_LIBRARY=ON"
+ #"-DBUILD_MAPEXPORT=ON"
+ "$(cmake-utils_use_build !minimal MAPEXPORT)"
+ "-DBUILD_PLUGINS=ON"
+ "-DBUILD_RUBY=ON"
+ "-DBUILD_SKELETON=OFF"
+ #"-DBUILD_STONESENSE=OFF"
+ "$(cmake-utils_use_build stonesense STONESENSE)"
+ #"-DBUILD_SUPPORTED=ON"
+ "$(cmake-utils_use_build !minimal SUPPORTED)"
+ #"-DCMAKE_INSTALL_PREFIX=/usr/local"
+ "-DCMAKE_INSTALL_PREFIX=${GAMES_DATADIR}"
+ "-DCONSOLE_NO_CATCH=OFF"
+ #"-DDFHACK_BINARY_DESTINATION=."
+ "-DDFHACK_BINARY_DESTINATION=${GAMES_BINDIR}"
+ #"-DDFHACK_DATA_DESTINATION=hack"
+ "-DDFHACK_DATA_DESTINATION=${dfhack_datadir}"
+ #"-DDFHACK_DEVDOC_DESTINATION=hack"
+ "-DDFHACK_DEVDOC_DESTINATION=${dfhack_docdir}/dev"
+ #"-DDFHACK_EGGY_DESTINATION=libs"
+ "-DDFHACK_EGGY_DESTINATION=${dfhack_libdir}"
+ #"-DDFHACK_INCLUDES_DESTINATION=hack/include"
+ "-DDFHACK_INCLUDES_DESTINATION=${GAMES_PREFIX}/include"
+ #"-DDFHACK_LIBRARY_DESTINATION=hack"
+ "-DDFHACK_LIBRARY_DESTINATION=${dfhack_libdir}"
+ #"-DDFHACK_LUA_DESTINATION=hack/lua"
+ "-DDFHACK_LUA_DESTINATION=${dfhack_datadir}/lua"
+ #"-DDFHACK_PLUGIN_DESTINATION=hack/plugins"
+ "-DDFHACK_PLUGIN_DESTINATION=${dfhack_datadir}/plugins"
+ #"-DDFHACK_RUBY_DESTINATION=hack/ruby"
+ "-DDFHACK_RUBY_DESTINATION=${dfhack_datadir}/ruby"
+ #"-DDFHACK_STATEDIR=."
+ "-DDFHACK_STATEDIR=${GAMES_STATEDIR}/${P}"
+ #"-DDFHACK_USERDOC_DESTINATION=hack"
+ "-DDFHACK_USERDOC_DESTINATION=${dfhack_docdir}"
+ #"-DDF_EXECUTABLE=./libs/Dwarf_Fortress"
+ "-DDF_EXECUTABLE=${df_executable}"
+ "-DDL_RUBY=OFF"
+ "-DRUBYLIB=${WORKDIR}/libruby.so"
+ )
+ # "-DSSENSE_ALLEGRO_DESTINATION=${dfhack_libdir}"
+ # "-DSSENSE_RES_DESTINATION=${dfhack_datadir}/stonesense"
+ # "-DSSENSE_DOC_DESTINATION=${dfhack_docdir}/stonesense"
+
+ cmake-utils_src_configure
+}
+
+src_compile() {
+ cmake-utils_src_compile
+}
+
+DOCS=""
+src_install() {
+ cmake-utils_src_install
+ mv "${D%/}/${GAMES_BINDIR}/dfhack" \
+ "${D%/}/${GAMES_BINDIR}/dfhack-${df_PV}" || die
+ mv "${D%/}/${GAMES_BINDIR}/dfhack-run" \
+ "${D%/}/${GAMES_BINDIR}/dfhack-run-${df_PV}" || die
+ ! use egg || mv "${D%/}/${GAMES_BINDIR}/egghack" \
+ "${D%/}/${GAMES_BINDIR}/egghack-${df_PV}" || die
+ rm -f "${D%/}/${dfhack_docdir}"/LICENSE || die
+ dodir "${dfhack_statedir}"
+ if use stonesense; then
+ dodir "${GAMES_SYSCONFDIR#/}/${P}/stonesense"
+ mv "${D%/}/${dfhack_datadir#/}/stonesense/init.txt" \
+ "${D%/}/${GAMES_SYSCONFDIR#/}/${P}/stonesense/init.txt" || die
+ dosym "${ROOT}${GAMES_SYSCONFDIR#/}/${P}/stonesense/init.txt" \
+ "${dfhack_datadir#/}/stonesense/init.txt"
+ elog
+ elog "The Stonesense configuration file can be found at"
+ elog "${GAMES_SYSCONFDIR#/}/${P}/stonesense/init.txt"
+ fi
+ prepgamesdirs
+ fperms g+w "${dfhack_statedir}"
+ # userpriv: portage user needs to be able to link:
+ fperms o+rx "${dfhack_libdir}"
+ use egg && fperms o+rx "${dfhack_libdir}"/libegg.so
+}
+
+pkg_postinst() {
+ games_pkg_postinst
+ elog
+ elog "Due to Dwarf Fortress' special needs regarding working directory,"
+ elog "specifying relative paths to DFHack plugins can give unintended results."
+ elog
+ elog "Your dfhack.init should be placed in \${HOME}/.dwarffortress-${df-PV}/ ,"
+ elog "otherwise the example configuration will be used."
+ elog
+ if ! use egg; then
+ elog "To start DFHack, please run dfhack-${df_PV}"
+ else
+ elog "To start DFHack, please run dwarffortress-${df_PV}"
+ fi
+}
diff --git a/games-util/dfhack/files/dfhack-0.40.13 b/games-util/dfhack/files/dfhack-0.40.13
deleted file mode 120000
index 786b7acd..00000000
--- a/games-util/dfhack/files/dfhack-0.40.13
+++ /dev/null
@@ -1 +0,0 @@
-dfhack-0.40.08 \ No newline at end of file
diff --git a/games-util/dfhack/files/dfhack-0.40.13/01-compile-static-libraries-as.patch b/games-util/dfhack/files/dfhack-0.40.13/01-compile-static-libraries-as.patch
new file mode 120000
index 00000000..f6b6deb6
--- /dev/null
+++ b/games-util/dfhack/files/dfhack-0.40.13/01-compile-static-libraries-as.patch
@@ -0,0 +1 @@
+../dfhack-0.40.08/01-compile-static-libraries-as.patch \ No newline at end of file
diff --git a/games-util/dfhack/files/dfhack-0.40.13/02-drop-strange-build-options.patch b/games-util/dfhack/files/dfhack-0.40.13/02-drop-strange-build-options.patch
new file mode 120000
index 00000000..126a5574
--- /dev/null
+++ b/games-util/dfhack/files/dfhack-0.40.13/02-drop-strange-build-options.patch
@@ -0,0 +1 @@
+../dfhack-0.40.08/02-drop-strange-build-options.patch \ No newline at end of file
diff --git a/games-util/dfhack/files/dfhack-0.40.13/03-configurable-install-paths.patch b/games-util/dfhack/files/dfhack-0.40.13/03-configurable-install-paths.patch
new file mode 120000
index 00000000..c435fc49
--- /dev/null
+++ b/games-util/dfhack/files/dfhack-0.40.13/03-configurable-install-paths.patch
@@ -0,0 +1 @@
+../dfhack-0.40.08/03-configurable-install-paths.patch \ No newline at end of file
diff --git a/games-util/dfhack/files/dfhack-0.40.13/04-compile-time-configurable.patch b/games-util/dfhack/files/dfhack-0.40.13/04-compile-time-configurable.patch
new file mode 120000
index 00000000..bfe49608
--- /dev/null
+++ b/games-util/dfhack/files/dfhack-0.40.13/04-compile-time-configurable.patch
@@ -0,0 +1 @@
+../dfhack-0.40.08/04-compile-time-configurable.patch \ No newline at end of file
diff --git a/games-util/dfhack/files/dfhack-0.40.13/05-compile-time-configurable-0.patch b/games-util/dfhack/files/dfhack-0.40.13/05-compile-time-configurable-0.patch
new file mode 120000
index 00000000..eaa07348
--- /dev/null
+++ b/games-util/dfhack/files/dfhack-0.40.13/05-compile-time-configurable-0.patch
@@ -0,0 +1 @@
+../dfhack-0.40.08/05-compile-time-configurable-0.patch \ No newline at end of file
diff --git a/games-util/dfhack/files/dfhack-0.40.13/06-compile-time-configurable-1.patch b/games-util/dfhack/files/dfhack-0.40.13/06-compile-time-configurable-1.patch
new file mode 120000
index 00000000..2acd276d
--- /dev/null
+++ b/games-util/dfhack/files/dfhack-0.40.13/06-compile-time-configurable-1.patch
@@ -0,0 +1 @@
+../dfhack-0.40.08/06-compile-time-configurable-1.patch \ No newline at end of file
diff --git a/games-util/dfhack/files/dfhack-0.40.13/07-startup-scripts-configurable.patch b/games-util/dfhack/files/dfhack-0.40.13/07-startup-scripts-configurable.patch
new file mode 100644
index 00000000..0c92938b
--- /dev/null
+++ b/games-util/dfhack/files/dfhack-0.40.13/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 ccaecb8..f31290c 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 4fa3e20..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 "$@"
+- 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..d5d8e51
+--- /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=./hack/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="@DFHACK_LIBRARY_DESTINATION@"/libdfhack.so "@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! :)
diff --git a/games-util/dfhack/files/dfhack-0.40.13/08-ruby-plugin-configurable-paths.patch b/games-util/dfhack/files/dfhack-0.40.13/08-ruby-plugin-configurable-paths.patch
new file mode 120000
index 00000000..eeaaefd7
--- /dev/null
+++ b/games-util/dfhack/files/dfhack-0.40.13/08-ruby-plugin-configurable-paths.patch
@@ -0,0 +1 @@
+../dfhack-0.40.08/08-ruby-plugin-configurable-paths.patch \ No newline at end of file
diff --git a/games-util/dfhack/files/dfhack-0.40.13/09-eggy-remove-annoying-banner.patch b/games-util/dfhack/files/dfhack-0.40.13/09-eggy-remove-annoying-banner.patch
new file mode 120000
index 00000000..672f5e14
--- /dev/null
+++ b/games-util/dfhack/files/dfhack-0.40.13/09-eggy-remove-annoying-banner.patch
@@ -0,0 +1 @@
+../dfhack-0.40.08/09-eggy-remove-annoying-banner.patch \ No newline at end of file
diff --git a/games-util/dfhack/files/dfhack-0.40.13/10-unbreak-egg.patch b/games-util/dfhack/files/dfhack-0.40.13/10-unbreak-egg.patch
new file mode 120000
index 00000000..1a81a4e4
--- /dev/null
+++ b/games-util/dfhack/files/dfhack-0.40.13/10-unbreak-egg.patch
@@ -0,0 +1 @@
+../dfhack-0.40.08/10-unbreak-egg.patch \ No newline at end of file
diff --git a/games-util/dfhack/files/dfhack-0.40.13/11-dfhack-init-example.patch b/games-util/dfhack/files/dfhack-0.40.13/11-dfhack-init-example.patch
new file mode 120000
index 00000000..5f970961
--- /dev/null
+++ b/games-util/dfhack/files/dfhack-0.40.13/11-dfhack-init-example.patch
@@ -0,0 +1 @@
+../dfhack-0.40.08/11-dfhack-init-example.patch \ No newline at end of file