From 711e7dd8eaec29453fa0c13cbeae591e65b1a1fb Mon Sep 17 00:00:00 2001 From: eroen Date: Tue, 7 Mar 2017 23:02:29 +0100 Subject: dfhack - bump to 0.43.05-beta1 --- games-util/dfhack/dfhack-0.40.13.9999.ebuild | 279 ----- games-util/dfhack/dfhack-0.43.05.9999.ebuild | 104 ++ .../dfhack/dfhack-0.43.05_alpha_pre20160726.ebuild | 106 ++ games-util/dfhack/dfhack-0.43.05_beta1.ebuild | 104 ++ .../dfhack/dfhack-0.43.05_pre20160726.ebuild | 106 -- .../01-respect.patch | 92 ++ .../02-respect-dfhack_lua_destination.patch | 1176 ++++++++++++++++++++ .../03-respect-0.patch | 62 ++ .../04-respect-1.patch | 61 + .../05-introduce.patch | 570 ++++++++++ .../files/dfhack-0.43.05_alpha_pre20160726/series | 6 + .../0001-Respect-DFHACK_DATA_DESTINATION.patch | 95 ++ .../0002-respect-DFHACK_LUA_DESTINATION.patch | 75 ++ .../0003-respect-DFHACK_PLUGIN_DESTINATION.patch | 65 ++ .../0004-respect-DFHACK_LIBRARY_DESTINATION.patch | 65 ++ .../0005-introduce-DFHACK_RUBY_DESTINATION.patch | 88 ++ .../dfhack-0.43.05_pre20160726/01-respect.patch | 92 -- .../02-respect-dfhack_lua_destination.patch | 1176 -------------------- .../dfhack-0.43.05_pre20160726/03-respect-0.patch | 62 -- .../dfhack-0.43.05_pre20160726/04-respect-1.patch | 61 - .../dfhack-0.43.05_pre20160726/05-introduce.patch | 570 ---------- .../dfhack/files/dfhack-0.43.05_pre20160726/series | 6 - 22 files changed, 2669 insertions(+), 2352 deletions(-) delete mode 100644 games-util/dfhack/dfhack-0.40.13.9999.ebuild create mode 100644 games-util/dfhack/dfhack-0.43.05.9999.ebuild create mode 100644 games-util/dfhack/dfhack-0.43.05_alpha_pre20160726.ebuild create mode 100644 games-util/dfhack/dfhack-0.43.05_beta1.ebuild delete mode 100644 games-util/dfhack/dfhack-0.43.05_pre20160726.ebuild create mode 100644 games-util/dfhack/files/dfhack-0.43.05_alpha_pre20160726/01-respect.patch create mode 100644 games-util/dfhack/files/dfhack-0.43.05_alpha_pre20160726/02-respect-dfhack_lua_destination.patch create mode 100644 games-util/dfhack/files/dfhack-0.43.05_alpha_pre20160726/03-respect-0.patch create mode 100644 games-util/dfhack/files/dfhack-0.43.05_alpha_pre20160726/04-respect-1.patch create mode 100644 games-util/dfhack/files/dfhack-0.43.05_alpha_pre20160726/05-introduce.patch create mode 100644 games-util/dfhack/files/dfhack-0.43.05_alpha_pre20160726/series create mode 100644 games-util/dfhack/files/dfhack-0.43.05_beta1/0001-Respect-DFHACK_DATA_DESTINATION.patch create mode 100644 games-util/dfhack/files/dfhack-0.43.05_beta1/0002-respect-DFHACK_LUA_DESTINATION.patch create mode 100644 games-util/dfhack/files/dfhack-0.43.05_beta1/0003-respect-DFHACK_PLUGIN_DESTINATION.patch create mode 100644 games-util/dfhack/files/dfhack-0.43.05_beta1/0004-respect-DFHACK_LIBRARY_DESTINATION.patch create mode 100644 games-util/dfhack/files/dfhack-0.43.05_beta1/0005-introduce-DFHACK_RUBY_DESTINATION.patch delete mode 100644 games-util/dfhack/files/dfhack-0.43.05_pre20160726/01-respect.patch delete mode 100644 games-util/dfhack/files/dfhack-0.43.05_pre20160726/02-respect-dfhack_lua_destination.patch delete mode 100644 games-util/dfhack/files/dfhack-0.43.05_pre20160726/03-respect-0.patch delete mode 100644 games-util/dfhack/files/dfhack-0.43.05_pre20160726/04-respect-1.patch delete mode 100644 games-util/dfhack/files/dfhack-0.43.05_pre20160726/05-introduce.patch delete mode 100644 games-util/dfhack/files/dfhack-0.43.05_pre20160726/series (limited to 'games-util') diff --git a/games-util/dfhack/dfhack-0.40.13.9999.ebuild b/games-util/dfhack/dfhack-0.40.13.9999.ebuild deleted file mode 100644 index 02ab44ac..00000000 --- a/games-util/dfhack/dfhack-0.40.13.9999.ebuild +++ /dev/null @@ -1,279 +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%.${PV#*.*.*.}} -df_PV=${df_PV#0.} -df_PV=${df_PV%%_*} - -DESCRIPTION="Memory hacking library for Dwarf Fortress and a set of tools that -use it" -HOMEPAGE="http://github.com/DFHack/dfhack" -EGIT_REPO_URI="git://github.com/DFHack/dfhack.git" -EGIT_BRANCH=develop -#EGIT_COMMIT= -SRC_URI="http://cloud.github.com/downloads/jjyg/dfhack/libruby187.tar.gz" - -KEYWORDS="" # ~amd64 ~x86 - -CMAKE_MIN_VERSION=2.8.9 -CMAKE_REMOVE_MODULES_LIST="FindCurses FindDoxygen CMakeVS10FindMake" - -LICENSE="ZLIB MIT BSD-2" -SLOT=${df_PV} -IUSE="api dfusion doc egg isoworld minimal stonesense" - -HDEPEND=" - dev-perl/XML-LibXML - dev-perl/XML-LibXSLT - doc? ( app-doc/doxygen ) - " -LIBRARY_DEPEND=" - || ( sys-libs/zlib[abi_x86_32] - ( sys-libs/zlib - app-emulation/emul-linux-x86-baselibs ) ) - stonesense? ( media-libs/fontconfig[abi_x86_32] - app-emulation/emul-linux-x86-baselibs[development] - media-libs/freetype[abi_x86_32] - x11-libs/libICE[abi_x86_32] - x11-libs/libSM[abi_x86_32] - x11-libs/libX11[abi_x86_32] - x11-libs/libXcursor[abi_x86_32] - x11-libs/libXext[abi_x86_32] - x11-libs/libXinerama[abi_x86_32] - x11-libs/libXrandr[abi_x86_32] - ) - " -DEPEND="${LIBRARY_DEPEND} - ${HDEPEND}" -RDEPEND="${LIBRARY_DEPEND} - stonesense? ( app-emulation/emul-linux-x86-opengl - app-emulation/emul-linux-x86-xlibs - ) - " -# Circular dependency when building egg. -PDEPEND="~games-simulation/dwarffortress-${df_PV}" - -## missing multilib -#dev-lang/lua - binary bundled -#dev-libs/protobuf - bundled -## stonesense -#allegro - binary bundled -# dev-libs/atk (libatk-1.0.so.0) - gtklibs -# dev-libs/glib (libgthread-2.0.so.0,libglib-2.0.so.0,libgobject-2.0.so.0,libgmodule-2.0.so.0,libgio-2.0.so.0) - baselibs -# media-libs/fontconfig (libfontconfig.so.1) -# media-libs/freetype (libfreetype.so.6) -# media-libs/jpeg:62 (libjpeg.so.62) - baselibs -# virtual/glu (libGLU.so.1) - opengl -# media-libs/libpng:1.2 (libpng12.so.0) - baselibs -# virtual/opengl (libGL.so.1) -# sys-libs/zlib (libz.so.1) - baselibs -# x11-libs/cairo (libcairo.so.2) - gtklibs -# x11-libs/gdk-pixbuf (libgdk_pixbuf) - gtklibs -# x11-libs/gtk+ (libgdk-x11-2.0.so.0,libgtk-x11-2.0.so.0) - gtklibs -# x11-libs/libICE (libICE.so.6) -# x11-libs/libSM (libSM.so.6) -# x11-libs/libX11 (libX11.so.6) -# x11-libs/libXcursor (libXcursor.so.1) -# x11-libs/libXext (libXext.so.6) -# x11-libs/libXinerama (libXinerama.so.1) -# x11-libs/libXrandr (libXrandr.so.2) -# x11-libs/pango (libpangocairo-1.0.so.0,libpango-1.0.so.0,libpangoft2-1.0.so.0) - gtklibs - -pkg_setup() { - multilib_toolchain_setup x86 - - df_executable="dwarffortress-${df_PV}" - dfhack_datadir="${GAMES_DATADIR}/${P}" - dfhack_docdir="/usr/share/doc/${P}" - dfhack_statedir="${GAMES_STATEDIR}/${P}" - - dfhack_libdir=$(games_get_libdir)/dwarffortress-${df_PV} - - QA_FLAGS_IGNORED=("${dfhack_libdir#/}"/libruby.so) - QA_PRESTRIPPED=("${dfhack_libdir#/}"/libruby.so) - QA_SONAME_NO_SYMLINK=("${dfhack_libdir#/}"/libruby.so) -} - -src_unpack() { - git-r3_src_unpack - unpack ${A} - mv "${WORKDIR}"/libruby1.8.so.1.8.7 "${WORKDIR}"/libruby.so || die -} - -src_prepare() { - # rm -r patches-master-$(date -I)/ - # stg export -n -d patches-master-$(date -I) -e patch - # rm /usr/local/portage/games-util/dfhack/files/dfhack-0.40.06.9999/* - # cp patches-master-$(date -I)/* /usr/local/portage/games-util/dfhack/files/dfhack-0.40.06.9999/ - epatch "${FILESDIR}"/${PN}-0.${df_PV}/*.patch - - pushd "${S}"/depends/clsocket - epatch "${FILESDIR}"/clsocket/0001-Compile-static-library-as-PIC.patch - popd - - #if use stonesense; then - # pushd "${S}"/plugins/stonesense - # epatch "${FILESDIR}"/stonesense-${PV}/01-null-isn-t-an-int32.patch - # epatch "${FILESDIR}"/stonesense-${PV}/02-configurable-install-paths.patch - # epatch "${FILESDIR}"/stonesense-${PV}/03-don-t-segfault-if-logfile-is.patch - # epatch "${FILESDIR}"/stonesense-${PV}/04-compile-time-configuration-of.patch - # epatch "${FILESDIR}"/stonesense-${PV}/05-compile-time-configurable-log.patch - # epatch "${FILESDIR}"/stonesense-${PV}/06-fix-b0rked-xml-file.patch - # epatch "${FILESDIR}"/stonesense-${PV}/07-compile-time-configurable-dump.patch - # epatch "${FILESDIR}"/stonesense-${PV}/08-compile-time-configurable.patch - # # Patches that no longer fit upstream, not updated yet. - # #epatch "${FILESDIR}"/stonesense/0003-screenshots-in-home-dir.patch - # popd - #fi - #if use isoworld; then - # pushd "${S}"/plugins/isoworld - # epatch "${FILESDIR}"/isoworld-${PV}/01-missing-include-dir.patch - # popd - # ewarn "The isoworld plugin requires agui, and will probably fail to build" - #fi - - # Fix other scripts -# if use dfusion; then -# sed -f - -i plugins/Dfusion/luafiles/{init.lua,friendship/{init.lua,plugin.lua,install.lua},triggers/{plugin.lua,functions_menu.lua},friendship_civ/init.lua,common.lua,embark/{init.lua,plugin.lua},migrants/{init.lua,plugin.lua},xml_struct.lua,xml_types.lua} <<- EOF || die -# s:("dfusion/:("${datadir}/dfusion/: -# s:('dfusion/:('${datadir}/dfusion/: -# EOF -# sed -i "s:libs/Dwarf_Fortress:Dwarf_Fortress:" plugins/Dfusion/luafiles/common.lua -# fi - - ##Issues: - # - dfusion is strange. It's always been that, though. - # - prebuilt ruby - # - bundled lua - # - isoworld requires agui - # - prebuilt allegro for stonesense. - # - stonesense conf file: /usr/share/games/dfhack-9999/stonesense/init.txt - # Set in ./Config.cpp, installed together with the rest of the directory. - # - output files - # - - Make symlinks to (unversioned) /var - - # Doesn't build: - sed -e '/autolabor2/d' \ - -e '/rprobe/d' \ - -i plugins/devel/CMakeLists.txt || die -} - -src_configure() { - # cmake -Wno-dev -LA .. | grep -v '^--' | sed -e 's/:\S*=/=/' -e 's/.*/"-D&"/' - mycmakeargs=( - #"-DBUILD_DEVEL=OFF" - "$(cmake-utils_use_build api DEVEL)" - #"-DBUILD_DEV_PLUGINS=OFF" - "$(cmake-utils_use_build !minimal DEV_PLUGINS)" - #"-DBUILD_DFUSION=ON" - "$(cmake-utils_use_build dfusion DFUSION)" - #"-DBUILD_DOXYGEN=OFF" - "$(cmake-utils_use_build doc DOXYGEN)" - #"-DBUILD_DWARFEXPORT=ON" - "$(cmake-utils_use_build !minimal DWARFEXPORT)" - #"-DBUILD_EGGY=OFF" - "$(cmake-utils_use_build egg EGGY)" - #"-DBUILD_ISOWORLD=OFF" - "$(cmake-utils_use_build isoworld ISOWORLD)" - "-DBUILD_LIBRARY=ON" - #"-DBUILD_MAPEXPORT=ON" - "$(cmake-utils_use_build !minimal MAPEXPORT)" - "-DBUILD_PLUGINS=ON" - "-DBUILD_RUBY=ON" - "-DBUILD_SKELETON=OFF" - #"-DBUILD_STONESENSE=OFF" - "$(cmake-utils_use_build stonesense STONESENSE)" - #"-DBUILD_SUPPORTED=ON" - "$(cmake-utils_use_build !minimal SUPPORTED)" - #"-DCMAKE_INSTALL_PREFIX=/usr/local" - "-DCMAKE_INSTALL_PREFIX=${GAMES_DATADIR}" - "-DCONSOLE_NO_CATCH=OFF" - #"-DDFHACK_BINARY_DESTINATION=." - "-DDFHACK_BINARY_DESTINATION=${GAMES_BINDIR}" - #"-DDFHACK_DATA_DESTINATION=hack" - "-DDFHACK_DATA_DESTINATION=${dfhack_datadir}" - #"-DDFHACK_DEVDOC_DESTINATION=hack" - "-DDFHACK_DEVDOC_DESTINATION=${dfhack_docdir}/dev" - #"-DDFHACK_EGGY_DESTINATION=libs" - "-DDFHACK_EGGY_DESTINATION=${dfhack_libdir}" - #"-DDFHACK_INCLUDES_DESTINATION=hack/include" - "-DDFHACK_INCLUDES_DESTINATION=${GAMES_PREFIX}/include" - #"-DDFHACK_LIBRARY_DESTINATION=hack" - "-DDFHACK_LIBRARY_DESTINATION=${dfhack_libdir}" - #"-DDFHACK_LUA_DESTINATION=hack/lua" - "-DDFHACK_LUA_DESTINATION=${dfhack_datadir}/lua" - #"-DDFHACK_PLUGIN_DESTINATION=hack/plugins" - "-DDFHACK_PLUGIN_DESTINATION=${dfhack_datadir}/plugins" - #"-DDFHACK_RUBY_DESTINATION=hack/ruby" - "-DDFHACK_RUBY_DESTINATION=${dfhack_datadir}/ruby" - #"-DDFHACK_STATEDIR=." - "-DDFHACK_STATEDIR=${GAMES_STATEDIR}/${P}" - #"-DDFHACK_USERDOC_DESTINATION=hack" - "-DDFHACK_USERDOC_DESTINATION=${dfhack_docdir}" - #"-DDF_EXECUTABLE=./libs/Dwarf_Fortress" - "-DDF_EXECUTABLE=${df_executable}" - "-DDL_RUBY=OFF" - "-DRUBYLIB=${WORKDIR}/libruby.so" - ) - # "-DSSENSE_ALLEGRO_DESTINATION=${dfhack_libdir}" - # "-DSSENSE_RES_DESTINATION=${dfhack_datadir}/stonesense" - # "-DSSENSE_DOC_DESTINATION=${dfhack_docdir}/stonesense" - - cmake-utils_src_configure -} - -src_compile() { - cmake-utils_src_compile -} - -DOCS="" -src_install() { - cmake-utils_src_install - mv "${D%/}/${GAMES_BINDIR}/dfhack" \ - "${D%/}/${GAMES_BINDIR}/dfhack-${df_PV}" || die - mv "${D%/}/${GAMES_BINDIR}/dfhack-run" \ - "${D%/}/${GAMES_BINDIR}/dfhack-run-${df_PV}" || die - ! use egg || mv "${D%/}/${GAMES_BINDIR}/egghack" \ - "${D%/}/${GAMES_BINDIR}/egghack-${df_PV}" || die - rm -f "${D%/}/${dfhack_docdir}"/LICENSE || die - dodir "${dfhack_statedir}" - if use stonesense; then - dodir "${GAMES_SYSCONFDIR#/}/${P}/stonesense" - mv "${D%/}/${dfhack_datadir#/}/stonesense/init.txt" \ - "${D%/}/${GAMES_SYSCONFDIR#/}/${P}/stonesense/init.txt" || die - dosym "${ROOT}${GAMES_SYSCONFDIR#/}/${P}/stonesense/init.txt" \ - "${dfhack_datadir#/}/stonesense/init.txt" - elog - elog "The Stonesense configuration file can be found at" - elog "${GAMES_SYSCONFDIR#/}/${P}/stonesense/init.txt" - fi - prepgamesdirs - fperms g+w "${dfhack_statedir}" - # userpriv: portage user needs to be able to link: - fperms o+rx "${dfhack_libdir}" - use egg && fperms o+rx "${dfhack_libdir}"/libegg.so -} - -pkg_postinst() { - games_pkg_postinst - elog - elog "Due to Dwarf Fortress' special needs regarding working directory," - elog "specifying relative paths to DFHack plugins can give unintended results." - elog - elog "Your dfhack.init should be placed in \${HOME}/.dwarffortress-${df-PV}/ ," - elog "otherwise the example configuration will be used." - elog - if ! use egg; then - elog "To start DFHack, please run dfhack-${df_PV}" - else - elog "To start DFHack, please run dwarffortress-${df_PV}" - fi -} diff --git a/games-util/dfhack/dfhack-0.43.05.9999.ebuild b/games-util/dfhack/dfhack-0.43.05.9999.ebuild new file mode 100644 index 00000000..b75b0b29 --- /dev/null +++ b/games-util/dfhack/dfhack-0.43.05.9999.ebuild @@ -0,0 +1,104 @@ +# By eroen , 2012 - 2017 +# 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. + +EAPI=6 + +inherit versionator git-r3 cmake-utils + +df_PV=$(get_version_component_range 1-3) + +DESCRIPTION="Memory hacking library for Dwarf Fortress and a set of tools that use it" +HOMEPAGE="http://github.com/DFHack/dfhack" +EGIT_REPO_URI="https://github.com/DFHack/dfhack.git" +if [[ $PV == *.9999 ]]; then + EGIT_BRANCH="develop" +elif [[ $PV == *_alpha* || $PV == *_beta* ]]; then + EGIT_MIN_CLONE="single" + EGIT_COMMIT="${PV/_alpha/-alpha}" + EGIT_COMMIT="${EGIT_COMMIT/_beta/-beta}" +else + EGIT_MIN_CLONE_TYPE=mirror + EGIT_COMMIT="X" + xml_EGIT_COMMIT="X" +fi + +# KEYWORDS="-* ~amd64" # ~x86 + +CMAKE_MIN_VERSION=2.8.0 +CMAKE_REMOVE_MODULES_LIST="FindCurses FindDoxygen CMakeVS10FindMake" + +LICENSE="ZLIB MIT BSD-2 BSD CC-BY-SA-3.0" +SLOT="0" +IUSE="" + +HDEPEND=" + >=sys-devel/gcc-4.5 + dev-lang/perl + dev-perl/XML-LibXML + dev-perl/XML-LibXSLT + " +LIBRARY_DEPEND=" + sys-libs/zlib + " +DEPEND="${LIBRARY_DEPEND} + ${HDEPEND}" +RDEPEND="${LIBRARY_DEPEND} + ~games-roguelike/dwarf-fortress-$df_PV" + +#PATCHES=( "$FILESDIR"/dfhack-$PV ) + +QA_PREBUILT="opt/dfhack/hack/libruby.so" + +src_unpack() { + git-r3_src_unpack + if [[ -n $xml_EGIT_COMMIT ]]; then + cd "$S/library/xml" || die + git checkout "$xml_EGIT_COMMIT" || die + fi +} + +src_prepare() { + default + local install="\${HOME}/.dwarf-fortress-${df_PV}_dfhack" exe="./libs/Dwarf_Fortress" + sed -e "s:^install=.*:install=${install}:" \ + -e "s:^exe=.*:exe=\"${exe}\":" \ + "$FILESDIR"/dfhack > "$T"/dfhack || die + cp "$FILESDIR"/dfhack-run "$T" || die +} + +src_configure() { + local mycmakeargs=( + -DDFHACK_BUILD_ARCH=$(usex amd64 64 "")$(usex x86 32 "") + -DEXTERNAL_TINYXML=NO # https://bugs.gentoo.org/show_bug.cgi?id=592696 + -DCMAKE_INSTALL_PREFIX=/opt/dfhack + -DDFHACK_DATA_DESTINATION=/opt/dfhack/hack + -DDFHACK_LUA_DESTINATION=/opt/dfhack/hack/lua + -DDFHACK_PLUGIN_DESTINATION=/opt/dfhack/hack/plugins + -DDFHACK_LIBRARY_DESTINATION=/opt/dfhack/hack + -DDFHACK_RUBY_DESTINATION=/opt/dfhack/hack/ruby + -DBUILD_RUBY=OFF # TODO: downloads libruby.so + -DBUILD_DEV_PLUGINS=ON + -DBUILD_SKELETON=ON + ) + + cmake-utils_src_configure +} + +DOCS="" +src_install() { + cmake-utils_src_install + + dobin "$T"/dfhack{,-run} +} + +pkg_postinst() { + elog "Due to Dwarf Fortress' special needs regarding working directory," + elog "specifying relative paths to DFHack plugins can give unintended results." + elog + elog "Your dfhack.init should be placed in \${HOME}/.dwarf-fortress-${df_PV}_dfhack/ ," + elog "otherwise the example configuration will be used." + elog + elog "To start DFHack, please run dfhack" +} diff --git a/games-util/dfhack/dfhack-0.43.05_alpha_pre20160726.ebuild b/games-util/dfhack/dfhack-0.43.05_alpha_pre20160726.ebuild new file mode 100644 index 00000000..79feebc2 --- /dev/null +++ b/games-util/dfhack/dfhack-0.43.05_alpha_pre20160726.ebuild @@ -0,0 +1,106 @@ +# By eroen, 2012-2016 +# +# 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. + +EAPI=6 + +inherit multilib versionator git-r3 cmake-utils + +df_PV=$(get_version_component_range 1-3) + +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 https://github.com/DFHack/dfhack.git" +EGIT_REPO_URI="https://github.com/DFHack/dfhack.git" +if [[ $PV == *.9999 ]]; then + EGIT_BRANCH="develop" +#elif [[ $PV == *_alpha* ]]; then +# EGIT_MIN_CLONE="single" +# EGIT_COMMIT="${PV/_alpha/-alpha}" +else + EGIT_MIN_CLONE_TYPE=mirror + EGIT_COMMIT="29963f4b67b9edae74cd69e159bb63730b524d27" + xml_EGIT_COMMIT="95f0627d9f2fe9179865a1eaebf348ea6afcbc27" +fi + +KEYWORDS="-* ~amd64" # ~x86 + +CMAKE_MIN_VERSION=2.8.0 +CMAKE_REMOVE_MODULES_LIST="FindCurses FindDoxygen CMakeVS10FindMake" + +LICENSE="ZLIB MIT BSD-2 BSD CC-BY-SA-3.0" +SLOT="0" +IUSE="" + +HDEPEND=" + >=sys-devel/gcc-4.5[multilib] + dev-lang/perl + dev-perl/XML-LibXML + dev-perl/XML-LibXSLT + " +LIBRARY_DEPEND=" + sys-libs/zlib[abi_x86_32] + " +DEPEND="${LIBRARY_DEPEND} + ${HDEPEND}" +RDEPEND="${LIBRARY_DEPEND} + ~games-roguelike/dwarf-fortress-$df_PV[abi_x86_32]" + +PATCHES=( "$FILESDIR"/dfhack-$PV ) + +QA_PREBUILT="opt/dfhack/hack/libruby.so" + +pkg_setup() { + multilib_toolchain_setup x86 +} + +src_unpack() { + git-r3_src_unpack + if [[ -n $xml_EGIT_COMMIT ]]; then + cd "$S/library/xml" || die + git checkout "$xml_EGIT_COMMIT" || die + fi +} + +src_prepare() { + default + local install="\${HOME}/.dwarf-fortress-${df_PV}_dfhack" exe="./libs_abi_x86_32/Dwarf_Fortress" + sed -e "s:^install=.*:install=${install}:" \ + -e "s:^exe=.*:exe=\"${exe}\":" \ + "$FILESDIR"/dfhack > "$T"/dfhack || die + cp "$FILESDIR"/dfhack-run "$T" || die +} + +src_configure() { + local mycmakeargs=( + -DDFHACK_BUILD_ARCH=32 + -DEXTERNAL_TINYXML=NO + -DCMAKE_INSTALL_PREFIX=/opt/dfhack + -DDFHACK_DATA_DESTINATION=/opt/dfhack/hack + -DDFHACK_LUA_DESTINATION=/opt/dfhack/hack/lua + -DDFHACK_PLUGIN_DESTINATION=/opt/dfhack/hack/plugins + -DDFHACK_LIBRARY_DESTINATION=/opt/dfhack/hack + -DDFHACK_RUBY_DESTINATION=/opt/dfhack/hack/ruby + ) + + cmake-utils_src_configure +} + +DOCS="" +src_install() { + cmake-utils_src_install + + dobin "$T"/dfhack{,-run} +} + +pkg_postinst() { + elog "Due to Dwarf Fortress' special needs regarding working directory," + elog "specifying relative paths to DFHack plugins can give unintended results." + elog + elog "Your dfhack.init should be placed in \${HOME}/.dwarf-fortress ," + elog "otherwise the example configuration will be used." + elog + elog "To start DFHack, please run dfhack" +} diff --git a/games-util/dfhack/dfhack-0.43.05_beta1.ebuild b/games-util/dfhack/dfhack-0.43.05_beta1.ebuild new file mode 100644 index 00000000..744a2e89 --- /dev/null +++ b/games-util/dfhack/dfhack-0.43.05_beta1.ebuild @@ -0,0 +1,104 @@ +# By eroen , 2012 - 2017 +# 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. + +EAPI=6 + +inherit versionator git-r3 cmake-utils + +df_PV=$(get_version_component_range 1-3) + +DESCRIPTION="Memory hacking library for Dwarf Fortress and a set of tools that use it" +HOMEPAGE="http://github.com/DFHack/dfhack" +EGIT_REPO_URI="https://github.com/DFHack/dfhack.git" +if [[ $PV == *.9999 ]]; then + EGIT_BRANCH="develop" +elif [[ $PV == *_alpha* || $PV == *_beta* ]]; then + EGIT_MIN_CLONE="single" + EGIT_COMMIT="${PV/_alpha/-alpha}" + EGIT_COMMIT="${EGIT_COMMIT/_beta/-beta}" +else + EGIT_MIN_CLONE_TYPE=mirror + EGIT_COMMIT="X" + xml_EGIT_COMMIT="X" +fi + +KEYWORDS="-* ~amd64" # ~x86 + +CMAKE_MIN_VERSION=2.8.0 +CMAKE_REMOVE_MODULES_LIST="FindCurses FindDoxygen CMakeVS10FindMake" + +LICENSE="ZLIB MIT BSD-2 BSD CC-BY-SA-3.0" +SLOT="0" +IUSE="" + +HDEPEND=" + >=sys-devel/gcc-4.5 + dev-lang/perl + dev-perl/XML-LibXML + dev-perl/XML-LibXSLT + " +LIBRARY_DEPEND=" + sys-libs/zlib + " +DEPEND="${LIBRARY_DEPEND} + ${HDEPEND}" +RDEPEND="${LIBRARY_DEPEND} + ~games-roguelike/dwarf-fortress-$df_PV" + +PATCHES=( "$FILESDIR"/dfhack-$PV ) + +QA_PREBUILT="opt/dfhack/hack/libruby.so" + +src_unpack() { + git-r3_src_unpack + if [[ -n $xml_EGIT_COMMIT ]]; then + cd "$S/library/xml" || die + git checkout "$xml_EGIT_COMMIT" || die + fi +} + +src_prepare() { + default + local install="\${HOME}/.dwarf-fortress-${df_PV}_dfhack" exe="./libs/Dwarf_Fortress" + sed -e "s:^install=.*:install=${install}:" \ + -e "s:^exe=.*:exe=\"${exe}\":" \ + "$FILESDIR"/dfhack > "$T"/dfhack || die + cp "$FILESDIR"/dfhack-run "$T" || die +} + +src_configure() { + local mycmakeargs=( + -DDFHACK_BUILD_ARCH=$(usex amd64 64 "")$(usex x86 32 "") + -DEXTERNAL_TINYXML=NO # https://bugs.gentoo.org/show_bug.cgi?id=592696 + -DCMAKE_INSTALL_PREFIX=/opt/dfhack + -DDFHACK_DATA_DESTINATION=/opt/dfhack/hack + -DDFHACK_LUA_DESTINATION=/opt/dfhack/hack/lua + -DDFHACK_PLUGIN_DESTINATION=/opt/dfhack/hack/plugins + -DDFHACK_LIBRARY_DESTINATION=/opt/dfhack/hack + -DDFHACK_RUBY_DESTINATION=/opt/dfhack/hack/ruby + -DBUILD_RUBY=OFF # TODO: downloads libruby.so + -DBUILD_DEV_PLUGINS=ON + -DBUILD_SKELETON=ON + ) + + cmake-utils_src_configure +} + +DOCS="" +src_install() { + cmake-utils_src_install + + dobin "$T"/dfhack{,-run} +} + +pkg_postinst() { + elog "Due to Dwarf Fortress' special needs regarding working directory," + elog "specifying relative paths to DFHack plugins can give unintended results." + elog + elog "Your dfhack.init should be placed in \${HOME}/.dwarf-fortress-${df_PV}_dfhack/ ," + elog "otherwise the example configuration will be used." + elog + elog "To start DFHack, please run dfhack" +} diff --git a/games-util/dfhack/dfhack-0.43.05_pre20160726.ebuild b/games-util/dfhack/dfhack-0.43.05_pre20160726.ebuild deleted file mode 100644 index cbf20ee5..00000000 --- a/games-util/dfhack/dfhack-0.43.05_pre20160726.ebuild +++ /dev/null @@ -1,106 +0,0 @@ -# By eroen, 2012-2016 -# -# 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. - -EAPI=6 - -inherit multilib versionator git-r3 cmake-utils - -df_PV=$(get_version_component_range 1-3) - -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 https://github.com/DFHack/dfhack.git" -EGIT_REPO_URI="https://github.com/DFHack/dfhack.git" -if [[ $PV == *.9999 ]]; then - EGIT_BRANCH="develop" -elif [[ $PV == *_alpha* ]]; then - EGIT_MIN_CLONE="single" - EGIT_COMMIT="${PV/_alpha/-alpha}" -else - EGIT_MIN_CLONE_TYPE=mirror - EGIT_COMMIT="29963f4b67b9edae74cd69e159bb63730b524d27" - xml_EGIT_COMMIT="95f0627d9f2fe9179865a1eaebf348ea6afcbc27" -fi - -KEYWORDS="-* ~amd64" # ~x86 - -CMAKE_MIN_VERSION=2.8.0 -CMAKE_REMOVE_MODULES_LIST="FindCurses FindDoxygen CMakeVS10FindMake" - -LICENSE="ZLIB MIT BSD-2 BSD CC-BY-SA-3.0" -SLOT="0" -IUSE="" - -HDEPEND=" - >=sys-devel/gcc-4.5[multilib] - dev-lang/perl - dev-perl/XML-LibXML - dev-perl/XML-LibXSLT - " -LIBRARY_DEPEND=" - sys-libs/zlib[abi_x86_32] - " -DEPEND="${LIBRARY_DEPEND} - ${HDEPEND}" -RDEPEND="${LIBRARY_DEPEND} - ~games-roguelike/dwarf-fortress-$df_PV[abi_x86_32]" - -PATCHES=( "$FILESDIR"/dfhack-$PV ) - -QA_PREBUILT="opt/dfhack/hack/libruby.so" - -pkg_setup() { - multilib_toolchain_setup x86 -} - -src_unpack() { - git-r3_src_unpack - if [[ -n $xml_EGIT_COMMIT ]]; then - cd "$S/library/xml" || die - git checkout "$xml_EGIT_COMMIT" || die - fi -} - -src_prepare() { - default - local install="\${HOME}/.dwarf-fortress-${df_PV}_dfhack" exe="./libs_abi_x86_32/Dwarf_Fortress" - sed -e "s:^install=.*:install=${install}:" \ - -e "s:^exe=.*:exe=\"${exe}\":" \ - "$FILESDIR"/dfhack > "$T"/dfhack || die - cp "$FILESDIR"/dfhack-run "$T" || die -} - -src_configure() { - local mycmakeargs=( - -DDFHACK_BUILD_ARCH=32 - -DEXTERNAL_TINYXML=NO - -DCMAKE_INSTALL_PREFIX=/opt/dfhack - -DDFHACK_DATA_DESTINATION=/opt/dfhack/hack - -DDFHACK_LUA_DESTINATION=/opt/dfhack/hack/lua - -DDFHACK_PLUGIN_DESTINATION=/opt/dfhack/hack/plugins - -DDFHACK_LIBRARY_DESTINATION=/opt/dfhack/hack - -DDFHACK_RUBY_DESTINATION=/opt/dfhack/hack/ruby - ) - - cmake-utils_src_configure -} - -DOCS="" -src_install() { - cmake-utils_src_install - - dobin "$T"/dfhack{,-run} -} - -pkg_postinst() { - elog "Due to Dwarf Fortress' special needs regarding working directory," - elog "specifying relative paths to DFHack plugins can give unintended results." - elog - elog "Your dfhack.init should be placed in \${HOME}/.dwarf-fortress ," - elog "otherwise the example configuration will be used." - elog - elog "To start DFHack, please run dfhack" -} diff --git a/games-util/dfhack/files/dfhack-0.43.05_alpha_pre20160726/01-respect.patch b/games-util/dfhack/files/dfhack-0.43.05_alpha_pre20160726/01-respect.patch new file mode 100644 index 00000000..d06df3c6 --- /dev/null +++ b/games-util/dfhack/files/dfhack-0.43.05_alpha_pre20160726/01-respect.patch @@ -0,0 +1,92 @@ +Respect DFHACK_DATA_DESTINATION + +From: eroen + + +--- + CMakeLists.txt | 2 +- + library/CMakeLists.txt | 3 +++ + library/Core.cpp | 14 ++++++++++---- + 3 files changed, 14 insertions(+), 5 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 10a831c..9d49af4 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -125,7 +125,7 @@ ENDIF() + # external tools will be installed here: + SET(DFHACK_BINARY_DESTINATION .) + # dfhack data goes here: +-SET(DFHACK_DATA_DESTINATION hack) ++SET(DFHACK_DATA_DESTINATION hack CACHE INTERNAL "") + # plugin libs go here: + SET(DFHACK_PLUGIN_DESTINATION hack/plugins) + # dfhack header files go here: +diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt +index d3e3480..9bbc2ed 100644 +--- a/library/CMakeLists.txt ++++ b/library/CMakeLists.txt +@@ -78,6 +78,9 @@ RemoteServer.cpp + RemoteTools.cpp + ) + ++set_property( SOURCE "Core.cpp" APPEND PROPERTY COMPILE_DEFINITIONS ++ "DFHACK_DATA_DESTINATION=\"${DFHACK_DATA_DESTINATION}\"" ) ++ + SET(MAIN_SOURCES_WINDOWS + Console-windows.cpp + Hooks-windows.cpp +diff --git a/library/Core.cpp b/library/Core.cpp +index fb1dd80..3caec53 100644 +--- a/library/Core.cpp ++++ b/library/Core.cpp +@@ -75,6 +75,7 @@ using namespace DFHack; + #include + #include + #include ++#include + #include + #include "tinythread.h" + #include "md5wrapper.h" +@@ -375,7 +376,7 @@ static command_result runRubyScript(color_ostream &out, PluginManager *plug_mgr, + rbcmd += "'" + args[i] + "', "; + rbcmd += "]\n"; + +- rbcmd += "catch(:script_finished) { load './hack/scripts/" + name + ".rb' }"; ++ rbcmd += "catch(:script_finished) { load '" DFHACK_DATA_DESTINATION "/scripts/" + name + ".rb' }"; + + return plug_mgr->ruby->eval_ruby(out, rbcmd.c_str()); + } +@@ -493,6 +494,7 @@ void Core::getScriptPaths(std::vector *dest) + } + dest->push_back(df_path + "/raw/scripts"); + dest->push_back(df_path + "/hack/scripts"); ++ dest->push_back(DFHACK_DATA_DESTINATION "/scripts"); + for (auto it = script_paths[1].begin(); it != script_paths[1].end(); ++it) + dest->push_back(*it); + } +@@ -1440,7 +1442,11 @@ void Core::fatal (std::string output) + std::string Core::getHackPath() + { + #ifdef LINUX_BUILD +- return p->getPath() + "/hack/"; ++ if(strncmp(DFHACK_DATA_DESTINATION, "hack", 5) == 0) ++ // This is the default value ++ return p->getPath() + "/hack/"; ++ else ++ return DFHACK_DATA_DESTINATION "/"; + #else + return p->getPath() + "\\hack\\"; + #endif +@@ -1459,9 +1465,9 @@ bool Core::Init() + + // find out what we are... + #ifdef LINUX_BUILD +- const char * path = "hack/symbols.xml"; ++ const char * path = DFHACK_DATA_DESTINATION "/symbols.xml"; + #else +- const char * path = "hack\\symbols.xml"; ++ const char * path = DFHACK_DATA_DESTINATION "\\symbols.xml"; + #endif + vif = new DFHack::VersionInfoFactory(); + cerr << "Identifying DF version.\n"; diff --git a/games-util/dfhack/files/dfhack-0.43.05_alpha_pre20160726/02-respect-dfhack_lua_destination.patch b/games-util/dfhack/files/dfhack-0.43.05_alpha_pre20160726/02-respect-dfhack_lua_destination.patch new file mode 100644 index 00000000..1c7c6546 --- /dev/null +++ b/games-util/dfhack/files/dfhack-0.43.05_alpha_pre20160726/02-respect-dfhack_lua_destination.patch @@ -0,0 +1,1176 @@ +respect DFHACK_LUA_DESTINATION + +From: eroen + + +--- + CMakeLists.txt | 3 + depends/lua/CMakeLists.txt | 5 + depends/lua/include/luaconf.h | 553 -------------------------------------- + depends/lua/include/luaconf.h.in | 553 ++++++++++++++++++++++++++++++++++++++ + 4 files changed, 559 insertions(+), 555 deletions(-) + delete mode 100644 depends/lua/include/luaconf.h + create mode 100644 depends/lua/include/luaconf.h.in + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 9d49af4..f8b65ba 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -131,7 +131,7 @@ SET(DFHACK_PLUGIN_DESTINATION hack/plugins) + # dfhack header files go here: + SET(DFHACK_INCLUDES_DESTINATION hack/include) + # dfhack lua files go here: +-SET(DFHACK_LUA_DESTINATION hack/lua) ++SET(DFHACK_LUA_DESTINATION hack/lua CACHE INTERNAL "") + # the windows .lib file goes here: + SET(DFHACK_DEVLIB_DESTINATION hack) + +@@ -183,6 +183,7 @@ else() + endif() + find_package(ZLIB REQUIRED) + include_directories(depends/protobuf) ++include_directories("${CMAKE_CURRENT_BINARY_DIR}/depends/lua/include") + include_directories(depends/lua/include) + include_directories(depends/md5) + include_directories(depends/jsoncpp) +diff --git a/depends/lua/CMakeLists.txt b/depends/lua/CMakeLists.txt +index b77bce6..3fa0859 100644 +--- a/depends/lua/CMakeLists.txt ++++ b/depends/lua/CMakeLists.txt +@@ -15,6 +15,10 @@ IF(UNIX) + SET(CMAKE_C_FLAGS "-m32") + ENDIF() + ++configure_file("include/luaconf.h.in" "include/luaconf.h" @ONLY) ++SET_SOURCE_FILES_PROPERTIES("${CMAKE_CURRENT_BINARY_DIR}/include" PROPERTIES HEADER_FILE_ONLY TRUE) ++include_directories("${CMAKE_CURRENT_BINARY_DIR}/include") ++ + SET (HDR_LIBLUA + include/lapi.h + include/lauxlib.h +@@ -35,7 +39,6 @@ include/lstring.h + include/ltable.h + include/ltm.h + include/lua.h +-include/luaconf.h + include/lualib.h + include/lundump.h + include/lvm.h +diff --git a/depends/lua/include/luaconf.h b/depends/lua/include/luaconf.h +deleted file mode 100644 +index af09ffb..0000000 +--- a/depends/lua/include/luaconf.h ++++ /dev/null +@@ -1,553 +0,0 @@ +-/* +-** $Id: luaconf.h,v 1.176.1.1 2013/04/12 18:48:47 roberto Exp $ +-** Configuration file for Lua +-** See Copyright Notice in lua.h +-*/ +- +- +-#ifndef lconfig_h +-#define lconfig_h +- +-#include +-#include +- +- +-/* +-** ================================================================== +-** Search for "@@" to find all configurable definitions. +-** =================================================================== +-*/ +- +- +-/* +-@@ LUA_ANSI controls the use of non-ansi features. +-** CHANGE it (define it) if you want Lua to avoid the use of any +-** non-ansi feature or library. +-*/ +-#if !defined(LUA_ANSI) && defined(__STRICT_ANSI__) +-#define LUA_ANSI +-#endif +- +- +-#if !defined(LUA_ANSI) && defined(_WIN32) && !defined(_WIN32_WCE) +-#define LUA_WIN /* enable goodies for regular Windows platforms */ +-#endif +- +-#if defined(LUA_WIN) +-#define LUA_DL_DLL +-#define LUA_USE_AFORMAT /* assume 'printf' handles 'aA' specifiers */ +-#endif +- +- +- +-#if defined(LUA_USE_LINUX) +-#define LUA_USE_POSIX +-#define LUA_USE_DLOPEN /* needs an extra library: -ldl */ +-#define LUA_USE_READLINE /* needs some extra libraries */ +-#define LUA_USE_STRTODHEX /* assume 'strtod' handles hex formats */ +-#define LUA_USE_AFORMAT /* assume 'printf' handles 'aA' specifiers */ +-#define LUA_USE_LONGLONG /* assume support for long long */ +-#endif +- +-#if defined(LUA_USE_MACOSX) +-#define LUA_USE_POSIX +-#define LUA_USE_DLOPEN /* does not need -ldl */ +-#define LUA_USE_READLINE /* needs an extra library: -lreadline */ +-#define LUA_USE_STRTODHEX /* assume 'strtod' handles hex formats */ +-#define LUA_USE_AFORMAT /* assume 'printf' handles 'aA' specifiers */ +-#define LUA_USE_LONGLONG /* assume support for long long */ +-#endif +- +- +- +-/* +-@@ LUA_USE_POSIX includes all functionality listed as X/Open System +-@* Interfaces Extension (XSI). +-** CHANGE it (define it) if your system is XSI compatible. +-*/ +-#if defined(LUA_USE_POSIX) +-#define LUA_USE_MKSTEMP +-#define LUA_USE_ISATTY +-#define LUA_USE_POPEN +-#define LUA_USE_ULONGJMP +-#define LUA_USE_GMTIME_R +-#endif +- +- +- +-/* +-@@ LUA_PATH_DEFAULT is the default path that Lua uses to look for +-@* Lua libraries. +-@@ LUA_CPATH_DEFAULT is the default path that Lua uses to look for +-@* C libraries. +-** CHANGE them if your machine has a non-conventional directory +-** hierarchy or if you want to install your libraries in +-** non-conventional directories. +-*/ +-#if defined(_WIN32) /* { */ +-/* +-** In Windows, any exclamation mark ('!') in the path is replaced by the +-** path of the directory of the executable file of the current process. +-*/ +-#define LUA_LDIR "!\\hack\\lua\\" +-#define LUA_CDIR "!\\" +-#define LUA_PATH_DEFAULT \ +- LUA_LDIR"?.lua;" LUA_LDIR"?\\init.lua;" ".\\?.lua" +-#define LUA_CPATH_DEFAULT \ +- LUA_CDIR"?.dll;" ".\\?.dll" +- +-#else /* }{ */ +- +-#define LUA_LDIR "./hack/lua/" +-#define LUA_CDIR "./hack/" +-#define LUA_PATH_DEFAULT \ +- LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" "./?.lua" +-#define LUA_CPATH_DEFAULT \ +- LUA_CDIR"?.so;" "./?.so" +-#endif /* } */ +- +-#define LUA_PATH "DFHACK_LUA_PATH" +-#define LUA_CPATH "DFHACK_LUA_CPATH" +- +-/* +-@@ LUA_DIRSEP is the directory separator (for submodules). +-** CHANGE it if your machine does not use "/" as the directory separator +-** and is not Windows. (On Windows Lua automatically uses "\".) +-*/ +-#if defined(_WIN32) +-#define LUA_DIRSEP "\\" +-#else +-#define LUA_DIRSEP "/" +-#endif +- +- +-/* +-@@ LUA_ENV is the name of the variable that holds the current +-@@ environment, used to access global names. +-** CHANGE it if you do not like this name. +-*/ +-#define LUA_ENV "_ENV" +- +- +-/* +-@@ LUA_API is a mark for all core API functions. +-@@ LUALIB_API is a mark for all auxiliary library functions. +-@@ LUAMOD_API is a mark for all standard library opening functions. +-** CHANGE them if you need to define those functions in some special way. +-** For instance, if you want to create one Windows DLL with the core and +-** the libraries, you may want to use the following definition (define +-** LUA_BUILD_AS_DLL to get it). +-*/ +-#if defined(LUA_BUILD_AS_DLL) /* { */ +- +-#if defined(_MSC_VER) +-#if defined(LUA_CORE) || defined(LUA_LIB) /* { */ +-#define LUA_API __declspec(dllexport) +-#else /* }{ */ +-#define LUA_API __declspec(dllimport) +-#endif /* } */ +-#else +-#define LUA_API __attribute__ ((visibility("default"))) +-#endif +- +-#else /* }{ */ +- +-#define LUA_API extern +- +-#endif /* } */ +- +- +-/* more often than not the libs go together with the core */ +-#define LUALIB_API LUA_API +-#define LUAMOD_API LUALIB_API +- +- +-/* +-@@ LUAI_FUNC is a mark for all extern functions that are not to be +-@* exported to outside modules. +-@@ LUAI_DDEF and LUAI_DDEC are marks for all extern (const) variables +-@* that are not to be exported to outside modules (LUAI_DDEF for +-@* definitions and LUAI_DDEC for declarations). +-** CHANGE them if you need to mark them in some special way. Elf/gcc +-** (versions 3.2 and later) mark them as "hidden" to optimize access +-** when Lua is compiled as a shared library. Not all elf targets support +-** this attribute. Unfortunately, gcc does not offer a way to check +-** whether the target offers that support, and those without support +-** give a warning about it. To avoid these warnings, change to the +-** default definition. +-*/ +-#if defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 302) && \ +- defined(__ELF__) /* { */ +-#define LUAI_FUNC __attribute__((visibility("hidden"))) extern +-#define LUAI_DDEC LUAI_FUNC +-#define LUAI_DDEF /* empty */ +- +-#else /* }{ */ +-#define LUAI_FUNC extern +-#define LUAI_DDEC extern +-#define LUAI_DDEF /* empty */ +-#endif /* } */ +- +- +- +-/* +-@@ LUA_QL describes how error messages quote program elements. +-** CHANGE it if you want a different appearance. +-*/ +-#define LUA_QL(x) "'" x "'" +-#define LUA_QS LUA_QL("%s") +- +- +-/* +-@@ LUA_IDSIZE gives the maximum size for the description of the source +-@* of a function in debug information. +-** CHANGE it if you want a different size. +-*/ +-#define LUA_IDSIZE 60 +- +- +-/* +-@@ luai_writestring/luai_writeline define how 'print' prints its results. +-** They are only used in libraries and the stand-alone program. (The #if +-** avoids including 'stdio.h' everywhere.) +-*/ +-#if defined(LUA_LIB) || defined(lua_c) +-#include +-#define luai_writestring(s,l) fwrite((s), sizeof(char), (l), stdout) +-#define luai_writeline() (luai_writestring("\n", 1), fflush(stdout)) +-#endif +- +-/* +-@@ luai_writestringerror defines how to print error messages. +-** (A format string with one argument is enough for Lua...) +-*/ +-#define luai_writestringerror(s,p) \ +- (fprintf(stderr, (s), (p)), fflush(stderr)) +- +- +-/* +-@@ LUAI_MAXSHORTLEN is the maximum length for short strings, that is, +-** strings that are internalized. (Cannot be smaller than reserved words +-** or tags for metamethods, as these strings must be internalized; +-** #("function") = 8, #("__newindex") = 10.) +-*/ +-#define LUAI_MAXSHORTLEN 40 +- +- +- +-/* +-** {================================================================== +-** Compatibility with previous versions +-** =================================================================== +-*/ +- +-/* +-@@ LUA_COMPAT_ALL controls all compatibility options. +-** You can define it to get all options, or change specific options +-** to fit your specific needs. +-*/ +-#if defined(LUA_COMPAT_ALL) /* { */ +- +-/* +-@@ LUA_COMPAT_UNPACK controls the presence of global 'unpack'. +-** You can replace it with 'table.unpack'. +-*/ +-#define LUA_COMPAT_UNPACK +- +-/* +-@@ LUA_COMPAT_LOADERS controls the presence of table 'package.loaders'. +-** You can replace it with 'package.searchers'. +-*/ +-#define LUA_COMPAT_LOADERS +- +-/* +-@@ macro 'lua_cpcall' emulates deprecated function lua_cpcall. +-** You can call your C function directly (with light C functions). +-*/ +-#define lua_cpcall(L,f,u) \ +- (lua_pushcfunction(L, (f)), \ +- lua_pushlightuserdata(L,(u)), \ +- lua_pcall(L,1,0,0)) +- +- +-/* +-@@ LUA_COMPAT_LOG10 defines the function 'log10' in the math library. +-** You can rewrite 'log10(x)' as 'log(x, 10)'. +-*/ +-#define LUA_COMPAT_LOG10 +- +-/* +-@@ LUA_COMPAT_LOADSTRING defines the function 'loadstring' in the base +-** library. You can rewrite 'loadstring(s)' as 'load(s)'. +-*/ +-#define LUA_COMPAT_LOADSTRING +- +-/* +-@@ LUA_COMPAT_MAXN defines the function 'maxn' in the table library. +-*/ +-#define LUA_COMPAT_MAXN +- +-/* +-@@ The following macros supply trivial compatibility for some +-** changes in the API. The macros themselves document how to +-** change your code to avoid using them. +-*/ +-#define lua_strlen(L,i) lua_rawlen(L, (i)) +- +-#define lua_objlen(L,i) lua_rawlen(L, (i)) +- +-#define lua_equal(L,idx1,idx2) lua_compare(L,(idx1),(idx2),LUA_OPEQ) +-#define lua_lessthan(L,idx1,idx2) lua_compare(L,(idx1),(idx2),LUA_OPLT) +- +-/* +-@@ LUA_COMPAT_MODULE controls compatibility with previous +-** module functions 'module' (Lua) and 'luaL_register' (C). +-*/ +-#define LUA_COMPAT_MODULE +- +-#endif /* } */ +- +-/* }================================================================== */ +- +- +- +-/* +-@@ LUAI_BITSINT defines the number of bits in an int. +-** CHANGE here if Lua cannot automatically detect the number of bits of +-** your machine. Probably you do not need to change this. +-*/ +-/* avoid overflows in comparison */ +-#if INT_MAX-20 < 32760 /* { */ +-#define LUAI_BITSINT 16 +-#elif INT_MAX > 2147483640L /* }{ */ +-/* int has at least 32 bits */ +-#define LUAI_BITSINT 32 +-#else /* }{ */ +-#error "you must define LUA_BITSINT with number of bits in an integer" +-#endif /* } */ +- +- +-/* +-@@ LUA_INT32 is an signed integer with exactly 32 bits. +-@@ LUAI_UMEM is an unsigned integer big enough to count the total +-@* memory used by Lua. +-@@ LUAI_MEM is a signed integer big enough to count the total memory +-@* used by Lua. +-** CHANGE here if for some weird reason the default definitions are not +-** good enough for your machine. Probably you do not need to change +-** this. +-*/ +-#if LUAI_BITSINT >= 32 /* { */ +-#define LUA_INT32 int +-#define LUAI_UMEM size_t +-#define LUAI_MEM ptrdiff_t +-#else /* }{ */ +-/* 16-bit ints */ +-#define LUA_INT32 long +-#define LUAI_UMEM unsigned long +-#define LUAI_MEM long +-#endif /* } */ +- +- +-/* +-@@ LUAI_MAXSTACK limits the size of the Lua stack. +-** CHANGE it if you need a different limit. This limit is arbitrary; +-** its only purpose is to stop Lua to consume unlimited stack +-** space (and to reserve some numbers for pseudo-indices). +-*/ +-#if LUAI_BITSINT >= 32 +-#define LUAI_MAXSTACK 1000000 +-#else +-#define LUAI_MAXSTACK 15000 +-#endif +- +-/* reserve some space for error handling */ +-#define LUAI_FIRSTPSEUDOIDX (-LUAI_MAXSTACK - 1000) +- +- +- +- +-/* +-@@ LUAL_BUFFERSIZE is the buffer size used by the lauxlib buffer system. +-** CHANGE it if it uses too much C-stack space. +-*/ +-#define LUAL_BUFFERSIZE BUFSIZ +- +- +- +- +-/* +-** {================================================================== +-@@ LUA_NUMBER is the type of numbers in Lua. +-** CHANGE the following definitions only if you want to build Lua +-** with a number type different from double. You may also need to +-** change lua_number2int & lua_number2integer. +-** =================================================================== +-*/ +- +-#define LUA_NUMBER_DOUBLE +-#define LUA_NUMBER double +- +-/* +-@@ LUAI_UACNUMBER is the result of an 'usual argument conversion' +-@* over a number. +-*/ +-#define LUAI_UACNUMBER double +- +- +-/* +-@@ LUA_NUMBER_SCAN is the format for reading numbers. +-@@ LUA_NUMBER_FMT is the format for writing numbers. +-@@ lua_number2str converts a number to a string. +-@@ LUAI_MAXNUMBER2STR is maximum size of previous conversion. +-*/ +-#define LUA_NUMBER_SCAN "%lf" +-#define LUA_NUMBER_FMT "%.14g" +-#define lua_number2str(s,n) sprintf((s), LUA_NUMBER_FMT, (n)) +-#define LUAI_MAXNUMBER2STR 32 /* 16 digits, sign, point, and \0 */ +- +- +-/* +-@@ l_mathop allows the addition of an 'l' or 'f' to all math operations +-*/ +-#define l_mathop(x) (x) +- +- +-/* +-@@ lua_str2number converts a decimal numeric string to a number. +-@@ lua_strx2number converts an hexadecimal numeric string to a number. +-** In C99, 'strtod' does both conversions. C89, however, has no function +-** to convert floating hexadecimal strings to numbers. For these +-** systems, you can leave 'lua_strx2number' undefined and Lua will +-** provide its own implementation. +-*/ +-#define lua_str2number(s,p) strtod((s), (p)) +- +-#if defined(LUA_USE_STRTODHEX) +-#define lua_strx2number(s,p) strtod((s), (p)) +-#endif +- +- +-/* +-@@ The luai_num* macros define the primitive operations over numbers. +-*/ +- +-/* the following operations need the math library */ +-#if defined(lobject_c) || defined(lvm_c) +-#include +-#define luai_nummod(L,a,b) ((a) - l_mathop(floor)((a)/(b))*(b)) +-#define luai_numpow(L,a,b) (l_mathop(pow)(a,b)) +-#endif +- +-/* these are quite standard operations */ +-#if defined(LUA_CORE) +-#define luai_numadd(L,a,b) ((a)+(b)) +-#define luai_numsub(L,a,b) ((a)-(b)) +-#define luai_nummul(L,a,b) ((a)*(b)) +-#define luai_numdiv(L,a,b) ((a)/(b)) +-#define luai_numunm(L,a) (-(a)) +-#define luai_numeq(a,b) ((a)==(b)) +-#define luai_numlt(L,a,b) ((a)<(b)) +-#define luai_numle(L,a,b) ((a)<=(b)) +-#define luai_numisnan(L,a) (!luai_numeq((a), (a))) +-#endif +- +- +- +-/* +-@@ LUA_INTEGER is the integral type used by lua_pushinteger/lua_tointeger. +-** CHANGE that if ptrdiff_t is not adequate on your machine. (On most +-** machines, ptrdiff_t gives a good choice between int or long.) +-*/ +-#define LUA_INTEGER ptrdiff_t +- +-/* +-@@ LUA_UNSIGNED is the integral type used by lua_pushunsigned/lua_tounsigned. +-** It must have at least 32 bits. +-*/ +-#define LUA_UNSIGNED unsigned LUA_INT32 +- +- +- +-/* +-** Some tricks with doubles +-*/ +- +-#if defined(LUA_NUMBER_DOUBLE) && !defined(LUA_ANSI) /* { */ +-/* +-** The next definitions activate some tricks to speed up the +-** conversion from doubles to integer types, mainly to LUA_UNSIGNED. +-** +-@@ LUA_MSASMTRICK uses Microsoft assembler to avoid clashes with a +-** DirectX idiosyncrasy. +-** +-@@ LUA_IEEE754TRICK uses a trick that should work on any machine +-** using IEEE754 with a 32-bit integer type. +-** +-@@ LUA_IEEELL extends the trick to LUA_INTEGER; should only be +-** defined when LUA_INTEGER is a 32-bit integer. +-** +-@@ LUA_IEEEENDIAN is the endianness of doubles in your machine +-** (0 for little endian, 1 for big endian); if not defined, Lua will +-** check it dynamically for LUA_IEEE754TRICK (but not for LUA_NANTRICK). +-** +-@@ LUA_NANTRICK controls the use of a trick to pack all types into +-** a single double value, using NaN values to represent non-number +-** values. The trick only works on 32-bit machines (ints and pointers +-** are 32-bit values) with numbers represented as IEEE 754-2008 doubles +-** with conventional endianess (12345678 or 87654321), in CPUs that do +-** not produce signaling NaN values (all NaNs are quiet). +-*/ +- +-/* Microsoft compiler on a Pentium (32 bit) ? */ +-#if defined(LUA_WIN) && defined(_MSC_VER) && defined(_M_IX86) /* { */ +- +-#define LUA_MSASMTRICK +-#define LUA_IEEEENDIAN 0 +-#define LUA_NANTRICK +- +- +-/* pentium 32 bits? */ +-#elif defined(__i386__) || defined(__i386) || defined(__X86__) /* }{ */ +- +-#define LUA_IEEE754TRICK +-#define LUA_IEEELL +-#define LUA_IEEEENDIAN 0 +-#define LUA_NANTRICK +- +-/* pentium 64 bits? */ +-#elif defined(__x86_64) /* }{ */ +- +-#define LUA_IEEE754TRICK +-#define LUA_IEEEENDIAN 0 +- +-#elif defined(__POWERPC__) || defined(__ppc__) /* }{ */ +- +-#define LUA_IEEE754TRICK +-#define LUA_IEEEENDIAN 1 +- +-#else /* }{ */ +- +-/* assume IEEE754 and a 32-bit integer type */ +-#define LUA_IEEE754TRICK +- +-#endif /* } */ +- +-#endif /* } */ +- +-/* }================================================================== */ +- +- +- +- +-/* =================================================================== */ +- +-/* +-** Local configuration. You can use this space to add your redefinitions +-** without modifying the main part of the file. +-*/ +- +- +- +-#endif +- +diff --git a/depends/lua/include/luaconf.h.in b/depends/lua/include/luaconf.h.in +new file mode 100644 +index 0000000..e6d08b4 +--- /dev/null ++++ b/depends/lua/include/luaconf.h.in +@@ -0,0 +1,553 @@ ++/* ++** $Id: luaconf.h,v 1.176.1.1 2013/04/12 18:48:47 roberto Exp $ ++** Configuration file for Lua ++** See Copyright Notice in lua.h ++*/ ++ ++ ++#ifndef lconfig_h ++#define lconfig_h ++ ++#include ++#include ++ ++ ++/* ++** ================================================================== ++** Search for "@@" to find all configurable definitions. ++** =================================================================== ++*/ ++ ++ ++/* ++@@ LUA_ANSI controls the use of non-ansi features. ++** CHANGE it (define it) if you want Lua to avoid the use of any ++** non-ansi feature or library. ++*/ ++#if !defined(LUA_ANSI) && defined(__STRICT_ANSI__) ++#define LUA_ANSI ++#endif ++ ++ ++#if !defined(LUA_ANSI) && defined(_WIN32) && !defined(_WIN32_WCE) ++#define LUA_WIN /* enable goodies for regular Windows platforms */ ++#endif ++ ++#if defined(LUA_WIN) ++#define LUA_DL_DLL ++#define LUA_USE_AFORMAT /* assume 'printf' handles 'aA' specifiers */ ++#endif ++ ++ ++ ++#if defined(LUA_USE_LINUX) ++#define LUA_USE_POSIX ++#define LUA_USE_DLOPEN /* needs an extra library: -ldl */ ++#define LUA_USE_READLINE /* needs some extra libraries */ ++#define LUA_USE_STRTODHEX /* assume 'strtod' handles hex formats */ ++#define LUA_USE_AFORMAT /* assume 'printf' handles 'aA' specifiers */ ++#define LUA_USE_LONGLONG /* assume support for long long */ ++#endif ++ ++#if defined(LUA_USE_MACOSX) ++#define LUA_USE_POSIX ++#define LUA_USE_DLOPEN /* does not need -ldl */ ++#define LUA_USE_READLINE /* needs an extra library: -lreadline */ ++#define LUA_USE_STRTODHEX /* assume 'strtod' handles hex formats */ ++#define LUA_USE_AFORMAT /* assume 'printf' handles 'aA' specifiers */ ++#define LUA_USE_LONGLONG /* assume support for long long */ ++#endif ++ ++ ++ ++/* ++@@ LUA_USE_POSIX includes all functionality listed as X/Open System ++@* Interfaces Extension (XSI). ++** CHANGE it (define it) if your system is XSI compatible. ++*/ ++#if defined(LUA_USE_POSIX) ++#define LUA_USE_MKSTEMP ++#define LUA_USE_ISATTY ++#define LUA_USE_POPEN ++#define LUA_USE_ULONGJMP ++#define LUA_USE_GMTIME_R ++#endif ++ ++ ++ ++/* ++@@ LUA_PATH_DEFAULT is the default path that Lua uses to look for ++@* Lua libraries. ++@@ LUA_CPATH_DEFAULT is the default path that Lua uses to look for ++@* C libraries. ++** CHANGE them if your machine has a non-conventional directory ++** hierarchy or if you want to install your libraries in ++** non-conventional directories. ++*/ ++#if defined(_WIN32) /* { */ ++/* ++** In Windows, any exclamation mark ('!') in the path is replaced by the ++** path of the directory of the executable file of the current process. ++*/ ++#define LUA_LDIR "!\\hack\\lua\\" ++#define LUA_CDIR "!\\" ++#define LUA_PATH_DEFAULT \ ++ LUA_LDIR"?.lua;" LUA_LDIR"?\\init.lua;" ".\\?.lua" ++#define LUA_CPATH_DEFAULT \ ++ LUA_CDIR"?.dll;" ".\\?.dll" ++ ++#else /* }{ */ ++ ++#define LUA_LDIR "@DFHACK_LUA_DESTINATION@" "/" ++#define LUA_CDIR "./hack/" ++#define LUA_PATH_DEFAULT \ ++ LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" "./?.lua" ++#define LUA_CPATH_DEFAULT \ ++ LUA_CDIR"?.so;" "./?.so" ++#endif /* } */ ++ ++#define LUA_PATH "DFHACK_LUA_PATH" ++#define LUA_CPATH "DFHACK_LUA_CPATH" ++ ++/* ++@@ LUA_DIRSEP is the directory separator (for submodules). ++** CHANGE it if your machine does not use "/" as the directory separator ++** and is not Windows. (On Windows Lua automatically uses "\".) ++*/ ++#if defined(_WIN32) ++#define LUA_DIRSEP "\\" ++#else ++#define LUA_DIRSEP "/" ++#endif ++ ++ ++/* ++@@ LUA_ENV is the name of the variable that holds the current ++@@ environment, used to access global names. ++** CHANGE it if you do not like this name. ++*/ ++#define LUA_ENV "_ENV" ++ ++ ++/* ++@@ LUA_API is a mark for all core API functions. ++@@ LUALIB_API is a mark for all auxiliary library functions. ++@@ LUAMOD_API is a mark for all standard library opening functions. ++** CHANGE them if you need to define those functions in some special way. ++** For instance, if you want to create one Windows DLL with the core and ++** the libraries, you may want to use the following definition (define ++** LUA_BUILD_AS_DLL to get it). ++*/ ++#if defined(LUA_BUILD_AS_DLL) /* { */ ++ ++#if defined(_MSC_VER) ++#if defined(LUA_CORE) || defined(LUA_LIB) /* { */ ++#define LUA_API __declspec(dllexport) ++#else /* }{ */ ++#define LUA_API __declspec(dllimport) ++#endif /* } */ ++#else ++#define LUA_API __attribute__ ((visibility("default"))) ++#endif ++ ++#else /* }{ */ ++ ++#define LUA_API extern ++ ++#endif /* } */ ++ ++ ++/* more often than not the libs go together with the core */ ++#define LUALIB_API LUA_API ++#define LUAMOD_API LUALIB_API ++ ++ ++/* ++@@ LUAI_FUNC is a mark for all extern functions that are not to be ++@* exported to outside modules. ++@@ LUAI_DDEF and LUAI_DDEC are marks for all extern (const) variables ++@* that are not to be exported to outside modules (LUAI_DDEF for ++@* definitions and LUAI_DDEC for declarations). ++** CHANGE them if you need to mark them in some special way. Elf/gcc ++** (versions 3.2 and later) mark them as "hidden" to optimize access ++** when Lua is compiled as a shared library. Not all elf targets support ++** this attribute. Unfortunately, gcc does not offer a way to check ++** whether the target offers that support, and those without support ++** give a warning about it. To avoid these warnings, change to the ++** default definition. ++*/ ++#if defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 302) && \ ++ defined(__ELF__) /* { */ ++#define LUAI_FUNC __attribute__((visibility("hidden"))) extern ++#define LUAI_DDEC LUAI_FUNC ++#define LUAI_DDEF /* empty */ ++ ++#else /* }{ */ ++#define LUAI_FUNC extern ++#define LUAI_DDEC extern ++#define LUAI_DDEF /* empty */ ++#endif /* } */ ++ ++ ++ ++/* ++@@ LUA_QL describes how error messages quote program elements. ++** CHANGE it if you want a different appearance. ++*/ ++#define LUA_QL(x) "'" x "'" ++#define LUA_QS LUA_QL("%s") ++ ++ ++/* ++@@ LUA_IDSIZE gives the maximum size for the description of the source ++@* of a function in debug information. ++** CHANGE it if you want a different size. ++*/ ++#define LUA_IDSIZE 60 ++ ++ ++/* ++@@ luai_writestring/luai_writeline define how 'print' prints its results. ++** They are only used in libraries and the stand-alone program. (The #if ++** avoids including 'stdio.h' everywhere.) ++*/ ++#if defined(LUA_LIB) || defined(lua_c) ++#include ++#define luai_writestring(s,l) fwrite((s), sizeof(char), (l), stdout) ++#define luai_writeline() (luai_writestring("\n", 1), fflush(stdout)) ++#endif ++ ++/* ++@@ luai_writestringerror defines how to print error messages. ++** (A format string with one argument is enough for Lua...) ++*/ ++#define luai_writestringerror(s,p) \ ++ (fprintf(stderr, (s), (p)), fflush(stderr)) ++ ++ ++/* ++@@ LUAI_MAXSHORTLEN is the maximum length for short strings, that is, ++** strings that are internalized. (Cannot be smaller than reserved words ++** or tags for metamethods, as these strings must be internalized; ++** #("function") = 8, #("__newindex") = 10.) ++*/ ++#define LUAI_MAXSHORTLEN 40 ++ ++ ++ ++/* ++** {================================================================== ++** Compatibility with previous versions ++** =================================================================== ++*/ ++ ++/* ++@@ LUA_COMPAT_ALL controls all compatibility options. ++** You can define it to get all options, or change specific options ++** to fit your specific needs. ++*/ ++#if defined(LUA_COMPAT_ALL) /* { */ ++ ++/* ++@@ LUA_COMPAT_UNPACK controls the presence of global 'unpack'. ++** You can replace it with 'table.unpack'. ++*/ ++#define LUA_COMPAT_UNPACK ++ ++/* ++@@ LUA_COMPAT_LOADERS controls the presence of table 'package.loaders'. ++** You can replace it with 'package.searchers'. ++*/ ++#define LUA_COMPAT_LOADERS ++ ++/* ++@@ macro 'lua_cpcall' emulates deprecated function lua_cpcall. ++** You can call your C function directly (with light C functions). ++*/ ++#define lua_cpcall(L,f,u) \ ++ (lua_pushcfunction(L, (f)), \ ++ lua_pushlightuserdata(L,(u)), \ ++ lua_pcall(L,1,0,0)) ++ ++ ++/* ++@@ LUA_COMPAT_LOG10 defines the function 'log10' in the math library. ++** You can rewrite 'log10(x)' as 'log(x, 10)'. ++*/ ++#define LUA_COMPAT_LOG10 ++ ++/* ++@@ LUA_COMPAT_LOADSTRING defines the function 'loadstring' in the base ++** library. You can rewrite 'loadstring(s)' as 'load(s)'. ++*/ ++#define LUA_COMPAT_LOADSTRING ++ ++/* ++@@ LUA_COMPAT_MAXN defines the function 'maxn' in the table library. ++*/ ++#define LUA_COMPAT_MAXN ++ ++/* ++@@ The following macros supply trivial compatibility for some ++** changes in the API. The macros themselves document how to ++** change your code to avoid using them. ++*/ ++#define lua_strlen(L,i) lua_rawlen(L, (i)) ++ ++#define lua_objlen(L,i) lua_rawlen(L, (i)) ++ ++#define lua_equal(L,idx1,idx2) lua_compare(L,(idx1),(idx2),LUA_OPEQ) ++#define lua_lessthan(L,idx1,idx2) lua_compare(L,(idx1),(idx2),LUA_OPLT) ++ ++/* ++@@ LUA_COMPAT_MODULE controls compatibility with previous ++** module functions 'module' (Lua) and 'luaL_register' (C). ++*/ ++#define LUA_COMPAT_MODULE ++ ++#endif /* } */ ++ ++/* }================================================================== */ ++ ++ ++ ++/* ++@@ LUAI_BITSINT defines the number of bits in an int. ++** CHANGE here if Lua cannot automatically detect the number of bits of ++** your machine. Probably you do not need to change this. ++*/ ++/* avoid overflows in comparison */ ++#if INT_MAX-20 < 32760 /* { */ ++#define LUAI_BITSINT 16 ++#elif INT_MAX > 2147483640L /* }{ */ ++/* int has at least 32 bits */ ++#define LUAI_BITSINT 32 ++#else /* }{ */ ++#error "you must define LUA_BITSINT with number of bits in an integer" ++#endif /* } */ ++ ++ ++/* ++@@ LUA_INT32 is an signed integer with exactly 32 bits. ++@@ LUAI_UMEM is an unsigned integer big enough to count the total ++@* memory used by Lua. ++@@ LUAI_MEM is a signed integer big enough to count the total memory ++@* used by Lua. ++** CHANGE here if for some weird reason the default definitions are not ++** good enough for your machine. Probably you do not need to change ++** this. ++*/ ++#if LUAI_BITSINT >= 32 /* { */ ++#define LUA_INT32 int ++#define LUAI_UMEM size_t ++#define LUAI_MEM ptrdiff_t ++#else /* }{ */ ++/* 16-bit ints */ ++#define LUA_INT32 long ++#define LUAI_UMEM unsigned long ++#define LUAI_MEM long ++#endif /* } */ ++ ++ ++/* ++@@ LUAI_MAXSTACK limits the size of the Lua stack. ++** CHANGE it if you need a different limit. This limit is arbitrary; ++** its only purpose is to stop Lua to consume unlimited stack ++** space (and to reserve some numbers for pseudo-indices). ++*/ ++#if LUAI_BITSINT >= 32 ++#define LUAI_MAXSTACK 1000000 ++#else ++#define LUAI_MAXSTACK 15000 ++#endif ++ ++/* reserve some space for error handling */ ++#define LUAI_FIRSTPSEUDOIDX (-LUAI_MAXSTACK - 1000) ++ ++ ++ ++ ++/* ++@@ LUAL_BUFFERSIZE is the buffer size used by the lauxlib buffer system. ++** CHANGE it if it uses too much C-stack space. ++*/ ++#define LUAL_BUFFERSIZE BUFSIZ ++ ++ ++ ++ ++/* ++** {================================================================== ++@@ LUA_NUMBER is the type of numbers in Lua. ++** CHANGE the following definitions only if you want to build Lua ++** with a number type different from double. You may also need to ++** change lua_number2int & lua_number2integer. ++** =================================================================== ++*/ ++ ++#define LUA_NUMBER_DOUBLE ++#define LUA_NUMBER double ++ ++/* ++@@ LUAI_UACNUMBER is the result of an 'usual argument conversion' ++@* over a number. ++*/ ++#define LUAI_UACNUMBER double ++ ++ ++/* ++@@ LUA_NUMBER_SCAN is the format for reading numbers. ++@@ LUA_NUMBER_FMT is the format for writing numbers. ++@@ lua_number2str converts a number to a string. ++@@ LUAI_MAXNUMBER2STR is maximum size of previous conversion. ++*/ ++#define LUA_NUMBER_SCAN "%lf" ++#define LUA_NUMBER_FMT "%.14g" ++#define lua_number2str(s,n) sprintf((s), LUA_NUMBER_FMT, (n)) ++#define LUAI_MAXNUMBER2STR 32 /* 16 digits, sign, point, and \0 */ ++ ++ ++/* ++@@ l_mathop allows the addition of an 'l' or 'f' to all math operations ++*/ ++#define l_mathop(x) (x) ++ ++ ++/* ++@@ lua_str2number converts a decimal numeric string to a number. ++@@ lua_strx2number converts an hexadecimal numeric string to a number. ++** In C99, 'strtod' does both conversions. C89, however, has no function ++** to convert floating hexadecimal strings to numbers. For these ++** systems, you can leave 'lua_strx2number' undefined and Lua will ++** provide its own implementation. ++*/ ++#define lua_str2number(s,p) strtod((s), (p)) ++ ++#if defined(LUA_USE_STRTODHEX) ++#define lua_strx2number(s,p) strtod((s), (p)) ++#endif ++ ++ ++/* ++@@ The luai_num* macros define the primitive operations over numbers. ++*/ ++ ++/* the following operations need the math library */ ++#if defined(lobject_c) || defined(lvm_c) ++#include ++#define luai_nummod(L,a,b) ((a) - l_mathop(floor)((a)/(b))*(b)) ++#define luai_numpow(L,a,b) (l_mathop(pow)(a,b)) ++#endif ++ ++/* these are quite standard operations */ ++#if defined(LUA_CORE) ++#define luai_numadd(L,a,b) ((a)+(b)) ++#define luai_numsub(L,a,b) ((a)-(b)) ++#define luai_nummul(L,a,b) ((a)*(b)) ++#define luai_numdiv(L,a,b) ((a)/(b)) ++#define luai_numunm(L,a) (-(a)) ++#define luai_numeq(a,b) ((a)==(b)) ++#define luai_numlt(L,a,b) ((a)<(b)) ++#define luai_numle(L,a,b) ((a)<=(b)) ++#define luai_numisnan(L,a) (!luai_numeq((a), (a))) ++#endif ++ ++ ++ ++/* ++@@ LUA_INTEGER is the integral type used by lua_pushinteger/lua_tointeger. ++** CHANGE that if ptrdiff_t is not adequate on your machine. (On most ++** machines, ptrdiff_t gives a good choice between int or long.) ++*/ ++#define LUA_INTEGER ptrdiff_t ++ ++/* ++@@ LUA_UNSIGNED is the integral type used by lua_pushunsigned/lua_tounsigned. ++** It must have at least 32 bits. ++*/ ++#define LUA_UNSIGNED unsigned LUA_INT32 ++ ++ ++ ++/* ++** Some tricks with doubles ++*/ ++ ++#if defined(LUA_NUMBER_DOUBLE) && !defined(LUA_ANSI) /* { */ ++/* ++** The next definitions activate some tricks to speed up the ++** conversion from doubles to integer types, mainly to LUA_UNSIGNED. ++** ++@@ LUA_MSASMTRICK uses Microsoft assembler to avoid clashes with a ++** DirectX idiosyncrasy. ++** ++@@ LUA_IEEE754TRICK uses a trick that should work on any machine ++** using IEEE754 with a 32-bit integer type. ++** ++@@ LUA_IEEELL extends the trick to LUA_INTEGER; should only be ++** defined when LUA_INTEGER is a 32-bit integer. ++** ++@@ LUA_IEEEENDIAN is the endianness of doubles in your machine ++** (0 for little endian, 1 for big endian); if not defined, Lua will ++** check it dynamically for LUA_IEEE754TRICK (but not for LUA_NANTRICK). ++** ++@@ LUA_NANTRICK controls the use of a trick to pack all types into ++** a single double value, using NaN values to represent non-number ++** values. The trick only works on 32-bit machines (ints and pointers ++** are 32-bit values) with numbers represented as IEEE 754-2008 doubles ++** with conventional endianess (12345678 or 87654321), in CPUs that do ++** not produce signaling NaN values (all NaNs are quiet). ++*/ ++ ++/* Microsoft compiler on a Pentium (32 bit) ? */ ++#if defined(LUA_WIN) && defined(_MSC_VER) && defined(_M_IX86) /* { */ ++ ++#define LUA_MSASMTRICK ++#define LUA_IEEEENDIAN 0 ++#define LUA_NANTRICK ++ ++ ++/* pentium 32 bits? */ ++#elif defined(__i386__) || defined(__i386) || defined(__X86__) /* }{ */ ++ ++#define LUA_IEEE754TRICK ++#define LUA_IEEELL ++#define LUA_IEEEENDIAN 0 ++#define LUA_NANTRICK ++ ++/* pentium 64 bits? */ ++#elif defined(__x86_64) /* }{ */ ++ ++#define LUA_IEEE754TRICK ++#define LUA_IEEEENDIAN 0 ++ ++#elif defined(__POWERPC__) || defined(__ppc__) /* }{ */ ++ ++#define LUA_IEEE754TRICK ++#define LUA_IEEEENDIAN 1 ++ ++#else /* }{ */ ++ ++/* assume IEEE754 and a 32-bit integer type */ ++#define LUA_IEEE754TRICK ++ ++#endif /* } */ ++ ++#endif /* } */ ++ ++/* }================================================================== */ ++ ++ ++ ++ ++/* =================================================================== */ ++ ++/* ++** Local configuration. You can use this space to add your redefinitions ++** without modifying the main part of the file. ++*/ ++ ++ ++ ++#endif ++ diff --git a/games-util/dfhack/files/dfhack-0.43.05_alpha_pre20160726/03-respect-0.patch b/games-util/dfhack/files/dfhack-0.43.05_alpha_pre20160726/03-respect-0.patch new file mode 100644 index 00000000..b6b073fb --- /dev/null +++ b/games-util/dfhack/files/dfhack-0.43.05_alpha_pre20160726/03-respect-0.patch @@ -0,0 +1,62 @@ +respect DFHACK_PLUGIN_DESTINATION + +From: eroen + + +--- + CMakeLists.txt | 2 +- + library/CMakeLists.txt | 2 ++ + library/PluginManager.cpp | 7 ++++++- + 3 files changed, 9 insertions(+), 2 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index f8b65ba..17f6b65 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -127,7 +127,7 @@ SET(DFHACK_BINARY_DESTINATION .) + # dfhack data goes here: + SET(DFHACK_DATA_DESTINATION hack CACHE INTERNAL "") + # plugin libs go here: +-SET(DFHACK_PLUGIN_DESTINATION hack/plugins) ++SET(DFHACK_PLUGIN_DESTINATION hack/plugins CACHE INTERNAL "") + # dfhack header files go here: + SET(DFHACK_INCLUDES_DESTINATION hack/include) + # dfhack lua files go here: +diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt +index 9bbc2ed..a69681b 100644 +--- a/library/CMakeLists.txt ++++ b/library/CMakeLists.txt +@@ -80,6 +80,8 @@ RemoteTools.cpp + + set_property( SOURCE "Core.cpp" APPEND PROPERTY COMPILE_DEFINITIONS + "DFHACK_DATA_DESTINATION=\"${DFHACK_DATA_DESTINATION}\"" ) ++set_property( SOURCE "PluginManager.cpp" APPEND PROPERTY COMPILE_DEFINITIONS ++ "DFHACK_PLUGIN_DESTINATION=\"${DFHACK_PLUGIN_DESTINATION}\"" ) + + SET(MAIN_SOURCES_WINDOWS + Console-windows.cpp +diff --git a/library/PluginManager.cpp b/library/PluginManager.cpp +index 774d191..e2e1c27 100644 +--- a/library/PluginManager.cpp ++++ b/library/PluginManager.cpp +@@ -52,6 +52,7 @@ using namespace std; + using namespace tthread; + + #include ++#include + + #define MUTEX_GUARD(lock) auto lock_##__LINE__ = make_mutex_guard(lock); + template +@@ -70,7 +71,11 @@ tthread::lock_guard make_mutex_guard (T *mutex) + + static string getPluginPath() + { +- return Core::getInstance().getHackPath() + "plugins/"; ++ if(strncmp(DFHACK_PLUGIN_DESTINATION, "hack/plugins", 13) == 0) ++ // This is the default value ++ return Core::getInstance().getHackPath() + "plugins/"; ++ else ++ return DFHACK_PLUGIN_DESTINATION "/"; + } + + static string getPluginPath (std::string name) diff --git a/games-util/dfhack/files/dfhack-0.43.05_alpha_pre20160726/04-respect-1.patch b/games-util/dfhack/files/dfhack-0.43.05_alpha_pre20160726/04-respect-1.patch new file mode 100644 index 00000000..47c169a5 --- /dev/null +++ b/games-util/dfhack/files/dfhack-0.43.05_alpha_pre20160726/04-respect-1.patch @@ -0,0 +1,61 @@ +respect DFHACK_LIBRARY_DESTINATION + +From: eroen + + +--- + CMakeLists.txt | 4 ++-- + plugins/ruby/CMakeLists.txt | 2 ++ + plugins/ruby/ruby.cpp | 6 +++--- + 3 files changed, 7 insertions(+), 5 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 17f6b65..60af461 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -115,11 +115,11 @@ set(DFHACK_VERSION "${DF_VERSION}-${DFHACK_RELEASE}") + # the dfhack libraries will be installed here: + IF(UNIX) + # put the lib into DF/hack +- SET(DFHACK_LIBRARY_DESTINATION hack) ++ SET(DFHACK_LIBRARY_DESTINATION hack CACHE INTERNAL "") + SET(DFHACK_EGGY_DESTINATION libs) + ELSE() + # windows is crap, therefore we can't do nice things with it. leave the libs on a nasty pile... +- SET(DFHACK_LIBRARY_DESTINATION .) ++ SET(DFHACK_LIBRARY_DESTINATION . CACHE INTERNAL "") + SET(DFHACK_EGGY_DESTINATION .) + ENDIF() + # external tools will be installed here: +diff --git a/plugins/ruby/CMakeLists.txt b/plugins/ruby/CMakeLists.txt +index 3aeac6d..f2974f6 100644 +--- a/plugins/ruby/CMakeLists.txt ++++ b/plugins/ruby/CMakeLists.txt +@@ -34,6 +34,8 @@ INCLUDE_DIRECTORIES("${dfhack_SOURCE_DIR}/depends/tthread") + + DFHACK_PLUGIN(ruby ruby.cpp LINK_LIBRARIES dfhack-tinythread) + ADD_DEPENDENCIES(ruby ruby-autogen-rb) ++set_property( SOURCE "ruby.cpp" APPEND PROPERTY COMPILE_DEFINITIONS ++ "DFHACK_LIBRARY_DESTINATION=\"${DFHACK_LIBRARY_DESTINATION}\"" ) + + INSTALL(FILES ${RUBYLIB} DESTINATION ${DFHACK_LIBRARY_DESTINATION}) + +diff --git a/plugins/ruby/ruby.cpp b/plugins/ruby/ruby.cpp +index adc451a..0dc423a 100644 +--- a/plugins/ruby/ruby.cpp ++++ b/plugins/ruby/ruby.cpp +@@ -325,11 +325,11 @@ static int df_loadruby(void) + { + const char *libpath = + #if defined(WIN32) +- "./libruby.dll"; ++ DFHACK_LIBRARY_DESTINATION "/libruby.dll"; + #elif defined(__APPLE__) +- "hack/libruby.dylib"; ++ DFHACK_LIBRARY_DESTINATION "/libruby.dylib"; + #else +- "hack/libruby.so"; ++ DFHACK_LIBRARY_DESTINATION "/libruby.so"; + #endif + + libruby_handle = OpenPlugin(libpath); diff --git a/games-util/dfhack/files/dfhack-0.43.05_alpha_pre20160726/05-introduce.patch b/games-util/dfhack/files/dfhack-0.43.05_alpha_pre20160726/05-introduce.patch new file mode 100644 index 00000000..c14a4fdb --- /dev/null +++ b/games-util/dfhack/files/dfhack-0.43.05_alpha_pre20160726/05-introduce.patch @@ -0,0 +1,570 @@ +introduce DFHACK_RUBY_DESTINATION + +From: eroen + + +--- + CMakeLists.txt | 2 + plugins/ruby/CMakeLists.txt | 8 + + plugins/ruby/ruby.cpp | 2 + plugins/ruby/ruby.rb | 247 ------------------------------------------- + plugins/ruby/ruby.rb.in | 247 +++++++++++++++++++++++++++++++++++++++++++ + 5 files changed, 256 insertions(+), 250 deletions(-) + delete mode 100644 plugins/ruby/ruby.rb + create mode 100644 plugins/ruby/ruby.rb.in + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 60af461..3f9f1b2 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -132,6 +132,8 @@ SET(DFHACK_PLUGIN_DESTINATION hack/plugins CACHE INTERNAL "") + SET(DFHACK_INCLUDES_DESTINATION hack/include) + # dfhack lua files go here: + SET(DFHACK_LUA_DESTINATION hack/lua CACHE INTERNAL "") ++# dfhack ruby files go here: ++SET(DFHACK_RUBY_DESTINATION hack/ruby CACHE INTERNAL "") + # the windows .lib file goes here: + SET(DFHACK_DEVLIB_DESTINATION hack) + +diff --git a/plugins/ruby/CMakeLists.txt b/plugins/ruby/CMakeLists.txt +index f2974f6..352af6a 100644 +--- a/plugins/ruby/CMakeLists.txt ++++ b/plugins/ruby/CMakeLists.txt +@@ -35,12 +35,16 @@ INCLUDE_DIRECTORIES("${dfhack_SOURCE_DIR}/depends/tthread") + DFHACK_PLUGIN(ruby ruby.cpp LINK_LIBRARIES dfhack-tinythread) + ADD_DEPENDENCIES(ruby ruby-autogen-rb) + set_property( SOURCE "ruby.cpp" APPEND PROPERTY COMPILE_DEFINITIONS +- "DFHACK_LIBRARY_DESTINATION=\"${DFHACK_LIBRARY_DESTINATION}\"" ) ++ "DFHACK_LIBRARY_DESTINATION=\"${DFHACK_LIBRARY_DESTINATION}\"" ++ "DFHACK_RUBY_DESTINATION=\"${DFHACK_RUBY_DESTINATION}\"") + + INSTALL(FILES ${RUBYLIB} DESTINATION ${DFHACK_LIBRARY_DESTINATION}) + ++configure_file( ruby.rb.in ruby.rb @ONLY ) + INSTALL(DIRECTORY . +- DESTINATION hack/ruby ++ DESTINATION ${DFHACK_RUBY_DESTINATION} + FILES_MATCHING PATTERN "*.rb") ++INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/ruby.rb ++ DESTINATION ${DFHACK_RUBY_DESTINATION}) + + INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${RUBYAUTOGEN} DESTINATION hack/ruby) +diff --git a/plugins/ruby/ruby.cpp b/plugins/ruby/ruby.cpp +index 0dc423a..bd5c430 100644 +--- a/plugins/ruby/ruby.cpp ++++ b/plugins/ruby/ruby.cpp +@@ -437,7 +437,7 @@ static void df_rubythread(void *p) + + // load the default ruby-level definitions in the background + state=0; +- rb_eval_string_protect("require './hack/ruby/ruby'", &state); ++ rb_eval_string_protect("require '" DFHACK_RUBY_DESTINATION "/ruby'", &state); + if (state) + dump_rb_error(); + +diff --git a/plugins/ruby/ruby.rb b/plugins/ruby/ruby.rb +deleted file mode 100644 +index 850ca09..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[gametype] +- 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(RUBY_PLATFORM =~ /mswin|mingw|cygwin/i ? './hack/ruby/ruby-autogen-win' : './hack/ruby/ruby-autogen-gcc') +- +-# load all modules +-Dir['./hack/ruby/*.rb'].each { |m| require m.chomp('.rb') if m !~ /ruby-autogen/ } +diff --git a/plugins/ruby/ruby.rb.in b/plugins/ruby/ruby.rb.in +new file mode 100644 +index 0000000..c458e19 +--- /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[gametype] ++ 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(RUBY_PLATFORM =~ /mswin|mingw|cygwin/i ? '@DFHACK_RUBY_DESTINATION@/ruby-autogen-win' : '@DFHACK_RUBY_DESTINATION@/ruby-autogen-gcc') ++ ++# load all modules ++Dir['@DFHACK_RUBY_DESTINATION@/*.rb'].each { |m| require m.chomp('.rb') if m !~ /ruby-autogen/ } diff --git a/games-util/dfhack/files/dfhack-0.43.05_alpha_pre20160726/series b/games-util/dfhack/files/dfhack-0.43.05_alpha_pre20160726/series new file mode 100644 index 00000000..706c489e --- /dev/null +++ b/games-util/dfhack/files/dfhack-0.43.05_alpha_pre20160726/series @@ -0,0 +1,6 @@ +# This series applies on GIT commit 29963f4b67b9edae74cd69e159bb63730b524d27 +01-respect.patch +02-respect-dfhack_lua_destination.patch +03-respect-0.patch +04-respect-1.patch +05-introduce.patch diff --git a/games-util/dfhack/files/dfhack-0.43.05_beta1/0001-Respect-DFHACK_DATA_DESTINATION.patch b/games-util/dfhack/files/dfhack-0.43.05_beta1/0001-Respect-DFHACK_DATA_DESTINATION.patch new file mode 100644 index 00000000..974a42f9 --- /dev/null +++ b/games-util/dfhack/files/dfhack-0.43.05_beta1/0001-Respect-DFHACK_DATA_DESTINATION.patch @@ -0,0 +1,95 @@ +From 7a33b82491455f073dddc0fc4c6223d03d4aaf19 Mon Sep 17 00:00:00 2001 +From: eroen +Date: Tue, 7 Mar 2017 22:43:57 +0100 +Subject: [PATCH 1/5] Respect DFHACK_DATA_DESTINATION + +--- + CMakeLists.txt | 2 +- + library/CMakeLists.txt | 3 +++ + library/Core.cpp | 14 ++++++++++---- + 3 files changed, 14 insertions(+), 5 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index c7c0835a..01a84b92 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -156,7 +156,7 @@ ENDIF() + # external tools will be installed here: + SET(DFHACK_BINARY_DESTINATION .) + # dfhack data goes here: +-SET(DFHACK_DATA_DESTINATION hack) ++SET(DFHACK_DATA_DESTINATION hack CACHE INTERNAL "") + # plugin libs go here: + SET(DFHACK_PLUGIN_DESTINATION hack/plugins) + # dfhack header files go here: +diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt +index 9f847799..ed1650e9 100644 +--- a/library/CMakeLists.txt ++++ b/library/CMakeLists.txt +@@ -78,6 +78,9 @@ RemoteServer.cpp + RemoteTools.cpp + ) + ++set_property( SOURCE "Core.cpp" APPEND PROPERTY COMPILE_DEFINITIONS ++ "DFHACK_DATA_DESTINATION=\"${DFHACK_DATA_DESTINATION}\"" ) ++ + SET(MAIN_SOURCES_WINDOWS + Console-windows.cpp + Hooks-windows.cpp +diff --git a/library/Core.cpp b/library/Core.cpp +index 642da61e..23917833 100644 +--- a/library/Core.cpp ++++ b/library/Core.cpp +@@ -75,6 +75,7 @@ using namespace DFHack; + #include + #include + #include ++#include + #include + #include "tinythread.h" + #include "md5wrapper.h" +@@ -383,7 +384,7 @@ static command_result runRubyScript(color_ostream &out, PluginManager *plug_mgr, + rbcmd += "'" + args[i] + "', "; + rbcmd += "]\n"; + +- rbcmd += "catch(:script_finished) { load './hack/scripts/" + name + ".rb' }"; ++ rbcmd += "catch(:script_finished) { load '" DFHACK_DATA_DESTINATION "/scripts/" + name + ".rb' }"; + + return plug_mgr->ruby->eval_ruby(out, rbcmd.c_str()); + } +@@ -501,6 +502,7 @@ void Core::getScriptPaths(std::vector *dest) + } + dest->push_back(df_path + "/raw/scripts"); + dest->push_back(df_path + "/hack/scripts"); ++ dest->push_back(DFHACK_DATA_DESTINATION "/scripts"); + for (auto it = script_paths[1].begin(); it != script_paths[1].end(); ++it) + dest->push_back(*it); + } +@@ -1448,7 +1450,11 @@ void Core::fatal (std::string output) + std::string Core::getHackPath() + { + #ifdef LINUX_BUILD +- return p->getPath() + "/hack/"; ++ if(strncmp(DFHACK_DATA_DESTINATION, "hack", 5) == 0) ++ // This is the default value ++ return p->getPath() + "/hack/"; ++ else ++ return DFHACK_DATA_DESTINATION "/"; + #else + return p->getPath() + "\\hack\\"; + #endif +@@ -1467,9 +1473,9 @@ bool Core::Init() + + // find out what we are... + #ifdef LINUX_BUILD +- const char * path = "hack/symbols.xml"; ++ const char * path = DFHACK_DATA_DESTINATION "/symbols.xml"; + #else +- const char * path = "hack\\symbols.xml"; ++ const char * path = DFHACK_DATA_DESTINATION "\\symbols.xml"; + #endif + vif = new DFHack::VersionInfoFactory(); + cerr << "Identifying DF version.\n"; +-- +2.11.1 + diff --git a/games-util/dfhack/files/dfhack-0.43.05_beta1/0002-respect-DFHACK_LUA_DESTINATION.patch b/games-util/dfhack/files/dfhack-0.43.05_beta1/0002-respect-DFHACK_LUA_DESTINATION.patch new file mode 100644 index 00000000..c48c6dfc --- /dev/null +++ b/games-util/dfhack/files/dfhack-0.43.05_beta1/0002-respect-DFHACK_LUA_DESTINATION.patch @@ -0,0 +1,75 @@ +From 3f99b0e97c68d8126355a587b57eb3618c4157cb Mon Sep 17 00:00:00 2001 +From: eroen +Date: Tue, 7 Mar 2017 22:43:57 +0100 +Subject: [PATCH 2/5] respect DFHACK_LUA_DESTINATION + +--- + CMakeLists.txt | 3 ++- + depends/lua/CMakeLists.txt | 5 ++++- + depends/lua/include/{luaconf.h => luaconf.h.in} | 2 +- + 3 files changed, 7 insertions(+), 3 deletions(-) + rename depends/lua/include/{luaconf.h => luaconf.h.in} (99%) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 01a84b92..fc5438f8 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -162,7 +162,7 @@ SET(DFHACK_PLUGIN_DESTINATION hack/plugins) + # dfhack header files go here: + SET(DFHACK_INCLUDES_DESTINATION hack/include) + # dfhack lua files go here: +-SET(DFHACK_LUA_DESTINATION hack/lua) ++SET(DFHACK_LUA_DESTINATION hack/lua CACHE INTERNAL "") + # the windows .lib file goes here: + SET(DFHACK_DEVLIB_DESTINATION hack) + +@@ -295,6 +295,7 @@ endif() + + find_package(ZLIB REQUIRED) + include_directories(depends/protobuf) ++include_directories("${CMAKE_CURRENT_BINARY_DIR}/depends/lua/include") + include_directories(depends/lua/include) + include_directories(depends/md5) + include_directories(depends/jsoncpp) +diff --git a/depends/lua/CMakeLists.txt b/depends/lua/CMakeLists.txt +index 8b9ce8e2..ad7a209e 100644 +--- a/depends/lua/CMakeLists.txt ++++ b/depends/lua/CMakeLists.txt +@@ -22,6 +22,10 @@ IF(UNIX) + ENDIF() + ENDIF() + ++configure_file("include/luaconf.h.in" "include/luaconf.h" @ONLY) ++SET_SOURCE_FILES_PROPERTIES("${CMAKE_CURRENT_BINARY_DIR}/include" PROPERTIES HEADER_FILE_ONLY TRUE) ++include_directories("${CMAKE_CURRENT_BINARY_DIR}/include") ++ + SET (HDR_LIBLUA + include/lapi.h + include/lauxlib.h +@@ -42,7 +46,6 @@ include/lstring.h + include/ltable.h + include/ltm.h + include/lua.h +-include/luaconf.h + include/lualib.h + include/lundump.h + include/lvm.h +diff --git a/depends/lua/include/luaconf.h b/depends/lua/include/luaconf.h.in +similarity index 99% +rename from depends/lua/include/luaconf.h +rename to depends/lua/include/luaconf.h.in +index ce96b474..f5e2bdc4 100644 +--- a/depends/lua/include/luaconf.h ++++ b/depends/lua/include/luaconf.h.in +@@ -192,7 +192,7 @@ + + #else /* }{ */ + +-#define LUA_LDIR "./hack/lua/" ++#define LUA_LDIR "@DFHACK_LUA_DESTINATION@" "/" + #define LUA_CDIR "./hack/" + #define LUA_PATH_DEFAULT \ + LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" "./?.lua" +-- +2.11.1 + diff --git a/games-util/dfhack/files/dfhack-0.43.05_beta1/0003-respect-DFHACK_PLUGIN_DESTINATION.patch b/games-util/dfhack/files/dfhack-0.43.05_beta1/0003-respect-DFHACK_PLUGIN_DESTINATION.patch new file mode 100644 index 00000000..b8f67de5 --- /dev/null +++ b/games-util/dfhack/files/dfhack-0.43.05_beta1/0003-respect-DFHACK_PLUGIN_DESTINATION.patch @@ -0,0 +1,65 @@ +From 13be7ec2962986659d53cbcf1262a285c2629c11 Mon Sep 17 00:00:00 2001 +From: eroen +Date: Tue, 7 Mar 2017 22:43:57 +0100 +Subject: [PATCH 3/5] respect DFHACK_PLUGIN_DESTINATION + +--- + CMakeLists.txt | 2 +- + library/CMakeLists.txt | 2 ++ + library/PluginManager.cpp | 7 ++++++- + 3 files changed, 9 insertions(+), 2 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index fc5438f8..9e8d30ce 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -158,7 +158,7 @@ SET(DFHACK_BINARY_DESTINATION .) + # dfhack data goes here: + SET(DFHACK_DATA_DESTINATION hack CACHE INTERNAL "") + # plugin libs go here: +-SET(DFHACK_PLUGIN_DESTINATION hack/plugins) ++SET(DFHACK_PLUGIN_DESTINATION hack/plugins CACHE INTERNAL "") + # dfhack header files go here: + SET(DFHACK_INCLUDES_DESTINATION hack/include) + # dfhack lua files go here: +diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt +index ed1650e9..a858c8f8 100644 +--- a/library/CMakeLists.txt ++++ b/library/CMakeLists.txt +@@ -80,6 +80,8 @@ RemoteTools.cpp + + set_property( SOURCE "Core.cpp" APPEND PROPERTY COMPILE_DEFINITIONS + "DFHACK_DATA_DESTINATION=\"${DFHACK_DATA_DESTINATION}\"" ) ++set_property( SOURCE "PluginManager.cpp" APPEND PROPERTY COMPILE_DEFINITIONS ++ "DFHACK_PLUGIN_DESTINATION=\"${DFHACK_PLUGIN_DESTINATION}\"" ) + + SET(MAIN_SOURCES_WINDOWS + Console-windows.cpp +diff --git a/library/PluginManager.cpp b/library/PluginManager.cpp +index a4927a75..a4cefb13 100644 +--- a/library/PluginManager.cpp ++++ b/library/PluginManager.cpp +@@ -52,6 +52,7 @@ using namespace std; + using namespace tthread; + + #include ++#include + + #define MUTEX_GUARD(lock) auto lock_##__LINE__ = make_mutex_guard(lock); + template +@@ -70,7 +71,11 @@ tthread::lock_guard make_mutex_guard (T *mutex) + + static string getPluginPath() + { +- return Core::getInstance().getHackPath() + "plugins/"; ++ if(strncmp(DFHACK_PLUGIN_DESTINATION, "hack/plugins", 13) == 0) ++ // This is the default value ++ return Core::getInstance().getHackPath() + "plugins/"; ++ else ++ return DFHACK_PLUGIN_DESTINATION "/"; + } + + static string getPluginPath (std::string name) +-- +2.11.1 + diff --git a/games-util/dfhack/files/dfhack-0.43.05_beta1/0004-respect-DFHACK_LIBRARY_DESTINATION.patch b/games-util/dfhack/files/dfhack-0.43.05_beta1/0004-respect-DFHACK_LIBRARY_DESTINATION.patch new file mode 100644 index 00000000..7c0b2b2a --- /dev/null +++ b/games-util/dfhack/files/dfhack-0.43.05_beta1/0004-respect-DFHACK_LIBRARY_DESTINATION.patch @@ -0,0 +1,65 @@ +From 9f367aaa1381476871b72d08c4fb62995556337a Mon Sep 17 00:00:00 2001 +From: eroen +Date: Tue, 7 Mar 2017 22:43:57 +0100 +Subject: [PATCH 4/5] respect DFHACK_LIBRARY_DESTINATION + +--- + CMakeLists.txt | 4 ++-- + plugins/ruby/CMakeLists.txt | 2 ++ + plugins/ruby/ruby.cpp | 6 +++--- + 3 files changed, 7 insertions(+), 5 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 9e8d30ce..40b17434 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -146,11 +146,11 @@ set(DFHACK_VERSION "${DF_VERSION}-${DFHACK_RELEASE}") + # the dfhack libraries will be installed here: + IF(UNIX) + # put the lib into DF/hack +- SET(DFHACK_LIBRARY_DESTINATION hack) ++ SET(DFHACK_LIBRARY_DESTINATION hack CACHE INTERNAL "") + SET(DFHACK_EGGY_DESTINATION libs) + ELSE() + # windows is crap, therefore we can't do nice things with it. leave the libs on a nasty pile... +- SET(DFHACK_LIBRARY_DESTINATION .) ++ SET(DFHACK_LIBRARY_DESTINATION . CACHE INTERNAL "") + SET(DFHACK_EGGY_DESTINATION .) + ENDIF() + # external tools will be installed here: +diff --git a/plugins/ruby/CMakeLists.txt b/plugins/ruby/CMakeLists.txt +index 6b5e62c6..d75e9f1e 100644 +--- a/plugins/ruby/CMakeLists.txt ++++ b/plugins/ruby/CMakeLists.txt +@@ -69,6 +69,8 @@ INCLUDE_DIRECTORIES("${dfhack_SOURCE_DIR}/depends/tthread") + + DFHACK_PLUGIN(ruby ruby.cpp LINK_LIBRARIES dfhack-tinythread) + ADD_DEPENDENCIES(ruby ruby-autogen-rb) ++set_property( SOURCE "ruby.cpp" APPEND PROPERTY COMPILE_DEFINITIONS ++ "DFHACK_LIBRARY_DESTINATION=\"${DFHACK_LIBRARY_DESTINATION}\"" ) + + IF(EXISTS ${RUBYLIB}) + INSTALL(FILES ${RUBYLIB} DESTINATION ${DFHACK_LIBRARY_DESTINATION} RENAME ${RUBYLIB_INSTALL_NAME}) +diff --git a/plugins/ruby/ruby.cpp b/plugins/ruby/ruby.cpp +index ed38868b..cd2dcb1f 100644 +--- a/plugins/ruby/ruby.cpp ++++ b/plugins/ruby/ruby.cpp +@@ -320,12 +320,12 @@ static int df_loadruby(void) + { + const char *libpaths[] = { + #if defined(WIN32) +- "./libruby.dll", ++ DFHACK_LIBRARY_DESTINATION "./libruby.dll", + #elif defined(__APPLE__) +- "hack/libruby.dylib", ++ DFHACK_LIBRARY_DESTINATION "/libruby.dylib", + "/System/Library/Frameworks/Ruby.framework/Ruby", + #else +- "hack/libruby.so", ++ DFHACK_LIBRARY_DESTINATION "hack/libruby.so", + "libruby.so", + #endif + NULL +-- +2.11.1 + diff --git a/games-util/dfhack/files/dfhack-0.43.05_beta1/0005-introduce-DFHACK_RUBY_DESTINATION.patch b/games-util/dfhack/files/dfhack-0.43.05_beta1/0005-introduce-DFHACK_RUBY_DESTINATION.patch new file mode 100644 index 00000000..e703e167 --- /dev/null +++ b/games-util/dfhack/files/dfhack-0.43.05_beta1/0005-introduce-DFHACK_RUBY_DESTINATION.patch @@ -0,0 +1,88 @@ +From 7ef8631e6dd86d4e717c1c13ef40801e907a4b24 Mon Sep 17 00:00:00 2001 +From: eroen +Date: Tue, 7 Mar 2017 22:43:57 +0100 +Subject: [PATCH 5/5] introduce DFHACK_RUBY_DESTINATION + +--- + CMakeLists.txt | 2 ++ + plugins/ruby/CMakeLists.txt | 8 ++++++-- + plugins/ruby/ruby.cpp | 2 +- + plugins/ruby/{ruby.rb => ruby.rb.in} | 6 +++--- + 4 files changed, 12 insertions(+), 6 deletions(-) + rename plugins/ruby/{ruby.rb => ruby.rb.in} (97%) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 40b17434..b058de03 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -163,6 +163,8 @@ SET(DFHACK_PLUGIN_DESTINATION hack/plugins CACHE INTERNAL "") + SET(DFHACK_INCLUDES_DESTINATION hack/include) + # dfhack lua files go here: + SET(DFHACK_LUA_DESTINATION hack/lua CACHE INTERNAL "") ++# dfhack ruby files go here: ++SET(DFHACK_RUBY_DESTINATION hack/ruby CACHE INTERNAL "") + # the windows .lib file goes here: + SET(DFHACK_DEVLIB_DESTINATION hack) + +diff --git a/plugins/ruby/CMakeLists.txt b/plugins/ruby/CMakeLists.txt +index d75e9f1e..0ad0630a 100644 +--- a/plugins/ruby/CMakeLists.txt ++++ b/plugins/ruby/CMakeLists.txt +@@ -70,7 +70,8 @@ INCLUDE_DIRECTORIES("${dfhack_SOURCE_DIR}/depends/tthread") + DFHACK_PLUGIN(ruby ruby.cpp LINK_LIBRARIES dfhack-tinythread) + ADD_DEPENDENCIES(ruby ruby-autogen-rb) + set_property( SOURCE "ruby.cpp" APPEND PROPERTY COMPILE_DEFINITIONS +- "DFHACK_LIBRARY_DESTINATION=\"${DFHACK_LIBRARY_DESTINATION}\"" ) ++ "DFHACK_LIBRARY_DESTINATION=\"${DFHACK_LIBRARY_DESTINATION}\"" ++ "DFHACK_RUBY_DESTINATION=\"${DFHACK_RUBY_DESTINATION}\"") + + IF(EXISTS ${RUBYLIB}) + INSTALL(FILES ${RUBYLIB} DESTINATION ${DFHACK_LIBRARY_DESTINATION} RENAME ${RUBYLIB_INSTALL_NAME}) +@@ -80,8 +81,11 @@ ELSE() + ENDIF() + ENDIF() + ++configure_file( ruby.rb.in ruby.rb @ONLY ) + INSTALL(DIRECTORY . +- DESTINATION hack/ruby ++ DESTINATION ${DFHACK_RUBY_DESTINATION} + FILES_MATCHING PATTERN "*.rb") ++INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/ruby.rb ++ DESTINATION ${DFHACK_RUBY_DESTINATION}) + + INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${RUBYAUTOGEN} DESTINATION hack/ruby) +diff --git a/plugins/ruby/ruby.cpp b/plugins/ruby/ruby.cpp +index cd2dcb1f..2b7d6ef2 100644 +--- a/plugins/ruby/ruby.cpp ++++ b/plugins/ruby/ruby.cpp +@@ -457,7 +457,7 @@ static void df_rubythread(void *p) + + // load the default ruby-level definitions in the background + state=0; +- rb_eval_string_protect("require './hack/ruby/ruby'", &state); ++ rb_eval_string_protect("require '" DFHACK_RUBY_DESTINATION "/ruby'", &state); + if (state) + dump_rb_error(); + +diff --git a/plugins/ruby/ruby.rb b/plugins/ruby/ruby.rb.in +similarity index 97% +rename from plugins/ruby/ruby.rb +rename to plugins/ruby/ruby.rb.in +index c696c23e..62be24c5 100644 +--- a/plugins/ruby/ruby.rb ++++ b/plugins/ruby/ruby.rb.in +@@ -251,8 +251,8 @@ def df + end + + # load autogenned file +-require './hack/ruby/ruby-autogen-defs' +-require(RUBY_PLATFORM =~ /mswin|mingw|cygwin/i ? './hack/ruby/ruby-autogen-win' : './hack/ruby/ruby-autogen-gcc') ++require '@DFHACK_RUBY_DESTINATION@/ruby-autogen-defs' ++require(RUBY_PLATFORM =~ /mswin|mingw|cygwin/i ? '@DFHACK_RUBY_DESTINATION@/ruby-autogen-win' : '@DFHACK_RUBY_DESTINATION@/ruby-autogen-gcc') + + # load all modules +-Dir['./hack/ruby/*.rb'].each { |m| require m.chomp('.rb') if m !~ /ruby-autogen/ } ++Dir['@DFHACK_RUBY_DESTINATION@/*.rb'].each { |m| require m.chomp('.rb') if m !~ /ruby-autogen/ } +-- +2.11.1 + diff --git a/games-util/dfhack/files/dfhack-0.43.05_pre20160726/01-respect.patch b/games-util/dfhack/files/dfhack-0.43.05_pre20160726/01-respect.patch deleted file mode 100644 index d06df3c6..00000000 --- a/games-util/dfhack/files/dfhack-0.43.05_pre20160726/01-respect.patch +++ /dev/null @@ -1,92 +0,0 @@ -Respect DFHACK_DATA_DESTINATION - -From: eroen - - ---- - CMakeLists.txt | 2 +- - library/CMakeLists.txt | 3 +++ - library/Core.cpp | 14 ++++++++++---- - 3 files changed, 14 insertions(+), 5 deletions(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 10a831c..9d49af4 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -125,7 +125,7 @@ ENDIF() - # external tools will be installed here: - SET(DFHACK_BINARY_DESTINATION .) - # dfhack data goes here: --SET(DFHACK_DATA_DESTINATION hack) -+SET(DFHACK_DATA_DESTINATION hack CACHE INTERNAL "") - # plugin libs go here: - SET(DFHACK_PLUGIN_DESTINATION hack/plugins) - # dfhack header files go here: -diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt -index d3e3480..9bbc2ed 100644 ---- a/library/CMakeLists.txt -+++ b/library/CMakeLists.txt -@@ -78,6 +78,9 @@ RemoteServer.cpp - RemoteTools.cpp - ) - -+set_property( SOURCE "Core.cpp" APPEND PROPERTY COMPILE_DEFINITIONS -+ "DFHACK_DATA_DESTINATION=\"${DFHACK_DATA_DESTINATION}\"" ) -+ - SET(MAIN_SOURCES_WINDOWS - Console-windows.cpp - Hooks-windows.cpp -diff --git a/library/Core.cpp b/library/Core.cpp -index fb1dd80..3caec53 100644 ---- a/library/Core.cpp -+++ b/library/Core.cpp -@@ -75,6 +75,7 @@ using namespace DFHack; - #include - #include - #include -+#include - #include - #include "tinythread.h" - #include "md5wrapper.h" -@@ -375,7 +376,7 @@ static command_result runRubyScript(color_ostream &out, PluginManager *plug_mgr, - rbcmd += "'" + args[i] + "', "; - rbcmd += "]\n"; - -- rbcmd += "catch(:script_finished) { load './hack/scripts/" + name + ".rb' }"; -+ rbcmd += "catch(:script_finished) { load '" DFHACK_DATA_DESTINATION "/scripts/" + name + ".rb' }"; - - return plug_mgr->ruby->eval_ruby(out, rbcmd.c_str()); - } -@@ -493,6 +494,7 @@ void Core::getScriptPaths(std::vector *dest) - } - dest->push_back(df_path + "/raw/scripts"); - dest->push_back(df_path + "/hack/scripts"); -+ dest->push_back(DFHACK_DATA_DESTINATION "/scripts"); - for (auto it = script_paths[1].begin(); it != script_paths[1].end(); ++it) - dest->push_back(*it); - } -@@ -1440,7 +1442,11 @@ void Core::fatal (std::string output) - std::string Core::getHackPath() - { - #ifdef LINUX_BUILD -- return p->getPath() + "/hack/"; -+ if(strncmp(DFHACK_DATA_DESTINATION, "hack", 5) == 0) -+ // This is the default value -+ return p->getPath() + "/hack/"; -+ else -+ return DFHACK_DATA_DESTINATION "/"; - #else - return p->getPath() + "\\hack\\"; - #endif -@@ -1459,9 +1465,9 @@ bool Core::Init() - - // find out what we are... - #ifdef LINUX_BUILD -- const char * path = "hack/symbols.xml"; -+ const char * path = DFHACK_DATA_DESTINATION "/symbols.xml"; - #else -- const char * path = "hack\\symbols.xml"; -+ const char * path = DFHACK_DATA_DESTINATION "\\symbols.xml"; - #endif - vif = new DFHack::VersionInfoFactory(); - cerr << "Identifying DF version.\n"; diff --git a/games-util/dfhack/files/dfhack-0.43.05_pre20160726/02-respect-dfhack_lua_destination.patch b/games-util/dfhack/files/dfhack-0.43.05_pre20160726/02-respect-dfhack_lua_destination.patch deleted file mode 100644 index 1c7c6546..00000000 --- a/games-util/dfhack/files/dfhack-0.43.05_pre20160726/02-respect-dfhack_lua_destination.patch +++ /dev/null @@ -1,1176 +0,0 @@ -respect DFHACK_LUA_DESTINATION - -From: eroen - - ---- - CMakeLists.txt | 3 - depends/lua/CMakeLists.txt | 5 - depends/lua/include/luaconf.h | 553 -------------------------------------- - depends/lua/include/luaconf.h.in | 553 ++++++++++++++++++++++++++++++++++++++ - 4 files changed, 559 insertions(+), 555 deletions(-) - delete mode 100644 depends/lua/include/luaconf.h - create mode 100644 depends/lua/include/luaconf.h.in - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 9d49af4..f8b65ba 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -131,7 +131,7 @@ SET(DFHACK_PLUGIN_DESTINATION hack/plugins) - # dfhack header files go here: - SET(DFHACK_INCLUDES_DESTINATION hack/include) - # dfhack lua files go here: --SET(DFHACK_LUA_DESTINATION hack/lua) -+SET(DFHACK_LUA_DESTINATION hack/lua CACHE INTERNAL "") - # the windows .lib file goes here: - SET(DFHACK_DEVLIB_DESTINATION hack) - -@@ -183,6 +183,7 @@ else() - endif() - find_package(ZLIB REQUIRED) - include_directories(depends/protobuf) -+include_directories("${CMAKE_CURRENT_BINARY_DIR}/depends/lua/include") - include_directories(depends/lua/include) - include_directories(depends/md5) - include_directories(depends/jsoncpp) -diff --git a/depends/lua/CMakeLists.txt b/depends/lua/CMakeLists.txt -index b77bce6..3fa0859 100644 ---- a/depends/lua/CMakeLists.txt -+++ b/depends/lua/CMakeLists.txt -@@ -15,6 +15,10 @@ IF(UNIX) - SET(CMAKE_C_FLAGS "-m32") - ENDIF() - -+configure_file("include/luaconf.h.in" "include/luaconf.h" @ONLY) -+SET_SOURCE_FILES_PROPERTIES("${CMAKE_CURRENT_BINARY_DIR}/include" PROPERTIES HEADER_FILE_ONLY TRUE) -+include_directories("${CMAKE_CURRENT_BINARY_DIR}/include") -+ - SET (HDR_LIBLUA - include/lapi.h - include/lauxlib.h -@@ -35,7 +39,6 @@ include/lstring.h - include/ltable.h - include/ltm.h - include/lua.h --include/luaconf.h - include/lualib.h - include/lundump.h - include/lvm.h -diff --git a/depends/lua/include/luaconf.h b/depends/lua/include/luaconf.h -deleted file mode 100644 -index af09ffb..0000000 ---- a/depends/lua/include/luaconf.h -+++ /dev/null -@@ -1,553 +0,0 @@ --/* --** $Id: luaconf.h,v 1.176.1.1 2013/04/12 18:48:47 roberto Exp $ --** Configuration file for Lua --** See Copyright Notice in lua.h --*/ -- -- --#ifndef lconfig_h --#define lconfig_h -- --#include --#include -- -- --/* --** ================================================================== --** Search for "@@" to find all configurable definitions. --** =================================================================== --*/ -- -- --/* --@@ LUA_ANSI controls the use of non-ansi features. --** CHANGE it (define it) if you want Lua to avoid the use of any --** non-ansi feature or library. --*/ --#if !defined(LUA_ANSI) && defined(__STRICT_ANSI__) --#define LUA_ANSI --#endif -- -- --#if !defined(LUA_ANSI) && defined(_WIN32) && !defined(_WIN32_WCE) --#define LUA_WIN /* enable goodies for regular Windows platforms */ --#endif -- --#if defined(LUA_WIN) --#define LUA_DL_DLL --#define LUA_USE_AFORMAT /* assume 'printf' handles 'aA' specifiers */ --#endif -- -- -- --#if defined(LUA_USE_LINUX) --#define LUA_USE_POSIX --#define LUA_USE_DLOPEN /* needs an extra library: -ldl */ --#define LUA_USE_READLINE /* needs some extra libraries */ --#define LUA_USE_STRTODHEX /* assume 'strtod' handles hex formats */ --#define LUA_USE_AFORMAT /* assume 'printf' handles 'aA' specifiers */ --#define LUA_USE_LONGLONG /* assume support for long long */ --#endif -- --#if defined(LUA_USE_MACOSX) --#define LUA_USE_POSIX --#define LUA_USE_DLOPEN /* does not need -ldl */ --#define LUA_USE_READLINE /* needs an extra library: -lreadline */ --#define LUA_USE_STRTODHEX /* assume 'strtod' handles hex formats */ --#define LUA_USE_AFORMAT /* assume 'printf' handles 'aA' specifiers */ --#define LUA_USE_LONGLONG /* assume support for long long */ --#endif -- -- -- --/* --@@ LUA_USE_POSIX includes all functionality listed as X/Open System --@* Interfaces Extension (XSI). --** CHANGE it (define it) if your system is XSI compatible. --*/ --#if defined(LUA_USE_POSIX) --#define LUA_USE_MKSTEMP --#define LUA_USE_ISATTY --#define LUA_USE_POPEN --#define LUA_USE_ULONGJMP --#define LUA_USE_GMTIME_R --#endif -- -- -- --/* --@@ LUA_PATH_DEFAULT is the default path that Lua uses to look for --@* Lua libraries. --@@ LUA_CPATH_DEFAULT is the default path that Lua uses to look for --@* C libraries. --** CHANGE them if your machine has a non-conventional directory --** hierarchy or if you want to install your libraries in --** non-conventional directories. --*/ --#if defined(_WIN32) /* { */ --/* --** In Windows, any exclamation mark ('!') in the path is replaced by the --** path of the directory of the executable file of the current process. --*/ --#define LUA_LDIR "!\\hack\\lua\\" --#define LUA_CDIR "!\\" --#define LUA_PATH_DEFAULT \ -- LUA_LDIR"?.lua;" LUA_LDIR"?\\init.lua;" ".\\?.lua" --#define LUA_CPATH_DEFAULT \ -- LUA_CDIR"?.dll;" ".\\?.dll" -- --#else /* }{ */ -- --#define LUA_LDIR "./hack/lua/" --#define LUA_CDIR "./hack/" --#define LUA_PATH_DEFAULT \ -- LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" "./?.lua" --#define LUA_CPATH_DEFAULT \ -- LUA_CDIR"?.so;" "./?.so" --#endif /* } */ -- --#define LUA_PATH "DFHACK_LUA_PATH" --#define LUA_CPATH "DFHACK_LUA_CPATH" -- --/* --@@ LUA_DIRSEP is the directory separator (for submodules). --** CHANGE it if your machine does not use "/" as the directory separator --** and is not Windows. (On Windows Lua automatically uses "\".) --*/ --#if defined(_WIN32) --#define LUA_DIRSEP "\\" --#else --#define LUA_DIRSEP "/" --#endif -- -- --/* --@@ LUA_ENV is the name of the variable that holds the current --@@ environment, used to access global names. --** CHANGE it if you do not like this name. --*/ --#define LUA_ENV "_ENV" -- -- --/* --@@ LUA_API is a mark for all core API functions. --@@ LUALIB_API is a mark for all auxiliary library functions. --@@ LUAMOD_API is a mark for all standard library opening functions. --** CHANGE them if you need to define those functions in some special way. --** For instance, if you want to create one Windows DLL with the core and --** the libraries, you may want to use the following definition (define --** LUA_BUILD_AS_DLL to get it). --*/ --#if defined(LUA_BUILD_AS_DLL) /* { */ -- --#if defined(_MSC_VER) --#if defined(LUA_CORE) || defined(LUA_LIB) /* { */ --#define LUA_API __declspec(dllexport) --#else /* }{ */ --#define LUA_API __declspec(dllimport) --#endif /* } */ --#else --#define LUA_API __attribute__ ((visibility("default"))) --#endif -- --#else /* }{ */ -- --#define LUA_API extern -- --#endif /* } */ -- -- --/* more often than not the libs go together with the core */ --#define LUALIB_API LUA_API --#define LUAMOD_API LUALIB_API -- -- --/* --@@ LUAI_FUNC is a mark for all extern functions that are not to be --@* exported to outside modules. --@@ LUAI_DDEF and LUAI_DDEC are marks for all extern (const) variables --@* that are not to be exported to outside modules (LUAI_DDEF for --@* definitions and LUAI_DDEC for declarations). --** CHANGE them if you need to mark them in some special way. Elf/gcc --** (versions 3.2 and later) mark them as "hidden" to optimize access --** when Lua is compiled as a shared library. Not all elf targets support --** this attribute. Unfortunately, gcc does not offer a way to check --** whether the target offers that support, and those without support --** give a warning about it. To avoid these warnings, change to the --** default definition. --*/ --#if defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 302) && \ -- defined(__ELF__) /* { */ --#define LUAI_FUNC __attribute__((visibility("hidden"))) extern --#define LUAI_DDEC LUAI_FUNC --#define LUAI_DDEF /* empty */ -- --#else /* }{ */ --#define LUAI_FUNC extern --#define LUAI_DDEC extern --#define LUAI_DDEF /* empty */ --#endif /* } */ -- -- -- --/* --@@ LUA_QL describes how error messages quote program elements. --** CHANGE it if you want a different appearance. --*/ --#define LUA_QL(x) "'" x "'" --#define LUA_QS LUA_QL("%s") -- -- --/* --@@ LUA_IDSIZE gives the maximum size for the description of the source --@* of a function in debug information. --** CHANGE it if you want a different size. --*/ --#define LUA_IDSIZE 60 -- -- --/* --@@ luai_writestring/luai_writeline define how 'print' prints its results. --** They are only used in libraries and the stand-alone program. (The #if --** avoids including 'stdio.h' everywhere.) --*/ --#if defined(LUA_LIB) || defined(lua_c) --#include --#define luai_writestring(s,l) fwrite((s), sizeof(char), (l), stdout) --#define luai_writeline() (luai_writestring("\n", 1), fflush(stdout)) --#endif -- --/* --@@ luai_writestringerror defines how to print error messages. --** (A format string with one argument is enough for Lua...) --*/ --#define luai_writestringerror(s,p) \ -- (fprintf(stderr, (s), (p)), fflush(stderr)) -- -- --/* --@@ LUAI_MAXSHORTLEN is the maximum length for short strings, that is, --** strings that are internalized. (Cannot be smaller than reserved words --** or tags for metamethods, as these strings must be internalized; --** #("function") = 8, #("__newindex") = 10.) --*/ --#define LUAI_MAXSHORTLEN 40 -- -- -- --/* --** {================================================================== --** Compatibility with previous versions --** =================================================================== --*/ -- --/* --@@ LUA_COMPAT_ALL controls all compatibility options. --** You can define it to get all options, or change specific options --** to fit your specific needs. --*/ --#if defined(LUA_COMPAT_ALL) /* { */ -- --/* --@@ LUA_COMPAT_UNPACK controls the presence of global 'unpack'. --** You can replace it with 'table.unpack'. --*/ --#define LUA_COMPAT_UNPACK -- --/* --@@ LUA_COMPAT_LOADERS controls the presence of table 'package.loaders'. --** You can replace it with 'package.searchers'. --*/ --#define LUA_COMPAT_LOADERS -- --/* --@@ macro 'lua_cpcall' emulates deprecated function lua_cpcall. --** You can call your C function directly (with light C functions). --*/ --#define lua_cpcall(L,f,u) \ -- (lua_pushcfunction(L, (f)), \ -- lua_pushlightuserdata(L,(u)), \ -- lua_pcall(L,1,0,0)) -- -- --/* --@@ LUA_COMPAT_LOG10 defines the function 'log10' in the math library. --** You can rewrite 'log10(x)' as 'log(x, 10)'. --*/ --#define LUA_COMPAT_LOG10 -- --/* --@@ LUA_COMPAT_LOADSTRING defines the function 'loadstring' in the base --** library. You can rewrite 'loadstring(s)' as 'load(s)'. --*/ --#define LUA_COMPAT_LOADSTRING -- --/* --@@ LUA_COMPAT_MAXN defines the function 'maxn' in the table library. --*/ --#define LUA_COMPAT_MAXN -- --/* --@@ The following macros supply trivial compatibility for some --** changes in the API. The macros themselves document how to --** change your code to avoid using them. --*/ --#define lua_strlen(L,i) lua_rawlen(L, (i)) -- --#define lua_objlen(L,i) lua_rawlen(L, (i)) -- --#define lua_equal(L,idx1,idx2) lua_compare(L,(idx1),(idx2),LUA_OPEQ) --#define lua_lessthan(L,idx1,idx2) lua_compare(L,(idx1),(idx2),LUA_OPLT) -- --/* --@@ LUA_COMPAT_MODULE controls compatibility with previous --** module functions 'module' (Lua) and 'luaL_register' (C). --*/ --#define LUA_COMPAT_MODULE -- --#endif /* } */ -- --/* }================================================================== */ -- -- -- --/* --@@ LUAI_BITSINT defines the number of bits in an int. --** CHANGE here if Lua cannot automatically detect the number of bits of --** your machine. Probably you do not need to change this. --*/ --/* avoid overflows in comparison */ --#if INT_MAX-20 < 32760 /* { */ --#define LUAI_BITSINT 16 --#elif INT_MAX > 2147483640L /* }{ */ --/* int has at least 32 bits */ --#define LUAI_BITSINT 32 --#else /* }{ */ --#error "you must define LUA_BITSINT with number of bits in an integer" --#endif /* } */ -- -- --/* --@@ LUA_INT32 is an signed integer with exactly 32 bits. --@@ LUAI_UMEM is an unsigned integer big enough to count the total --@* memory used by Lua. --@@ LUAI_MEM is a signed integer big enough to count the total memory --@* used by Lua. --** CHANGE here if for some weird reason the default definitions are not --** good enough for your machine. Probably you do not need to change --** this. --*/ --#if LUAI_BITSINT >= 32 /* { */ --#define LUA_INT32 int --#define LUAI_UMEM size_t --#define LUAI_MEM ptrdiff_t --#else /* }{ */ --/* 16-bit ints */ --#define LUA_INT32 long --#define LUAI_UMEM unsigned long --#define LUAI_MEM long --#endif /* } */ -- -- --/* --@@ LUAI_MAXSTACK limits the size of the Lua stack. --** CHANGE it if you need a different limit. This limit is arbitrary; --** its only purpose is to stop Lua to consume unlimited stack --** space (and to reserve some numbers for pseudo-indices). --*/ --#if LUAI_BITSINT >= 32 --#define LUAI_MAXSTACK 1000000 --#else --#define LUAI_MAXSTACK 15000 --#endif -- --/* reserve some space for error handling */ --#define LUAI_FIRSTPSEUDOIDX (-LUAI_MAXSTACK - 1000) -- -- -- -- --/* --@@ LUAL_BUFFERSIZE is the buffer size used by the lauxlib buffer system. --** CHANGE it if it uses too much C-stack space. --*/ --#define LUAL_BUFFERSIZE BUFSIZ -- -- -- -- --/* --** {================================================================== --@@ LUA_NUMBER is the type of numbers in Lua. --** CHANGE the following definitions only if you want to build Lua --** with a number type different from double. You may also need to --** change lua_number2int & lua_number2integer. --** =================================================================== --*/ -- --#define LUA_NUMBER_DOUBLE --#define LUA_NUMBER double -- --/* --@@ LUAI_UACNUMBER is the result of an 'usual argument conversion' --@* over a number. --*/ --#define LUAI_UACNUMBER double -- -- --/* --@@ LUA_NUMBER_SCAN is the format for reading numbers. --@@ LUA_NUMBER_FMT is the format for writing numbers. --@@ lua_number2str converts a number to a string. --@@ LUAI_MAXNUMBER2STR is maximum size of previous conversion. --*/ --#define LUA_NUMBER_SCAN "%lf" --#define LUA_NUMBER_FMT "%.14g" --#define lua_number2str(s,n) sprintf((s), LUA_NUMBER_FMT, (n)) --#define LUAI_MAXNUMBER2STR 32 /* 16 digits, sign, point, and \0 */ -- -- --/* --@@ l_mathop allows the addition of an 'l' or 'f' to all math operations --*/ --#define l_mathop(x) (x) -- -- --/* --@@ lua_str2number converts a decimal numeric string to a number. --@@ lua_strx2number converts an hexadecimal numeric string to a number. --** In C99, 'strtod' does both conversions. C89, however, has no function --** to convert floating hexadecimal strings to numbers. For these --** systems, you can leave 'lua_strx2number' undefined and Lua will --** provide its own implementation. --*/ --#define lua_str2number(s,p) strtod((s), (p)) -- --#if defined(LUA_USE_STRTODHEX) --#define lua_strx2number(s,p) strtod((s), (p)) --#endif -- -- --/* --@@ The luai_num* macros define the primitive operations over numbers. --*/ -- --/* the following operations need the math library */ --#if defined(lobject_c) || defined(lvm_c) --#include --#define luai_nummod(L,a,b) ((a) - l_mathop(floor)((a)/(b))*(b)) --#define luai_numpow(L,a,b) (l_mathop(pow)(a,b)) --#endif -- --/* these are quite standard operations */ --#if defined(LUA_CORE) --#define luai_numadd(L,a,b) ((a)+(b)) --#define luai_numsub(L,a,b) ((a)-(b)) --#define luai_nummul(L,a,b) ((a)*(b)) --#define luai_numdiv(L,a,b) ((a)/(b)) --#define luai_numunm(L,a) (-(a)) --#define luai_numeq(a,b) ((a)==(b)) --#define luai_numlt(L,a,b) ((a)<(b)) --#define luai_numle(L,a,b) ((a)<=(b)) --#define luai_numisnan(L,a) (!luai_numeq((a), (a))) --#endif -- -- -- --/* --@@ LUA_INTEGER is the integral type used by lua_pushinteger/lua_tointeger. --** CHANGE that if ptrdiff_t is not adequate on your machine. (On most --** machines, ptrdiff_t gives a good choice between int or long.) --*/ --#define LUA_INTEGER ptrdiff_t -- --/* --@@ LUA_UNSIGNED is the integral type used by lua_pushunsigned/lua_tounsigned. --** It must have at least 32 bits. --*/ --#define LUA_UNSIGNED unsigned LUA_INT32 -- -- -- --/* --** Some tricks with doubles --*/ -- --#if defined(LUA_NUMBER_DOUBLE) && !defined(LUA_ANSI) /* { */ --/* --** The next definitions activate some tricks to speed up the --** conversion from doubles to integer types, mainly to LUA_UNSIGNED. --** --@@ LUA_MSASMTRICK uses Microsoft assembler to avoid clashes with a --** DirectX idiosyncrasy. --** --@@ LUA_IEEE754TRICK uses a trick that should work on any machine --** using IEEE754 with a 32-bit integer type. --** --@@ LUA_IEEELL extends the trick to LUA_INTEGER; should only be --** defined when LUA_INTEGER is a 32-bit integer. --** --@@ LUA_IEEEENDIAN is the endianness of doubles in your machine --** (0 for little endian, 1 for big endian); if not defined, Lua will --** check it dynamically for LUA_IEEE754TRICK (but not for LUA_NANTRICK). --** --@@ LUA_NANTRICK controls the use of a trick to pack all types into --** a single double value, using NaN values to represent non-number --** values. The trick only works on 32-bit machines (ints and pointers --** are 32-bit values) with numbers represented as IEEE 754-2008 doubles --** with conventional endianess (12345678 or 87654321), in CPUs that do --** not produce signaling NaN values (all NaNs are quiet). --*/ -- --/* Microsoft compiler on a Pentium (32 bit) ? */ --#if defined(LUA_WIN) && defined(_MSC_VER) && defined(_M_IX86) /* { */ -- --#define LUA_MSASMTRICK --#define LUA_IEEEENDIAN 0 --#define LUA_NANTRICK -- -- --/* pentium 32 bits? */ --#elif defined(__i386__) || defined(__i386) || defined(__X86__) /* }{ */ -- --#define LUA_IEEE754TRICK --#define LUA_IEEELL --#define LUA_IEEEENDIAN 0 --#define LUA_NANTRICK -- --/* pentium 64 bits? */ --#elif defined(__x86_64) /* }{ */ -- --#define LUA_IEEE754TRICK --#define LUA_IEEEENDIAN 0 -- --#elif defined(__POWERPC__) || defined(__ppc__) /* }{ */ -- --#define LUA_IEEE754TRICK --#define LUA_IEEEENDIAN 1 -- --#else /* }{ */ -- --/* assume IEEE754 and a 32-bit integer type */ --#define LUA_IEEE754TRICK -- --#endif /* } */ -- --#endif /* } */ -- --/* }================================================================== */ -- -- -- -- --/* =================================================================== */ -- --/* --** Local configuration. You can use this space to add your redefinitions --** without modifying the main part of the file. --*/ -- -- -- --#endif -- -diff --git a/depends/lua/include/luaconf.h.in b/depends/lua/include/luaconf.h.in -new file mode 100644 -index 0000000..e6d08b4 ---- /dev/null -+++ b/depends/lua/include/luaconf.h.in -@@ -0,0 +1,553 @@ -+/* -+** $Id: luaconf.h,v 1.176.1.1 2013/04/12 18:48:47 roberto Exp $ -+** Configuration file for Lua -+** See Copyright Notice in lua.h -+*/ -+ -+ -+#ifndef lconfig_h -+#define lconfig_h -+ -+#include -+#include -+ -+ -+/* -+** ================================================================== -+** Search for "@@" to find all configurable definitions. -+** =================================================================== -+*/ -+ -+ -+/* -+@@ LUA_ANSI controls the use of non-ansi features. -+** CHANGE it (define it) if you want Lua to avoid the use of any -+** non-ansi feature or library. -+*/ -+#if !defined(LUA_ANSI) && defined(__STRICT_ANSI__) -+#define LUA_ANSI -+#endif -+ -+ -+#if !defined(LUA_ANSI) && defined(_WIN32) && !defined(_WIN32_WCE) -+#define LUA_WIN /* enable goodies for regular Windows platforms */ -+#endif -+ -+#if defined(LUA_WIN) -+#define LUA_DL_DLL -+#define LUA_USE_AFORMAT /* assume 'printf' handles 'aA' specifiers */ -+#endif -+ -+ -+ -+#if defined(LUA_USE_LINUX) -+#define LUA_USE_POSIX -+#define LUA_USE_DLOPEN /* needs an extra library: -ldl */ -+#define LUA_USE_READLINE /* needs some extra libraries */ -+#define LUA_USE_STRTODHEX /* assume 'strtod' handles hex formats */ -+#define LUA_USE_AFORMAT /* assume 'printf' handles 'aA' specifiers */ -+#define LUA_USE_LONGLONG /* assume support for long long */ -+#endif -+ -+#if defined(LUA_USE_MACOSX) -+#define LUA_USE_POSIX -+#define LUA_USE_DLOPEN /* does not need -ldl */ -+#define LUA_USE_READLINE /* needs an extra library: -lreadline */ -+#define LUA_USE_STRTODHEX /* assume 'strtod' handles hex formats */ -+#define LUA_USE_AFORMAT /* assume 'printf' handles 'aA' specifiers */ -+#define LUA_USE_LONGLONG /* assume support for long long */ -+#endif -+ -+ -+ -+/* -+@@ LUA_USE_POSIX includes all functionality listed as X/Open System -+@* Interfaces Extension (XSI). -+** CHANGE it (define it) if your system is XSI compatible. -+*/ -+#if defined(LUA_USE_POSIX) -+#define LUA_USE_MKSTEMP -+#define LUA_USE_ISATTY -+#define LUA_USE_POPEN -+#define LUA_USE_ULONGJMP -+#define LUA_USE_GMTIME_R -+#endif -+ -+ -+ -+/* -+@@ LUA_PATH_DEFAULT is the default path that Lua uses to look for -+@* Lua libraries. -+@@ LUA_CPATH_DEFAULT is the default path that Lua uses to look for -+@* C libraries. -+** CHANGE them if your machine has a non-conventional directory -+** hierarchy or if you want to install your libraries in -+** non-conventional directories. -+*/ -+#if defined(_WIN32) /* { */ -+/* -+** In Windows, any exclamation mark ('!') in the path is replaced by the -+** path of the directory of the executable file of the current process. -+*/ -+#define LUA_LDIR "!\\hack\\lua\\" -+#define LUA_CDIR "!\\" -+#define LUA_PATH_DEFAULT \ -+ LUA_LDIR"?.lua;" LUA_LDIR"?\\init.lua;" ".\\?.lua" -+#define LUA_CPATH_DEFAULT \ -+ LUA_CDIR"?.dll;" ".\\?.dll" -+ -+#else /* }{ */ -+ -+#define LUA_LDIR "@DFHACK_LUA_DESTINATION@" "/" -+#define LUA_CDIR "./hack/" -+#define LUA_PATH_DEFAULT \ -+ LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" "./?.lua" -+#define LUA_CPATH_DEFAULT \ -+ LUA_CDIR"?.so;" "./?.so" -+#endif /* } */ -+ -+#define LUA_PATH "DFHACK_LUA_PATH" -+#define LUA_CPATH "DFHACK_LUA_CPATH" -+ -+/* -+@@ LUA_DIRSEP is the directory separator (for submodules). -+** CHANGE it if your machine does not use "/" as the directory separator -+** and is not Windows. (On Windows Lua automatically uses "\".) -+*/ -+#if defined(_WIN32) -+#define LUA_DIRSEP "\\" -+#else -+#define LUA_DIRSEP "/" -+#endif -+ -+ -+/* -+@@ LUA_ENV is the name of the variable that holds the current -+@@ environment, used to access global names. -+** CHANGE it if you do not like this name. -+*/ -+#define LUA_ENV "_ENV" -+ -+ -+/* -+@@ LUA_API is a mark for all core API functions. -+@@ LUALIB_API is a mark for all auxiliary library functions. -+@@ LUAMOD_API is a mark for all standard library opening functions. -+** CHANGE them if you need to define those functions in some special way. -+** For instance, if you want to create one Windows DLL with the core and -+** the libraries, you may want to use the following definition (define -+** LUA_BUILD_AS_DLL to get it). -+*/ -+#if defined(LUA_BUILD_AS_DLL) /* { */ -+ -+#if defined(_MSC_VER) -+#if defined(LUA_CORE) || defined(LUA_LIB) /* { */ -+#define LUA_API __declspec(dllexport) -+#else /* }{ */ -+#define LUA_API __declspec(dllimport) -+#endif /* } */ -+#else -+#define LUA_API __attribute__ ((visibility("default"))) -+#endif -+ -+#else /* }{ */ -+ -+#define LUA_API extern -+ -+#endif /* } */ -+ -+ -+/* more often than not the libs go together with the core */ -+#define LUALIB_API LUA_API -+#define LUAMOD_API LUALIB_API -+ -+ -+/* -+@@ LUAI_FUNC is a mark for all extern functions that are not to be -+@* exported to outside modules. -+@@ LUAI_DDEF and LUAI_DDEC are marks for all extern (const) variables -+@* that are not to be exported to outside modules (LUAI_DDEF for -+@* definitions and LUAI_DDEC for declarations). -+** CHANGE them if you need to mark them in some special way. Elf/gcc -+** (versions 3.2 and later) mark them as "hidden" to optimize access -+** when Lua is compiled as a shared library. Not all elf targets support -+** this attribute. Unfortunately, gcc does not offer a way to check -+** whether the target offers that support, and those without support -+** give a warning about it. To avoid these warnings, change to the -+** default definition. -+*/ -+#if defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 302) && \ -+ defined(__ELF__) /* { */ -+#define LUAI_FUNC __attribute__((visibility("hidden"))) extern -+#define LUAI_DDEC LUAI_FUNC -+#define LUAI_DDEF /* empty */ -+ -+#else /* }{ */ -+#define LUAI_FUNC extern -+#define LUAI_DDEC extern -+#define LUAI_DDEF /* empty */ -+#endif /* } */ -+ -+ -+ -+/* -+@@ LUA_QL describes how error messages quote program elements. -+** CHANGE it if you want a different appearance. -+*/ -+#define LUA_QL(x) "'" x "'" -+#define LUA_QS LUA_QL("%s") -+ -+ -+/* -+@@ LUA_IDSIZE gives the maximum size for the description of the source -+@* of a function in debug information. -+** CHANGE it if you want a different size. -+*/ -+#define LUA_IDSIZE 60 -+ -+ -+/* -+@@ luai_writestring/luai_writeline define how 'print' prints its results. -+** They are only used in libraries and the stand-alone program. (The #if -+** avoids including 'stdio.h' everywhere.) -+*/ -+#if defined(LUA_LIB) || defined(lua_c) -+#include -+#define luai_writestring(s,l) fwrite((s), sizeof(char), (l), stdout) -+#define luai_writeline() (luai_writestring("\n", 1), fflush(stdout)) -+#endif -+ -+/* -+@@ luai_writestringerror defines how to print error messages. -+** (A format string with one argument is enough for Lua...) -+*/ -+#define luai_writestringerror(s,p) \ -+ (fprintf(stderr, (s), (p)), fflush(stderr)) -+ -+ -+/* -+@@ LUAI_MAXSHORTLEN is the maximum length for short strings, that is, -+** strings that are internalized. (Cannot be smaller than reserved words -+** or tags for metamethods, as these strings must be internalized; -+** #("function") = 8, #("__newindex") = 10.) -+*/ -+#define LUAI_MAXSHORTLEN 40 -+ -+ -+ -+/* -+** {================================================================== -+** Compatibility with previous versions -+** =================================================================== -+*/ -+ -+/* -+@@ LUA_COMPAT_ALL controls all compatibility options. -+** You can define it to get all options, or change specific options -+** to fit your specific needs. -+*/ -+#if defined(LUA_COMPAT_ALL) /* { */ -+ -+/* -+@@ LUA_COMPAT_UNPACK controls the presence of global 'unpack'. -+** You can replace it with 'table.unpack'. -+*/ -+#define LUA_COMPAT_UNPACK -+ -+/* -+@@ LUA_COMPAT_LOADERS controls the presence of table 'package.loaders'. -+** You can replace it with 'package.searchers'. -+*/ -+#define LUA_COMPAT_LOADERS -+ -+/* -+@@ macro 'lua_cpcall' emulates deprecated function lua_cpcall. -+** You can call your C function directly (with light C functions). -+*/ -+#define lua_cpcall(L,f,u) \ -+ (lua_pushcfunction(L, (f)), \ -+ lua_pushlightuserdata(L,(u)), \ -+ lua_pcall(L,1,0,0)) -+ -+ -+/* -+@@ LUA_COMPAT_LOG10 defines the function 'log10' in the math library. -+** You can rewrite 'log10(x)' as 'log(x, 10)'. -+*/ -+#define LUA_COMPAT_LOG10 -+ -+/* -+@@ LUA_COMPAT_LOADSTRING defines the function 'loadstring' in the base -+** library. You can rewrite 'loadstring(s)' as 'load(s)'. -+*/ -+#define LUA_COMPAT_LOADSTRING -+ -+/* -+@@ LUA_COMPAT_MAXN defines the function 'maxn' in the table library. -+*/ -+#define LUA_COMPAT_MAXN -+ -+/* -+@@ The following macros supply trivial compatibility for some -+** changes in the API. The macros themselves document how to -+** change your code to avoid using them. -+*/ -+#define lua_strlen(L,i) lua_rawlen(L, (i)) -+ -+#define lua_objlen(L,i) lua_rawlen(L, (i)) -+ -+#define lua_equal(L,idx1,idx2) lua_compare(L,(idx1),(idx2),LUA_OPEQ) -+#define lua_lessthan(L,idx1,idx2) lua_compare(L,(idx1),(idx2),LUA_OPLT) -+ -+/* -+@@ LUA_COMPAT_MODULE controls compatibility with previous -+** module functions 'module' (Lua) and 'luaL_register' (C). -+*/ -+#define LUA_COMPAT_MODULE -+ -+#endif /* } */ -+ -+/* }================================================================== */ -+ -+ -+ -+/* -+@@ LUAI_BITSINT defines the number of bits in an int. -+** CHANGE here if Lua cannot automatically detect the number of bits of -+** your machine. Probably you do not need to change this. -+*/ -+/* avoid overflows in comparison */ -+#if INT_MAX-20 < 32760 /* { */ -+#define LUAI_BITSINT 16 -+#elif INT_MAX > 2147483640L /* }{ */ -+/* int has at least 32 bits */ -+#define LUAI_BITSINT 32 -+#else /* }{ */ -+#error "you must define LUA_BITSINT with number of bits in an integer" -+#endif /* } */ -+ -+ -+/* -+@@ LUA_INT32 is an signed integer with exactly 32 bits. -+@@ LUAI_UMEM is an unsigned integer big enough to count the total -+@* memory used by Lua. -+@@ LUAI_MEM is a signed integer big enough to count the total memory -+@* used by Lua. -+** CHANGE here if for some weird reason the default definitions are not -+** good enough for your machine. Probably you do not need to change -+** this. -+*/ -+#if LUAI_BITSINT >= 32 /* { */ -+#define LUA_INT32 int -+#define LUAI_UMEM size_t -+#define LUAI_MEM ptrdiff_t -+#else /* }{ */ -+/* 16-bit ints */ -+#define LUA_INT32 long -+#define LUAI_UMEM unsigned long -+#define LUAI_MEM long -+#endif /* } */ -+ -+ -+/* -+@@ LUAI_MAXSTACK limits the size of the Lua stack. -+** CHANGE it if you need a different limit. This limit is arbitrary; -+** its only purpose is to stop Lua to consume unlimited stack -+** space (and to reserve some numbers for pseudo-indices). -+*/ -+#if LUAI_BITSINT >= 32 -+#define LUAI_MAXSTACK 1000000 -+#else -+#define LUAI_MAXSTACK 15000 -+#endif -+ -+/* reserve some space for error handling */ -+#define LUAI_FIRSTPSEUDOIDX (-LUAI_MAXSTACK - 1000) -+ -+ -+ -+ -+/* -+@@ LUAL_BUFFERSIZE is the buffer size used by the lauxlib buffer system. -+** CHANGE it if it uses too much C-stack space. -+*/ -+#define LUAL_BUFFERSIZE BUFSIZ -+ -+ -+ -+ -+/* -+** {================================================================== -+@@ LUA_NUMBER is the type of numbers in Lua. -+** CHANGE the following definitions only if you want to build Lua -+** with a number type different from double. You may also need to -+** change lua_number2int & lua_number2integer. -+** =================================================================== -+*/ -+ -+#define LUA_NUMBER_DOUBLE -+#define LUA_NUMBER double -+ -+/* -+@@ LUAI_UACNUMBER is the result of an 'usual argument conversion' -+@* over a number. -+*/ -+#define LUAI_UACNUMBER double -+ -+ -+/* -+@@ LUA_NUMBER_SCAN is the format for reading numbers. -+@@ LUA_NUMBER_FMT is the format for writing numbers. -+@@ lua_number2str converts a number to a string. -+@@ LUAI_MAXNUMBER2STR is maximum size of previous conversion. -+*/ -+#define LUA_NUMBER_SCAN "%lf" -+#define LUA_NUMBER_FMT "%.14g" -+#define lua_number2str(s,n) sprintf((s), LUA_NUMBER_FMT, (n)) -+#define LUAI_MAXNUMBER2STR 32 /* 16 digits, sign, point, and \0 */ -+ -+ -+/* -+@@ l_mathop allows the addition of an 'l' or 'f' to all math operations -+*/ -+#define l_mathop(x) (x) -+ -+ -+/* -+@@ lua_str2number converts a decimal numeric string to a number. -+@@ lua_strx2number converts an hexadecimal numeric string to a number. -+** In C99, 'strtod' does both conversions. C89, however, has no function -+** to convert floating hexadecimal strings to numbers. For these -+** systems, you can leave 'lua_strx2number' undefined and Lua will -+** provide its own implementation. -+*/ -+#define lua_str2number(s,p) strtod((s), (p)) -+ -+#if defined(LUA_USE_STRTODHEX) -+#define lua_strx2number(s,p) strtod((s), (p)) -+#endif -+ -+ -+/* -+@@ The luai_num* macros define the primitive operations over numbers. -+*/ -+ -+/* the following operations need the math library */ -+#if defined(lobject_c) || defined(lvm_c) -+#include -+#define luai_nummod(L,a,b) ((a) - l_mathop(floor)((a)/(b))*(b)) -+#define luai_numpow(L,a,b) (l_mathop(pow)(a,b)) -+#endif -+ -+/* these are quite standard operations */ -+#if defined(LUA_CORE) -+#define luai_numadd(L,a,b) ((a)+(b)) -+#define luai_numsub(L,a,b) ((a)-(b)) -+#define luai_nummul(L,a,b) ((a)*(b)) -+#define luai_numdiv(L,a,b) ((a)/(b)) -+#define luai_numunm(L,a) (-(a)) -+#define luai_numeq(a,b) ((a)==(b)) -+#define luai_numlt(L,a,b) ((a)<(b)) -+#define luai_numle(L,a,b) ((a)<=(b)) -+#define luai_numisnan(L,a) (!luai_numeq((a), (a))) -+#endif -+ -+ -+ -+/* -+@@ LUA_INTEGER is the integral type used by lua_pushinteger/lua_tointeger. -+** CHANGE that if ptrdiff_t is not adequate on your machine. (On most -+** machines, ptrdiff_t gives a good choice between int or long.) -+*/ -+#define LUA_INTEGER ptrdiff_t -+ -+/* -+@@ LUA_UNSIGNED is the integral type used by lua_pushunsigned/lua_tounsigned. -+** It must have at least 32 bits. -+*/ -+#define LUA_UNSIGNED unsigned LUA_INT32 -+ -+ -+ -+/* -+** Some tricks with doubles -+*/ -+ -+#if defined(LUA_NUMBER_DOUBLE) && !defined(LUA_ANSI) /* { */ -+/* -+** The next definitions activate some tricks to speed up the -+** conversion from doubles to integer types, mainly to LUA_UNSIGNED. -+** -+@@ LUA_MSASMTRICK uses Microsoft assembler to avoid clashes with a -+** DirectX idiosyncrasy. -+** -+@@ LUA_IEEE754TRICK uses a trick that should work on any machine -+** using IEEE754 with a 32-bit integer type. -+** -+@@ LUA_IEEELL extends the trick to LUA_INTEGER; should only be -+** defined when LUA_INTEGER is a 32-bit integer. -+** -+@@ LUA_IEEEENDIAN is the endianness of doubles in your machine -+** (0 for little endian, 1 for big endian); if not defined, Lua will -+** check it dynamically for LUA_IEEE754TRICK (but not for LUA_NANTRICK). -+** -+@@ LUA_NANTRICK controls the use of a trick to pack all types into -+** a single double value, using NaN values to represent non-number -+** values. The trick only works on 32-bit machines (ints and pointers -+** are 32-bit values) with numbers represented as IEEE 754-2008 doubles -+** with conventional endianess (12345678 or 87654321), in CPUs that do -+** not produce signaling NaN values (all NaNs are quiet). -+*/ -+ -+/* Microsoft compiler on a Pentium (32 bit) ? */ -+#if defined(LUA_WIN) && defined(_MSC_VER) && defined(_M_IX86) /* { */ -+ -+#define LUA_MSASMTRICK -+#define LUA_IEEEENDIAN 0 -+#define LUA_NANTRICK -+ -+ -+/* pentium 32 bits? */ -+#elif defined(__i386__) || defined(__i386) || defined(__X86__) /* }{ */ -+ -+#define LUA_IEEE754TRICK -+#define LUA_IEEELL -+#define LUA_IEEEENDIAN 0 -+#define LUA_NANTRICK -+ -+/* pentium 64 bits? */ -+#elif defined(__x86_64) /* }{ */ -+ -+#define LUA_IEEE754TRICK -+#define LUA_IEEEENDIAN 0 -+ -+#elif defined(__POWERPC__) || defined(__ppc__) /* }{ */ -+ -+#define LUA_IEEE754TRICK -+#define LUA_IEEEENDIAN 1 -+ -+#else /* }{ */ -+ -+/* assume IEEE754 and a 32-bit integer type */ -+#define LUA_IEEE754TRICK -+ -+#endif /* } */ -+ -+#endif /* } */ -+ -+/* }================================================================== */ -+ -+ -+ -+ -+/* =================================================================== */ -+ -+/* -+** Local configuration. You can use this space to add your redefinitions -+** without modifying the main part of the file. -+*/ -+ -+ -+ -+#endif -+ diff --git a/games-util/dfhack/files/dfhack-0.43.05_pre20160726/03-respect-0.patch b/games-util/dfhack/files/dfhack-0.43.05_pre20160726/03-respect-0.patch deleted file mode 100644 index b6b073fb..00000000 --- a/games-util/dfhack/files/dfhack-0.43.05_pre20160726/03-respect-0.patch +++ /dev/null @@ -1,62 +0,0 @@ -respect DFHACK_PLUGIN_DESTINATION - -From: eroen - - ---- - CMakeLists.txt | 2 +- - library/CMakeLists.txt | 2 ++ - library/PluginManager.cpp | 7 ++++++- - 3 files changed, 9 insertions(+), 2 deletions(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index f8b65ba..17f6b65 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -127,7 +127,7 @@ SET(DFHACK_BINARY_DESTINATION .) - # dfhack data goes here: - SET(DFHACK_DATA_DESTINATION hack CACHE INTERNAL "") - # plugin libs go here: --SET(DFHACK_PLUGIN_DESTINATION hack/plugins) -+SET(DFHACK_PLUGIN_DESTINATION hack/plugins CACHE INTERNAL "") - # dfhack header files go here: - SET(DFHACK_INCLUDES_DESTINATION hack/include) - # dfhack lua files go here: -diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt -index 9bbc2ed..a69681b 100644 ---- a/library/CMakeLists.txt -+++ b/library/CMakeLists.txt -@@ -80,6 +80,8 @@ RemoteTools.cpp - - set_property( SOURCE "Core.cpp" APPEND PROPERTY COMPILE_DEFINITIONS - "DFHACK_DATA_DESTINATION=\"${DFHACK_DATA_DESTINATION}\"" ) -+set_property( SOURCE "PluginManager.cpp" APPEND PROPERTY COMPILE_DEFINITIONS -+ "DFHACK_PLUGIN_DESTINATION=\"${DFHACK_PLUGIN_DESTINATION}\"" ) - - SET(MAIN_SOURCES_WINDOWS - Console-windows.cpp -diff --git a/library/PluginManager.cpp b/library/PluginManager.cpp -index 774d191..e2e1c27 100644 ---- a/library/PluginManager.cpp -+++ b/library/PluginManager.cpp -@@ -52,6 +52,7 @@ using namespace std; - using namespace tthread; - - #include -+#include - - #define MUTEX_GUARD(lock) auto lock_##__LINE__ = make_mutex_guard(lock); - template -@@ -70,7 +71,11 @@ tthread::lock_guard make_mutex_guard (T *mutex) - - static string getPluginPath() - { -- return Core::getInstance().getHackPath() + "plugins/"; -+ if(strncmp(DFHACK_PLUGIN_DESTINATION, "hack/plugins", 13) == 0) -+ // This is the default value -+ return Core::getInstance().getHackPath() + "plugins/"; -+ else -+ return DFHACK_PLUGIN_DESTINATION "/"; - } - - static string getPluginPath (std::string name) diff --git a/games-util/dfhack/files/dfhack-0.43.05_pre20160726/04-respect-1.patch b/games-util/dfhack/files/dfhack-0.43.05_pre20160726/04-respect-1.patch deleted file mode 100644 index 47c169a5..00000000 --- a/games-util/dfhack/files/dfhack-0.43.05_pre20160726/04-respect-1.patch +++ /dev/null @@ -1,61 +0,0 @@ -respect DFHACK_LIBRARY_DESTINATION - -From: eroen - - ---- - CMakeLists.txt | 4 ++-- - plugins/ruby/CMakeLists.txt | 2 ++ - plugins/ruby/ruby.cpp | 6 +++--- - 3 files changed, 7 insertions(+), 5 deletions(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 17f6b65..60af461 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -115,11 +115,11 @@ set(DFHACK_VERSION "${DF_VERSION}-${DFHACK_RELEASE}") - # the dfhack libraries will be installed here: - IF(UNIX) - # put the lib into DF/hack -- SET(DFHACK_LIBRARY_DESTINATION hack) -+ SET(DFHACK_LIBRARY_DESTINATION hack CACHE INTERNAL "") - SET(DFHACK_EGGY_DESTINATION libs) - ELSE() - # windows is crap, therefore we can't do nice things with it. leave the libs on a nasty pile... -- SET(DFHACK_LIBRARY_DESTINATION .) -+ SET(DFHACK_LIBRARY_DESTINATION . CACHE INTERNAL "") - SET(DFHACK_EGGY_DESTINATION .) - ENDIF() - # external tools will be installed here: -diff --git a/plugins/ruby/CMakeLists.txt b/plugins/ruby/CMakeLists.txt -index 3aeac6d..f2974f6 100644 ---- a/plugins/ruby/CMakeLists.txt -+++ b/plugins/ruby/CMakeLists.txt -@@ -34,6 +34,8 @@ INCLUDE_DIRECTORIES("${dfhack_SOURCE_DIR}/depends/tthread") - - DFHACK_PLUGIN(ruby ruby.cpp LINK_LIBRARIES dfhack-tinythread) - ADD_DEPENDENCIES(ruby ruby-autogen-rb) -+set_property( SOURCE "ruby.cpp" APPEND PROPERTY COMPILE_DEFINITIONS -+ "DFHACK_LIBRARY_DESTINATION=\"${DFHACK_LIBRARY_DESTINATION}\"" ) - - INSTALL(FILES ${RUBYLIB} DESTINATION ${DFHACK_LIBRARY_DESTINATION}) - -diff --git a/plugins/ruby/ruby.cpp b/plugins/ruby/ruby.cpp -index adc451a..0dc423a 100644 ---- a/plugins/ruby/ruby.cpp -+++ b/plugins/ruby/ruby.cpp -@@ -325,11 +325,11 @@ static int df_loadruby(void) - { - const char *libpath = - #if defined(WIN32) -- "./libruby.dll"; -+ DFHACK_LIBRARY_DESTINATION "/libruby.dll"; - #elif defined(__APPLE__) -- "hack/libruby.dylib"; -+ DFHACK_LIBRARY_DESTINATION "/libruby.dylib"; - #else -- "hack/libruby.so"; -+ DFHACK_LIBRARY_DESTINATION "/libruby.so"; - #endif - - libruby_handle = OpenPlugin(libpath); diff --git a/games-util/dfhack/files/dfhack-0.43.05_pre20160726/05-introduce.patch b/games-util/dfhack/files/dfhack-0.43.05_pre20160726/05-introduce.patch deleted file mode 100644 index c14a4fdb..00000000 --- a/games-util/dfhack/files/dfhack-0.43.05_pre20160726/05-introduce.patch +++ /dev/null @@ -1,570 +0,0 @@ -introduce DFHACK_RUBY_DESTINATION - -From: eroen - - ---- - CMakeLists.txt | 2 - plugins/ruby/CMakeLists.txt | 8 + - plugins/ruby/ruby.cpp | 2 - plugins/ruby/ruby.rb | 247 ------------------------------------------- - plugins/ruby/ruby.rb.in | 247 +++++++++++++++++++++++++++++++++++++++++++ - 5 files changed, 256 insertions(+), 250 deletions(-) - delete mode 100644 plugins/ruby/ruby.rb - create mode 100644 plugins/ruby/ruby.rb.in - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 60af461..3f9f1b2 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -132,6 +132,8 @@ SET(DFHACK_PLUGIN_DESTINATION hack/plugins CACHE INTERNAL "") - SET(DFHACK_INCLUDES_DESTINATION hack/include) - # dfhack lua files go here: - SET(DFHACK_LUA_DESTINATION hack/lua CACHE INTERNAL "") -+# dfhack ruby files go here: -+SET(DFHACK_RUBY_DESTINATION hack/ruby CACHE INTERNAL "") - # the windows .lib file goes here: - SET(DFHACK_DEVLIB_DESTINATION hack) - -diff --git a/plugins/ruby/CMakeLists.txt b/plugins/ruby/CMakeLists.txt -index f2974f6..352af6a 100644 ---- a/plugins/ruby/CMakeLists.txt -+++ b/plugins/ruby/CMakeLists.txt -@@ -35,12 +35,16 @@ INCLUDE_DIRECTORIES("${dfhack_SOURCE_DIR}/depends/tthread") - DFHACK_PLUGIN(ruby ruby.cpp LINK_LIBRARIES dfhack-tinythread) - ADD_DEPENDENCIES(ruby ruby-autogen-rb) - set_property( SOURCE "ruby.cpp" APPEND PROPERTY COMPILE_DEFINITIONS -- "DFHACK_LIBRARY_DESTINATION=\"${DFHACK_LIBRARY_DESTINATION}\"" ) -+ "DFHACK_LIBRARY_DESTINATION=\"${DFHACK_LIBRARY_DESTINATION}\"" -+ "DFHACK_RUBY_DESTINATION=\"${DFHACK_RUBY_DESTINATION}\"") - - INSTALL(FILES ${RUBYLIB} DESTINATION ${DFHACK_LIBRARY_DESTINATION}) - -+configure_file( ruby.rb.in ruby.rb @ONLY ) - INSTALL(DIRECTORY . -- DESTINATION hack/ruby -+ DESTINATION ${DFHACK_RUBY_DESTINATION} - FILES_MATCHING PATTERN "*.rb") -+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/ruby.rb -+ DESTINATION ${DFHACK_RUBY_DESTINATION}) - - INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${RUBYAUTOGEN} DESTINATION hack/ruby) -diff --git a/plugins/ruby/ruby.cpp b/plugins/ruby/ruby.cpp -index 0dc423a..bd5c430 100644 ---- a/plugins/ruby/ruby.cpp -+++ b/plugins/ruby/ruby.cpp -@@ -437,7 +437,7 @@ static void df_rubythread(void *p) - - // load the default ruby-level definitions in the background - state=0; -- rb_eval_string_protect("require './hack/ruby/ruby'", &state); -+ rb_eval_string_protect("require '" DFHACK_RUBY_DESTINATION "/ruby'", &state); - if (state) - dump_rb_error(); - -diff --git a/plugins/ruby/ruby.rb b/plugins/ruby/ruby.rb -deleted file mode 100644 -index 850ca09..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[gametype] -- 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(RUBY_PLATFORM =~ /mswin|mingw|cygwin/i ? './hack/ruby/ruby-autogen-win' : './hack/ruby/ruby-autogen-gcc') -- --# load all modules --Dir['./hack/ruby/*.rb'].each { |m| require m.chomp('.rb') if m !~ /ruby-autogen/ } -diff --git a/plugins/ruby/ruby.rb.in b/plugins/ruby/ruby.rb.in -new file mode 100644 -index 0000000..c458e19 ---- /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[gametype] -+ 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(RUBY_PLATFORM =~ /mswin|mingw|cygwin/i ? '@DFHACK_RUBY_DESTINATION@/ruby-autogen-win' : '@DFHACK_RUBY_DESTINATION@/ruby-autogen-gcc') -+ -+# load all modules -+Dir['@DFHACK_RUBY_DESTINATION@/*.rb'].each { |m| require m.chomp('.rb') if m !~ /ruby-autogen/ } diff --git a/games-util/dfhack/files/dfhack-0.43.05_pre20160726/series b/games-util/dfhack/files/dfhack-0.43.05_pre20160726/series deleted file mode 100644 index 706c489e..00000000 --- a/games-util/dfhack/files/dfhack-0.43.05_pre20160726/series +++ /dev/null @@ -1,6 +0,0 @@ -# This series applies on GIT commit 29963f4b67b9edae74cd69e159bb63730b524d27 -01-respect.patch -02-respect-dfhack_lua_destination.patch -03-respect-0.patch -04-respect-1.patch -05-introduce.patch -- cgit v1.2.1