From a103906106c367a19eca68274f936e57067c7fa4 Mon Sep 17 00:00:00 2001 From: eroen Date: Mon, 11 Aug 2014 19:55:53 +0200 Subject: dfhack - tag 0.40.06_pre20140808 --- games-util/dfhack/dfhack-0.40.06.9999.ebuild | 275 ----------- .../dfhack/dfhack-0.40.06_pre20140808.ebuild | 269 ++++++++++ .../01-compile-static-libraries-as.patch | 1 - .../02-drop-strange-build-options.patch | 52 -- .../03-configurable-install-paths.patch | 1 - .../04-compile-time-configurable.patch | 1 - .../05-compile-time-configurable-0.patch | 66 --- .../06-compile-time-configurable-1.patch | 104 ---- .../07-startup-scripts-configurable.patch | 292 ----------- .../08-ruby-plugin-configurable-paths.patch | 541 --------------------- .../09-getpath-configurable-path.patch | 46 -- .../10-eggy-remove-annoying-banner.patch | 22 - .../files/dfhack-0.40.06.9999/11-debugging.patch | 22 - .../files/dfhack-0.40.06.9999/12-unbreak-egg.patch | 24 - games-util/dfhack/files/dfhack-0.40.06.9999/series | 13 - .../01-compile-static-libraries-as.patch | 1 + .../02-drop-strange-build-options.patch | 52 ++ .../03-configurable-install-paths.patch | 1 + .../04-compile-time-configurable.patch | 1 + .../05-compile-time-configurable-0.patch | 66 +++ .../06-compile-time-configurable-1.patch | 104 ++++ .../07-startup-scripts-configurable.patch | 292 +++++++++++ .../08-ruby-plugin-configurable-paths.patch | 541 +++++++++++++++++++++ .../09-getpath-configurable-path.patch | 46 ++ .../10-eggy-remove-annoying-banner.patch | 22 + .../dfhack-0.40.06_pre20140808/11-debugging.patch | 22 + .../12-unbreak-egg.patch | 24 + .../dfhack/files/dfhack-0.40.06_pre20140808/series | 13 + 28 files changed, 1454 insertions(+), 1460 deletions(-) delete mode 100644 games-util/dfhack/dfhack-0.40.06.9999.ebuild create mode 100644 games-util/dfhack/dfhack-0.40.06_pre20140808.ebuild delete mode 120000 games-util/dfhack/files/dfhack-0.40.06.9999/01-compile-static-libraries-as.patch delete mode 100644 games-util/dfhack/files/dfhack-0.40.06.9999/02-drop-strange-build-options.patch delete mode 120000 games-util/dfhack/files/dfhack-0.40.06.9999/03-configurable-install-paths.patch delete mode 120000 games-util/dfhack/files/dfhack-0.40.06.9999/04-compile-time-configurable.patch delete mode 100644 games-util/dfhack/files/dfhack-0.40.06.9999/05-compile-time-configurable-0.patch delete mode 100644 games-util/dfhack/files/dfhack-0.40.06.9999/06-compile-time-configurable-1.patch delete mode 100644 games-util/dfhack/files/dfhack-0.40.06.9999/07-startup-scripts-configurable.patch delete mode 100644 games-util/dfhack/files/dfhack-0.40.06.9999/08-ruby-plugin-configurable-paths.patch delete mode 100644 games-util/dfhack/files/dfhack-0.40.06.9999/09-getpath-configurable-path.patch delete mode 100644 games-util/dfhack/files/dfhack-0.40.06.9999/10-eggy-remove-annoying-banner.patch delete mode 100644 games-util/dfhack/files/dfhack-0.40.06.9999/11-debugging.patch delete mode 100644 games-util/dfhack/files/dfhack-0.40.06.9999/12-unbreak-egg.patch delete mode 100644 games-util/dfhack/files/dfhack-0.40.06.9999/series create mode 120000 games-util/dfhack/files/dfhack-0.40.06_pre20140808/01-compile-static-libraries-as.patch create mode 100644 games-util/dfhack/files/dfhack-0.40.06_pre20140808/02-drop-strange-build-options.patch create mode 120000 games-util/dfhack/files/dfhack-0.40.06_pre20140808/03-configurable-install-paths.patch create mode 120000 games-util/dfhack/files/dfhack-0.40.06_pre20140808/04-compile-time-configurable.patch create mode 100644 games-util/dfhack/files/dfhack-0.40.06_pre20140808/05-compile-time-configurable-0.patch create mode 100644 games-util/dfhack/files/dfhack-0.40.06_pre20140808/06-compile-time-configurable-1.patch create mode 100644 games-util/dfhack/files/dfhack-0.40.06_pre20140808/07-startup-scripts-configurable.patch create mode 100644 games-util/dfhack/files/dfhack-0.40.06_pre20140808/08-ruby-plugin-configurable-paths.patch create mode 100644 games-util/dfhack/files/dfhack-0.40.06_pre20140808/09-getpath-configurable-path.patch create mode 100644 games-util/dfhack/files/dfhack-0.40.06_pre20140808/10-eggy-remove-annoying-banner.patch create mode 100644 games-util/dfhack/files/dfhack-0.40.06_pre20140808/11-debugging.patch create mode 100644 games-util/dfhack/files/dfhack-0.40.06_pre20140808/12-unbreak-egg.patch create mode 100644 games-util/dfhack/files/dfhack-0.40.06_pre20140808/series (limited to 'games-util') diff --git a/games-util/dfhack/dfhack-0.40.06.9999.ebuild b/games-util/dfhack/dfhack-0.40.06.9999.ebuild deleted file mode 100644 index a8ab14a9..00000000 --- a/games-util/dfhack/dfhack-0.40.06.9999.ebuild +++ /dev/null @@ -1,275 +0,0 @@ -# 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#0.} -[[ "${df_PV}" = *.*.* ]] && 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_REPO_URI="git://github.com/quietust/dfhack.git" -EGIT_BRANCH=develop -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] - 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} - !egg? ( ~games-simulation/dwarffortress-${df_PV} ) - stonesense? ( app-emulation/emul-linux-x86-opengl - app-emulation/emul-linux-x86-xlibs - ) - " - -## 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 - -#QA_PREBUILT="$(games_get_libdir)/libruby.so" -#QA_PREBUILT="$(games_get_libdir)/${P}/libruby.so" -#QA_PREBUILT=usr/games/lib32/dfhack-0.40.06.9999/libruby.so -#QA_PREBUILT=usr/games/lib32/dfhack-0.40.06.9999/libruby.so -#echo ${QA_PREBUILT} -#QA_PREBUILT=("${GAMES_PREFIX#/}"/"$(get_libdir)"/${P}/libruby.so) -#echo ${QA_PREBUILT} - -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}" - - if use egg; then - dfhack_libdir="$(games_get_libdir)" - else - dfhack_libdir="$(games_get_libdir)/${P}" - fi - - QA_FLAGS_IGNORED=("${dfhack_libdir}"/libruby.so) - QA_PRESTRIPPED=("${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}"/${P}/*.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 -} - -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_DEV_PLUGINS=OFF" - #"-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 -} - -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 - 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}" || die - # userpriv: portage user needs to be able to link: - ! use egg || fperms o+rx "$(games_get_libdir)"/libegg.so || die -} - -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 "DFHack installs custom raw files for dwarffortress in" - elog " ${dfhack_datadir}/raw" - elog "To use them, copy them into your raw folder and apply the diffs." - elog - elog "To start DFHack, please run dfhack-${df_PV}" -} diff --git a/games-util/dfhack/dfhack-0.40.06_pre20140808.ebuild b/games-util/dfhack/dfhack-0.40.06_pre20140808.ebuild new file mode 100644 index 00000000..b4731a47 --- /dev/null +++ b/games-util/dfhack/dfhack-0.40.06_pre20140808.ebuild @@ -0,0 +1,269 @@ +# 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%%_*} +df_PV=${df_PV#0.} +[[ "${df_PV}" = *.*.* ]] && 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=develop +EGIT_COMMIT=0f99ea0ccb65130e7ce01b0c5d6807a522e4f0c6 +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] + 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} + !egg? ( ~games-simulation/dwarffortress-${df_PV} ) + stonesense? ( app-emulation/emul-linux-x86-opengl + app-emulation/emul-linux-x86-xlibs + ) + " + +## 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}" + + if use egg; then + dfhack_libdir="$(games_get_libdir)" + else + dfhack_libdir="$(games_get_libdir)/${P}" + fi + + 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}"/${P}/*.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 +} + +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_DEV_PLUGINS=OFF" + #"-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 +} + +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 + 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}" || die + # userpriv: portage user needs to be able to link: + ! use egg || fperms o+rx "$(games_get_libdir)"/libegg.so || die +} + +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 "DFHack installs custom raw files for dwarffortress in" + elog " ${dfhack_datadir}/raw" + elog "To use them, copy them into your raw folder and apply the diffs." + elog + elog "To start DFHack, please run dfhack-${df_PV}" +} diff --git a/games-util/dfhack/files/dfhack-0.40.06.9999/01-compile-static-libraries-as.patch b/games-util/dfhack/files/dfhack-0.40.06.9999/01-compile-static-libraries-as.patch deleted file mode 120000 index 5efdd5d0..00000000 --- a/games-util/dfhack/files/dfhack-0.40.06.9999/01-compile-static-libraries-as.patch +++ /dev/null @@ -1 +0,0 @@ -../dfhack-9999/01-compile-static-libraries-as.patch \ No newline at end of file diff --git a/games-util/dfhack/files/dfhack-0.40.06.9999/02-drop-strange-build-options.patch b/games-util/dfhack/files/dfhack-0.40.06.9999/02-drop-strange-build-options.patch deleted file mode 100644 index f7ab4f8e..00000000 --- a/games-util/dfhack/files/dfhack-0.40.06.9999/02-drop-strange-build-options.patch +++ /dev/null @@ -1,52 +0,0 @@ -drop strange build options - -From: eroen - - ---- - 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 43a93a9..56ca990 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 "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -g -Wall -Wno-unused-variable") -- SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -m32 -march=i686 -mtune=generic -std=c++0x") -- SET(CMAKE_C_FLAGS "${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 e0ad360..9317ac3 100644 ---- a/library/CMakeLists.txt -+++ b/library/CMakeLists.txt -@@ -223,7 +223,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-0.40.06.9999/03-configurable-install-paths.patch b/games-util/dfhack/files/dfhack-0.40.06.9999/03-configurable-install-paths.patch deleted file mode 120000 index 05196d30..00000000 --- a/games-util/dfhack/files/dfhack-0.40.06.9999/03-configurable-install-paths.patch +++ /dev/null @@ -1 +0,0 @@ -../dfhack-9999/03-configurable-install-paths.patch \ No newline at end of file diff --git a/games-util/dfhack/files/dfhack-0.40.06.9999/04-compile-time-configurable.patch b/games-util/dfhack/files/dfhack-0.40.06.9999/04-compile-time-configurable.patch deleted file mode 120000 index aba03a3b..00000000 --- a/games-util/dfhack/files/dfhack-0.40.06.9999/04-compile-time-configurable.patch +++ /dev/null @@ -1 +0,0 @@ -../dfhack-9999/04-compile-time-configurable.patch \ No newline at end of file diff --git a/games-util/dfhack/files/dfhack-0.40.06.9999/05-compile-time-configurable-0.patch b/games-util/dfhack/files/dfhack-0.40.06.9999/05-compile-time-configurable-0.patch deleted file mode 100644 index df26fcd5..00000000 --- a/games-util/dfhack/files/dfhack-0.40.06.9999/05-compile-time-configurable-0.patch +++ /dev/null @@ -1,66 +0,0 @@ -compile-time configurable paths - -From: eroen - -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 617ea42..128fc46 100644 ---- a/library/Core.cpp -+++ b/library/Core.cpp -@@ -322,7 +322,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()); - } -@@ -410,7 +414,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; - } -@@ -971,7 +979,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 5690ec2..b10d9d8 100644 ---- a/plugins/zone.cpp -+++ b/plugins/zone.cpp -@@ -3182,8 +3182,10 @@ command_result df_autobutcher(color_ostream &out, vector & 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.06.9999/06-compile-time-configurable-1.patch b/games-util/dfhack/files/dfhack-0.40.06.9999/06-compile-time-configurable-1.patch deleted file mode 100644 index 3969e1b8..00000000 --- a/games-util/dfhack/files/dfhack-0.40.06.9999/06-compile-time-configurable-1.patch +++ /dev/null @@ -1,104 +0,0 @@ -compile-time configurable state directory - -From: eroen - -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 2b3b444..4cf44fe 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -64,6 +64,10 @@ SET(DFHACK_RELEASE "r0" 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 128fc46..94a290d 100644 ---- a/library/Core.cpp -+++ b/library/Core.cpp -@@ -882,7 +882,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) -@@ -915,7 +919,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.06.9999/07-startup-scripts-configurable.patch b/games-util/dfhack/files/dfhack-0.40.06.9999/07-startup-scripts-configurable.patch deleted file mode 100644 index fbd888aa..00000000 --- a/games-util/dfhack/files/dfhack-0.40.06.9999/07-startup-scripts-configurable.patch +++ /dev/null @@ -1,292 +0,0 @@ -startup scripts - configurable paths - -From: eroen - - ---- - 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 4cf44fe..8719b23 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 bc8b6d2..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 -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..55dde73 ---- /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 -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-0.40.06.9999/08-ruby-plugin-configurable-paths.patch b/games-util/dfhack/files/dfhack-0.40.06.9999/08-ruby-plugin-configurable-paths.patch deleted file mode 100644 index 3fb1e8b2..00000000 --- a/games-util/dfhack/files/dfhack-0.40.06.9999/08-ruby-plugin-configurable-paths.patch +++ /dev/null @@ -1,541 +0,0 @@ -ruby plugin - configurable paths - -From: eroen - - ---- - 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 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 edce8ac..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_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 -- 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 './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..d8edec8 ---- /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_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 -+ 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 '@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-0.40.06.9999/09-getpath-configurable-path.patch b/games-util/dfhack/files/dfhack-0.40.06.9999/09-getpath-configurable-path.patch deleted file mode 100644 index 2f941b3d..00000000 --- a/games-util/dfhack/files/dfhack-0.40.06.9999/09-getpath-configurable-path.patch +++ /dev/null @@ -1,46 +0,0 @@ -getPath() - configurable path - -From: eroen - - ---- - library/Core.cpp | 4 ++++ - library/Process-linux.cpp | 4 ++++ - 2 files changed, 8 insertions(+) - -diff --git a/library/Core.cpp b/library/Core.cpp -index 94a290d..386b89b 100644 ---- a/library/Core.cpp -+++ b/library/Core.cpp -@@ -422,6 +422,10 @@ string findScript(string path, string name) { - if (fileExists(file)) { - return file; - } -+ file = path + "/scripts/" + name; -+ if (fileExists(file)) { -+ return file; -+ } - return ""; - } - -diff --git a/library/Process-linux.cpp b/library/Process-linux.cpp -index 1b430e5..210a625 100644 ---- a/library/Process-linux.cpp -+++ b/library/Process-linux.cpp -@@ -190,12 +190,16 @@ uint32_t Process::getTickCount() - - string Process::getPath() - { -+ #ifdef DFHACK_DATA_DESTINATION -+ return string(DFHACK_DATA_DESTINATION); -+ #else - const char * cwd_name = "/proc/self/cwd"; - char target_name[1024]; - int target_result; - target_result = readlink(cwd_name, target_name, sizeof(target_name)); - target_name[target_result] = '\0'; - return(string(target_name)); -+ #endif - } - - int Process::getPID() diff --git a/games-util/dfhack/files/dfhack-0.40.06.9999/10-eggy-remove-annoying-banner.patch b/games-util/dfhack/files/dfhack-0.40.06.9999/10-eggy-remove-annoying-banner.patch deleted file mode 100644 index c8fbdd15..00000000 --- a/games-util/dfhack/files/dfhack-0.40.06.9999/10-eggy-remove-annoying-banner.patch +++ /dev/null @@ -1,22 +0,0 @@ -eggy - remove annoying banner - -From: eroen - - ---- - library/Core.cpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/library/Core.cpp b/library/Core.cpp -index 386b89b..8906f85 100644 ---- a/library/Core.cpp -+++ b/library/Core.cpp -@@ -1111,7 +1111,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.06.9999/11-debugging.patch b/games-util/dfhack/files/dfhack-0.40.06.9999/11-debugging.patch deleted file mode 100644 index 80848422..00000000 --- a/games-util/dfhack/files/dfhack-0.40.06.9999/11-debugging.patch +++ /dev/null @@ -1,22 +0,0 @@ -debugging - -From: eroen - - ---- - library/Core.cpp | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/library/Core.cpp b/library/Core.cpp -index 8906f85..dd5725d 100644 ---- a/library/Core.cpp -+++ b/library/Core.cpp -@@ -400,6 +400,8 @@ static bool try_autocomplete(color_ostream &con, const std::string &first, std:: - } - - string findScript(string path, string name) { -+ cerr << "findScript(" << path << ", " << name << std::endl; -+ - if (df::global::world) { - //first try the save folder if it exists - string save = World::ReadWorldFolder(); diff --git a/games-util/dfhack/files/dfhack-0.40.06.9999/12-unbreak-egg.patch b/games-util/dfhack/files/dfhack-0.40.06.9999/12-unbreak-egg.patch deleted file mode 100644 index 0d23872b..00000000 --- a/games-util/dfhack/files/dfhack-0.40.06.9999/12-unbreak-egg.patch +++ /dev/null @@ -1,24 +0,0 @@ -Unbreak egg - -From: eroen - -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.06.9999/series b/games-util/dfhack/files/dfhack-0.40.06.9999/series deleted file mode 100644 index 11b86fb6..00000000 --- a/games-util/dfhack/files/dfhack-0.40.06.9999/series +++ /dev/null @@ -1,13 +0,0 @@ -# This series applies on GIT commit 0983728e1493d490ddf85c8bf20c3a10b987b08d -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-getpath-configurable-path.patch -10-eggy-remove-annoying-banner.patch -11-debugging.patch -12-unbreak-egg.patch diff --git a/games-util/dfhack/files/dfhack-0.40.06_pre20140808/01-compile-static-libraries-as.patch b/games-util/dfhack/files/dfhack-0.40.06_pre20140808/01-compile-static-libraries-as.patch new file mode 120000 index 00000000..5efdd5d0 --- /dev/null +++ b/games-util/dfhack/files/dfhack-0.40.06_pre20140808/01-compile-static-libraries-as.patch @@ -0,0 +1 @@ +../dfhack-9999/01-compile-static-libraries-as.patch \ No newline at end of file diff --git a/games-util/dfhack/files/dfhack-0.40.06_pre20140808/02-drop-strange-build-options.patch b/games-util/dfhack/files/dfhack-0.40.06_pre20140808/02-drop-strange-build-options.patch new file mode 100644 index 00000000..f7ab4f8e --- /dev/null +++ b/games-util/dfhack/files/dfhack-0.40.06_pre20140808/02-drop-strange-build-options.patch @@ -0,0 +1,52 @@ +drop strange build options + +From: eroen + + +--- + 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 43a93a9..56ca990 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 "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -g -Wall -Wno-unused-variable") +- SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -m32 -march=i686 -mtune=generic -std=c++0x") +- SET(CMAKE_C_FLAGS "${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 e0ad360..9317ac3 100644 +--- a/library/CMakeLists.txt ++++ b/library/CMakeLists.txt +@@ -223,7 +223,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-0.40.06_pre20140808/03-configurable-install-paths.patch b/games-util/dfhack/files/dfhack-0.40.06_pre20140808/03-configurable-install-paths.patch new file mode 120000 index 00000000..05196d30 --- /dev/null +++ b/games-util/dfhack/files/dfhack-0.40.06_pre20140808/03-configurable-install-paths.patch @@ -0,0 +1 @@ +../dfhack-9999/03-configurable-install-paths.patch \ No newline at end of file diff --git a/games-util/dfhack/files/dfhack-0.40.06_pre20140808/04-compile-time-configurable.patch b/games-util/dfhack/files/dfhack-0.40.06_pre20140808/04-compile-time-configurable.patch new file mode 120000 index 00000000..aba03a3b --- /dev/null +++ b/games-util/dfhack/files/dfhack-0.40.06_pre20140808/04-compile-time-configurable.patch @@ -0,0 +1 @@ +../dfhack-9999/04-compile-time-configurable.patch \ No newline at end of file diff --git a/games-util/dfhack/files/dfhack-0.40.06_pre20140808/05-compile-time-configurable-0.patch b/games-util/dfhack/files/dfhack-0.40.06_pre20140808/05-compile-time-configurable-0.patch new file mode 100644 index 00000000..df26fcd5 --- /dev/null +++ b/games-util/dfhack/files/dfhack-0.40.06_pre20140808/05-compile-time-configurable-0.patch @@ -0,0 +1,66 @@ +compile-time configurable paths + +From: eroen + +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 617ea42..128fc46 100644 +--- a/library/Core.cpp ++++ b/library/Core.cpp +@@ -322,7 +322,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()); + } +@@ -410,7 +414,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; + } +@@ -971,7 +979,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 5690ec2..b10d9d8 100644 +--- a/plugins/zone.cpp ++++ b/plugins/zone.cpp +@@ -3182,8 +3182,10 @@ command_result df_autobutcher(color_ostream &out, vector & 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.06_pre20140808/06-compile-time-configurable-1.patch b/games-util/dfhack/files/dfhack-0.40.06_pre20140808/06-compile-time-configurable-1.patch new file mode 100644 index 00000000..3969e1b8 --- /dev/null +++ b/games-util/dfhack/files/dfhack-0.40.06_pre20140808/06-compile-time-configurable-1.patch @@ -0,0 +1,104 @@ +compile-time configurable state directory + +From: eroen + +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 2b3b444..4cf44fe 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -64,6 +64,10 @@ SET(DFHACK_RELEASE "r0" 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 128fc46..94a290d 100644 +--- a/library/Core.cpp ++++ b/library/Core.cpp +@@ -882,7 +882,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) +@@ -915,7 +919,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.06_pre20140808/07-startup-scripts-configurable.patch b/games-util/dfhack/files/dfhack-0.40.06_pre20140808/07-startup-scripts-configurable.patch new file mode 100644 index 00000000..fbd888aa --- /dev/null +++ b/games-util/dfhack/files/dfhack-0.40.06_pre20140808/07-startup-scripts-configurable.patch @@ -0,0 +1,292 @@ +startup scripts - configurable paths + +From: eroen + + +--- + 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 4cf44fe..8719b23 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 bc8b6d2..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 -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..55dde73 +--- /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 -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-0.40.06_pre20140808/08-ruby-plugin-configurable-paths.patch b/games-util/dfhack/files/dfhack-0.40.06_pre20140808/08-ruby-plugin-configurable-paths.patch new file mode 100644 index 00000000..3fb1e8b2 --- /dev/null +++ b/games-util/dfhack/files/dfhack-0.40.06_pre20140808/08-ruby-plugin-configurable-paths.patch @@ -0,0 +1,541 @@ +ruby plugin - configurable paths + +From: eroen + + +--- + 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 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 edce8ac..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_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 +- 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 './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..d8edec8 +--- /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_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 ++ 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 '@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-0.40.06_pre20140808/09-getpath-configurable-path.patch b/games-util/dfhack/files/dfhack-0.40.06_pre20140808/09-getpath-configurable-path.patch new file mode 100644 index 00000000..2f941b3d --- /dev/null +++ b/games-util/dfhack/files/dfhack-0.40.06_pre20140808/09-getpath-configurable-path.patch @@ -0,0 +1,46 @@ +getPath() - configurable path + +From: eroen + + +--- + library/Core.cpp | 4 ++++ + library/Process-linux.cpp | 4 ++++ + 2 files changed, 8 insertions(+) + +diff --git a/library/Core.cpp b/library/Core.cpp +index 94a290d..386b89b 100644 +--- a/library/Core.cpp ++++ b/library/Core.cpp +@@ -422,6 +422,10 @@ string findScript(string path, string name) { + if (fileExists(file)) { + return file; + } ++ file = path + "/scripts/" + name; ++ if (fileExists(file)) { ++ return file; ++ } + return ""; + } + +diff --git a/library/Process-linux.cpp b/library/Process-linux.cpp +index 1b430e5..210a625 100644 +--- a/library/Process-linux.cpp ++++ b/library/Process-linux.cpp +@@ -190,12 +190,16 @@ uint32_t Process::getTickCount() + + string Process::getPath() + { ++ #ifdef DFHACK_DATA_DESTINATION ++ return string(DFHACK_DATA_DESTINATION); ++ #else + const char * cwd_name = "/proc/self/cwd"; + char target_name[1024]; + int target_result; + target_result = readlink(cwd_name, target_name, sizeof(target_name)); + target_name[target_result] = '\0'; + return(string(target_name)); ++ #endif + } + + int Process::getPID() diff --git a/games-util/dfhack/files/dfhack-0.40.06_pre20140808/10-eggy-remove-annoying-banner.patch b/games-util/dfhack/files/dfhack-0.40.06_pre20140808/10-eggy-remove-annoying-banner.patch new file mode 100644 index 00000000..c8fbdd15 --- /dev/null +++ b/games-util/dfhack/files/dfhack-0.40.06_pre20140808/10-eggy-remove-annoying-banner.patch @@ -0,0 +1,22 @@ +eggy - remove annoying banner + +From: eroen + + +--- + library/Core.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/library/Core.cpp b/library/Core.cpp +index 386b89b..8906f85 100644 +--- a/library/Core.cpp ++++ b/library/Core.cpp +@@ -1111,7 +1111,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.06_pre20140808/11-debugging.patch b/games-util/dfhack/files/dfhack-0.40.06_pre20140808/11-debugging.patch new file mode 100644 index 00000000..80848422 --- /dev/null +++ b/games-util/dfhack/files/dfhack-0.40.06_pre20140808/11-debugging.patch @@ -0,0 +1,22 @@ +debugging + +From: eroen + + +--- + library/Core.cpp | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/library/Core.cpp b/library/Core.cpp +index 8906f85..dd5725d 100644 +--- a/library/Core.cpp ++++ b/library/Core.cpp +@@ -400,6 +400,8 @@ static bool try_autocomplete(color_ostream &con, const std::string &first, std:: + } + + string findScript(string path, string name) { ++ cerr << "findScript(" << path << ", " << name << std::endl; ++ + if (df::global::world) { + //first try the save folder if it exists + string save = World::ReadWorldFolder(); diff --git a/games-util/dfhack/files/dfhack-0.40.06_pre20140808/12-unbreak-egg.patch b/games-util/dfhack/files/dfhack-0.40.06_pre20140808/12-unbreak-egg.patch new file mode 100644 index 00000000..0d23872b --- /dev/null +++ b/games-util/dfhack/files/dfhack-0.40.06_pre20140808/12-unbreak-egg.patch @@ -0,0 +1,24 @@ +Unbreak egg + +From: eroen + +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.06_pre20140808/series b/games-util/dfhack/files/dfhack-0.40.06_pre20140808/series new file mode 100644 index 00000000..11b86fb6 --- /dev/null +++ b/games-util/dfhack/files/dfhack-0.40.06_pre20140808/series @@ -0,0 +1,13 @@ +# This series applies on GIT commit 0983728e1493d490ddf85c8bf20c3a10b987b08d +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-getpath-configurable-path.patch +10-eggy-remove-annoying-banner.patch +11-debugging.patch +12-unbreak-egg.patch -- cgit v1.2.1