diff options
author | eroen <eroen@occam.eroen.eu> | 2012-10-22 11:12:40 +0200 |
---|---|---|
committer | eroen <eroen@occam.eroen.eu> | 2012-10-22 11:12:40 +0200 |
commit | f54eae5ff2e6c6a5894dcab8963d965f89ff783c (patch) | |
tree | 3731eae80b94e4461292c86990bcddf7b005d19a /games-util | |
parent | symlink the log file destination (diff) | |
download | eroen-f54eae5ff2e6c6a5894dcab8963d965f89ff783c.tar.gz eroen-f54eae5ff2e6c6a5894dcab8963d965f89ff783c.tar.bz2 eroen-f54eae5ff2e6c6a5894dcab8963d965f89ff783c.zip |
dfhack ebuild, with light patching.
Diffstat (limited to 'games-util')
12 files changed, 1220 insertions, 0 deletions
diff --git a/games-util/dfhack/Manifest b/games-util/dfhack/Manifest new file mode 100644 index 0000000..df2e5a2 --- /dev/null +++ b/games-util/dfhack/Manifest @@ -0,0 +1,12 @@ +AUX dfhack-0.34.11-r2/0001-removed-magic-flags-and-paths-from-build-system.patch 7972 SHA256 6632d2fc520af0075ecfaf3d23bfb67025fcc48c8a346ee7d8f727dca809b779 SHA512 85a9122ac9f4fe3274907ed18d00dbb4bc63388316151eb53f80623cd928aaa43a99b7787ae55681559d8672b6f5f641d76b27a066927fa5aee92a28fc056b6f WHIRLPOOL b9410f83c5c5c14c72ef8873195ac876f149e8290dffff4c18640d950425d593dcd7f449f92553dbc49dea6dc014e4d9b9eb97b1c9e38081895a19668a536480 +AUX dfhack-0.34.11-r2/0002-tell-various-components-about-non-magic-paths.patch 5346 SHA256 17ebdbfebfd6291602128b6365a6568afb172b544305e0a461d8251d9f81025f SHA512 d87685b48c3972c4d2a0db4cd8332670d92d60527d186d5f7ea7281702c623b6cefbf826608d359dfb298e4258890d113303cf5f0b30b26438be0c90623f12c4 WHIRLPOOL a9d8c0fbca35f70b9ae837f1ed48aec62058cc92617d93c1fc90514d3ce1e14ababf89a3f421a9667a5dcc301536c56cab9bf2e229abba3a9dc1ae0861cffa6e +AUX dfhack-0.34.11-r2/0003-don-t-build-static-libs.patch 3183 SHA256 9e32774f47d53a52bf294150a0da45405221163d375af52ef43f12af3dd4b587 SHA512 089d5549b85956d607410673fc5aa9014039bcf799bf5aa09aabfc6fd893d9884b51fa64676b156dd7500dae7bb8a2eaaf7aacd9d63e6555d024a7683d1ca0b9 WHIRLPOOL 657249e33e76c46ee402202a688cf315f69279f1cf4cd55480f0ce0488eaa5e6ee19f65ad4c3d84f2b6c71f3381c0c8ae89fc387022dea1a5c667a168e644a8d +AUX dfhack-0.34.11-r2/0004-compile-time-configurable-statedir.patch 3337 SHA256 d7bbe9666bc659894154ed94ecaca86155ea0917173b8efb1c17cc15e4baf454 SHA512 a6788871951c8303cabf7520e653becd0de29e3984dc5dcd397b1371745d83cd3c460a36251ba4f329f7e43d9f0d2825110847edee16bf400ddf9c3f795ba1ef WHIRLPOOL fe1dd424e64308ad878300ff5d895b0351ff1c541b4c582a0ea701637c3f967044bc5fb57f94e8426277cd3cb7f6bc12345113efeaf8cbbc8b571bc9a6cf777b +AUX ssense/0001-compile-time-configuration-of-magic-cwd.patch 7753 SHA256 7f3a9033748e4fc0bc41771d1968470ef40e88274057200c46c66f1550af45ed SHA512 1b9dacf6a3d96f560c9cc793c9fccba5126ad596c76b3d9a4ae9a14a1ebe9c34511bc492594039df1596c2911e70ad16cc06821ba005cff6fcabcc237ecd50a1 WHIRLPOOL 604739d52b540bb6111eef363d98d481ea4047aa819a263644c227ff27bdf4168d6bf06c51d1b4fc4dfbd0624fea17e22b09bc75c752d77c6ee81e30e6f8b000 +AUX ssense/0002-screenshots-in-home-dir.patch 2578 SHA256 75d82bb719292736f8003a6a2d75ec09e899f35780de9e5a04ebb8a23ba735ce SHA512 5635c8e712cdf6196d5981e040e7c9a6e0cbd4eaa7ec8860d3741355d4e1d58724c68a60ef9f2d6cfb2afa0ef2971ca70ea54e3a8d994d00484b5ba4dc022954 WHIRLPOOL 01ccc2ab9c426064f31abdb332053e425ce2cc9f879e5946619c98b52f9122f76b27d38f48b700969a7a9a28d2d5383dcdad68bb69302084c769c98f1b3c7aa1 +AUX ssense/0003-dont-segfault-if-logfile-is-unwritable.patch 1064 SHA256 d9c529b47aa6ba84961d2795db15ab0831aac5942d12d09767a92dd965482502 SHA512 aaa7822dee3738bafa03f51044f42a7b9f6deda02aec0bb7de8a8cadd6423f20e92ef7e73a20ff28235ebc5eeb8a7b9d3cbdf7c7e3d1abf17b9b58719006a951 WHIRLPOOL c79146a216a879aba94f913feeaeb5444ff50df2e1fd7f33f0eb254c9fbca944ab1c5f37feb0f4407aa1559e420372f6573340e822a446d725bd0350257bf593 +AUX ssense/0004-create-various-output-files-in-HOME-not-cwd.patch 5217 SHA256 1aabc5a6c15b9cdc76c93dc94e572c526f2b3d1ef309f2d34a92c64a9d449942 SHA512 ddfd1b9714e6ff5572b19422262c3795a3c1923afae115aaba648b5dd77fd669eef13b0f4e575d8ab15c0ecccaf2d1fcb166fa8e10c501d459bf38a3ef1439b2 WHIRLPOOL 779f015469382c92734d941677d90c7b6bfef21ff391841d249a5deef75f8591c781ff33b125d5713373271f91b20d266579c80d173c9844d4eb0fd4bec595c4 +AUX ssense/0005-don-t-build-static-tinyxml-as-lib.patch 985 SHA256 312d959eb2aae92700e5afac3b08204857e84d740f94d3523d882841a5efc660 SHA512 f47950d7ab4f4a045a92d8e748edfa81f74ce51b97ab03f2866a45b4e25c34e6438f5597049bf04b379467db3b019f9a8013781985a729fe449add55c1ccfe89 WHIRLPOOL 3880de822d96cdca1470eff7786b220407dd2e97e5c2221dbaa5ef42cca24ad18e711fa3bb9cb586bdf39ec9a692bbbc4ab721d792520357b6152dceb88d0221 +EBUILD dfhack-0.34.11.2.ebuild 5128 SHA256 5d5ea56156cc0e3235c9e768b7dc425d2898d0b46524bc5a1d18296f1844ce77 SHA512 e250f42027db5f17505e8a40f033e50c32681c3f9bd710182bf9b50f3cbf8e06e1592a2b1579982090015c6b3bf914c1e8d9ad9f6997f4914f287c5262805f63 WHIRLPOOL 81e515f3717dd6278e3da0166e270f368e3b5378efa2d30704772cf2ec7fae43b7e14aedcc546977325d6133003edd861b694ebe077556c05651724ccb407ec6 +EBUILD dfhack-9999.ebuild 5247 SHA256 3c1d011b03a81b42a27e905d8edd111670863adf424b267d49052c1b256024e5 SHA512 50702fddc31cda43c2ffaf72bd204b1a42959fcb60aba79538470f4d8daec9f41263f004b722178e537b66a919d7f8a900c552a3ceca971db7e1a3cbdd781c14 WHIRLPOOL e00c37113c909e8d2cec041f80b994ab8236de3748ae2ec8112d4c90f7e653373b72a29b5e947c73c96263a8f0cc265bbcd53df273dd046fb8b0316cbbdf303d +MISC metadata.xml 572 SHA256 913cbd415cc83010473062c137ac57dba4541349efec58e0a8325be33cb0a77c SHA512 167c1513cca31c08a89503b4b960cc1b45c43c1d9552e8c6cf01d8c837fb99669b898ba58c7e192b5fdef6959db9f123179d9a86e2125dccc1ed76e28ffe3904 WHIRLPOOL 9866820cb844e7c36abf92ac117bbe4cc0b804444441c24a366a61304b21baeded55e122393b393fbb7a47b08abb787cc8aecd6b4c89546c7201153652a3c957 diff --git a/games-util/dfhack/dfhack-0.34.11.2.ebuild b/games-util/dfhack/dfhack-0.34.11.2.ebuild new file mode 100644 index 0000000..f98e036 --- /dev/null +++ b/games-util/dfhack/dfhack-0.34.11.2.ebuild @@ -0,0 +1,169 @@ +# Copyright 1999-2012 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +EAPI=5 + +inherit games versionator git-2 multilib cmake-utils + +if [[ ! ${PV} == "9999" ]]; then + MY_PV="$(replace_version_separator 3 '-r')" + MY_P="${PN}-${MY_PV}" +fi + +DESCRIPTION="Memory hacking library for Dwarf Fortress and a set of tools that +use it" +HOMEPAGE="https://github.com/peterix/dfhack" +EGIT_HAS_SUBMODULES="yes" +EGIT_REPO_URI="git://github.com/peterix/dfhack.git" +if [[ ! ${PV} == "9999" ]]; then + EGIT_COMMIT="${MY_PV}" +fi + +CMAKE_REMOVE_MODULES_LIST="FindCurses FindDoxygen CMakeVS10FindMake" + +LICENSE="ZLIB MIT BSD-2" +SLOT="0" +KEYWORDS="~amd64" +IUSE="doc api minimal dfusion ssense egg" + +COMMON_DEPEND="" +DEPEND="${COMMON_DEPEND} + dev-vcs/git + dev-util/cmake + dev-perl/XML-LibXML + dev-perl/XML-LibXSLT + doc? ( + app-doc/doxygen + ) + " +RDEPEND="${COMMON_DEPEND} + games-simulation/dwarffortress + app-emulation/emul-linux-x86-baselibs + ssense? ( + app-emulation/emul-linux-x86-baselibs + app-emulation/emul-linux-x86-opengl + app-emulation/emul-linux-x86-xlibs + ) + " +QA_PREBUILT+="${GAMES_DATADIR#/}/${P}/lib32/libruby.so" +# The allegro libs are also prebuilt, but don't break things. + +src_prepare() { + multilib_toolchain_setup x86 + + local datadir="${GAMES_DATADIR}/${P}" + local dfhack_libdir="${datadir}/lib32" + + local EPATCH_FORCE="yes" + local EPATCH_SUFFIX="patch" + if [[ ! "${PV}" == "9999" ]]; then + EPATCH_SOURCE="${FILESDIR}/dfhack-${MY_PV}" epatch + fi + if use ssense; then + cd "${S}/plugins/stonesense" + EPATCH_SOURCE="${FILESDIR}/ssense" epatch + fi + cd "${S}" + + # Fix up the startup scripts + sed -f - -i "package/linux/dfhack" "package/linux/dfhack-run" <<- EOF || die + s%"\./stonesense/deplibs"%"${datadir}/stonesense/deplibs"% + s%"\./hack"%"${dfhack_libdir}"% + s%\./hack/libdfhack.so%"${dfhack_libdir}/libdfhack.so"% + s%\./libs/Dwarf_Fortress%"df-34.11"% + s%hack/dfhack-run%"${dfhack_libdir}/dfhack-run"% + EOF + + sed -i "s:\./hack/ruby/:${GAMES_DATADIR}/${P}/ruby/:" \ + "./plugins/ruby/ruby.rb" || die + 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" || die + fi + + if use egg; then + sed -f - -i ./library/Hooks-egg.cpp <<- EOF || die + s/SDL_Event\* event/SDL::Event\* event/ + EOF + fi +} + +src_configure() { + local MY_DOCDIR="/usr/share/doc/${P}" + mycmakeargs=( + "-DCMAKE_INSTALL_PREFIX=${GAMES_DATADIR}" + "-DDFHACK_BINARY_DESTINATION=${GAMES_BINDIR}" + # We install interesting libs, let's not infect the rest of the system. + "-DDFHACK_LIBRARY_DESTINATION=${GAMES_DATADIR}/${P}/lib32" + "-DDFHACK_EGGY_DESTINATION=$(games_get_libdir)" + "-DDFHACK_DATA_DESTINATION=${GAMES_DATADIR}/${P}" + "-DDFHACK_USERDOC_DESTINATION=${MY_DOCDIR}" + "-DDFHACK_DEVDOC_DESTINATION=${MY_DOCDIR}/dev" + "-DDFHACK_STATEDIR=${GAMES_STATEDIR}/${P}" + "-DBUILD_LIBRARY=ON" + # Breaks slotting + "$(cmake-utils_use egg BUILD_EGGY)" + "-DBUILD_PLUGINS=ON" + "-DBUILD_RUBY=ON" + "-DDL_RUBY=ON" # W/o this, libruby.so will be missing => breakage + "$(cmake-utils_use dfusion BUILD_DFUSION)" + "$(cmake-utils_use ssense BUILD_STONESENSE)" + "$(cmake-utils_use doc BUILD_DOXYGEN)" + # Will break slotting, use flag. + "$(cmake-utils_use api BUILD_DEVEL)" + "-DBUILD_SKELETON=OFF" + "-DCONSOLE_NO_CATCH=OFF" + ) + if use minimal; then + mycmakeargs+=( "-DBUILD_DEV_PLUGINS=OFF" + "-DBUILD_SUPPORTED=OFF" + "-DBUILD_DWARFEXPORT=OFF" + "-DBUILD_MAPEXPORT=OFF" ) + else + mycmakeargs+=( "-DBUILD_DEV_PLUGINS=ON" + "-DBUILD_SUPPORTED=ON" + "-DBUILD_DWARFEXPORT=ON" + "-DBUILD_MAPEXPORT=ON" ) + fi + + cmake-utils_src_configure +} + +src_install() { + cmake-utils_src_install + mv "${D}/${GAMES_BINDIR}/dfhack" "${D}/${GAMES_BINDIR}/dfhack-${PV}" || die + mv "${D}/${GAMES_BINDIR}/dfhack-run" "${D}/${GAMES_BINDIR}/dfhack-run-${PV}" || die + dodir "${GAMES_STATEDIR}/${P}" + if use ssense; then + dodir "${GAMES_SYSCONFDIR}/${P}/stonesense" + mv "${D}/${GAMES_DATADIR#/}/${P}/stonesense/init.txt" \ + "${D}/${GAMES_SYSCONFDIR#/}/${P}/stonesense/init.txt" || die + dosym "${GAMES_SYSCONFDIR}/${P}/stonesense/init.txt" \ + "${GAMES_DATADIR}/${P}/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 "${GAMES_STATEDIR}/${P}" || die +} + +pkg_postinst() { + games_pkg_postinst + elog + elog "Due to Dwarf Fortress' special needs regarding working directory," + elog "specifying relative paths to DFHack plugins can give unintended" + elog "results." + elog + elog "DFHack installs custom raw files for Dwarf Fortress in" + elog "${GAMES_DATADIR}/${P}/raw" + elog "To use them, copy them into your raw folder and apply the diffs." + elog + elog "To start DFHack, please run dfhack-${PV}" +} diff --git a/games-util/dfhack/files/dfhack-0.34.11-r2/0001-removed-magic-flags-and-paths-from-build-system.patch b/games-util/dfhack/files/dfhack-0.34.11-r2/0001-removed-magic-flags-and-paths-from-build-system.patch new file mode 100644 index 0000000..0e9c0a4 --- /dev/null +++ b/games-util/dfhack/files/dfhack-0.34.11-r2/0001-removed-magic-flags-and-paths-from-build-system.patch @@ -0,0 +1,196 @@ +From ed06cbdc0d7180c219864409cfb6f3f6c6fe2523 Mon Sep 17 00:00:00 2001 +From: eroen <eroen@occam.eroen.eu> +Date: Fri, 19 Oct 2012 23:00:22 +0200 +Subject: [PATCH 1/4] removed magic flags and paths from build system + +--- + CMakeLists.txt | 52 +++++++++++++++++++++++++++++++----------- + depends/lua/CMakeLists.txt | 2 +- + library/CMakeLists.txt | 8 +++---- + plugins/Dfusion/CMakeLists.txt | 2 +- + plugins/Plugins.cmake | 8 +++---- + plugins/ruby/CMakeLists.txt | 4 ++-- + 6 files changed, 51 insertions(+), 25 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 14436dc..a8eb1f4 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -72,30 +72,56 @@ add_definitions(-DDFHACK_VERSION="${DFHACK_VERSION}") + # the dfhack libraries will be installed here: + IF(UNIX) + # put the lib into DF/hack +- SET(DFHACK_LIBRARY_DESTINATION hack) +- SET(DFHACK_EGGY_DESTINATION libs) ++ if(NOT DEFINED DFHACK_LIBRARY_DESTINATION) ++ SET(DFHACK_LIBRARY_DESTINATION hack) ++ endif() ++ if(NOT DEFINED DFHACK_EGGY_DESTINATION) ++ SET(DFHACK_EGGY_DESTINATION libs) ++ endif() + 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_EGGY_DESTINATION .) + ENDIF() + # external tools will be installed here: +-SET(DFHACK_BINARY_DESTINATION .) ++if(NOT DEFINED DFHACK_BINARY_DESTINATION) ++ SET(DFHACK_BINARY_DESTINATION .) ++endif() + # dfhack data goes here: +-SET(DFHACK_DATA_DESTINATION hack) ++if(NOT DEFINED DFHACK_DATA_DESTINATION) ++ SET(DFHACK_DATA_DESTINATION hack) ++endif() + # plugin libs go here: +-SET(DFHACK_PLUGIN_DESTINATION hack/plugins) ++if(NOT DEFINED DFHACK_PLUGIN_DESTINATION) ++ SET(DFHACK_PLUGIN_DESTINATION "${DFHACK_DATA_DESTINATION}/plugins") ++endif() + # dfhack header files go here: +-SET(DFHACK_INCLUDES_DESTINATION hack/include) ++if(NOT DEFINED DFHACK_INCLUDES_DESTINATION) ++ SET(DFHACK_INCLUDES_DESTINATION "${DFHACK_DATA_DESTINATION}/include") ++endif() + # dfhack lua files go here: +-SET(DFHACK_LUA_DESTINATION hack/lua) ++if(NOT DEFINED DFHACK_LUA_DESTINATION) ++ SET(DFHACK_LUA_DESTINATION "${DFHACK_DATA_DESTINATION}/lua") ++endif() ++if(NOT DEFINED DFHACK_RUBY_DESTINATION) ++ SET(DFHACK_RUBY_DESTINATION "${DFHACK_DATA_DESTINATION}/ruby") ++endif() ++if(NOT DEFINED DFHACK_DFUSION_DESTINATION) ++ SET(DFHACK_DFUSION_DESTINATION "${DFHACK_DATA_DESTINATION}/dfusion") ++endif() + # the windows .lib file goes here: +-SET(DFHACK_DEVLIB_DESTINATION hack) ++if(NOT DEFINED DFHACK_DEVLIB_DESTINATION) ++ SET(DFHACK_DEVLIB_DESTINATION "${DFHACK_DATA_DESTINATION}") ++endif() + + # user documentation goes here: +-SET(DFHACK_USERDOC_DESTINATION hack) ++if(NOT DEFINED DFHACK_USERDOC_DESTINATION) ++ SET(DFHACK_USERDOC_DESTINATION "${DFHACK_DATA_DESTINATION}") ++endif() + # developer documentation goes here: +-SET(DFHACK_DEVDOC_DESTINATION hack) ++if(NOT DEFINED DFHACK_DEVDOC_DESTINATION) ++ SET(DFHACK_DEVDOC_DESTINATION "${DFHACK_DATA_DESTINATION}") ++endif() + + ## some options for the user/developer to play with + OPTION(BUILD_LIBRARY "Build the library that goes into DF." ON) +@@ -108,9 +134,9 @@ OPTION(BUILD_PLUGINS "Build the plugins." ON) + # enable C++11 features + IF(UNIX) + add_definitions(-DLINUX_BUILD) +- SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g -Wall -Wno-unused-variable") +- SET(CMAKE_CXX_FLAGS "-fvisibility=hidden -m32 -march=i686 -mtune=generic -std=c++0x") +- SET(CMAKE_C_FLAGS "-fvisibility=hidden -m32 -march=i686 -mtune=generic") ++ SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -g -Wall -Wno-unused-variable") ++ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -m32 -std=c++0x") ++ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden -m32") + ELSEIF(MSVC) + # for msvc, tell it to always use 8-byte pointers to member functions to avoid confusion + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /vmg /vmm") +diff --git a/depends/lua/CMakeLists.txt b/depends/lua/CMakeLists.txt +index b77bce6..af05748 100644 +--- a/depends/lua/CMakeLists.txt ++++ b/depends/lua/CMakeLists.txt +@@ -12,7 +12,7 @@ ENDIF() + + IF(UNIX) + add_definitions(-DLINUX_BUILD) +- SET(CMAKE_C_FLAGS "-m32") ++ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32") + ENDIF() + + SET (HDR_LIBLUA +diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt +index 536f4d3..f317ccb 100644 +--- a/library/CMakeLists.txt ++++ b/library/CMakeLists.txt +@@ -216,7 +216,7 @@ ADD_CUSTOM_TARGET(generate_headers DEPENDS ${dfapi_SOURCE_DIR}/include/df/codege + IF(UNIX) + # Don't produce debug info for generated stubs + SET_SOURCE_FILES_PROPERTIES(DataStatics.cpp DataStaticsCtor.cpp DataStaticsFields.cpp +- PROPERTIES COMPILE_FLAGS "-g0 -O1") ++ PROPERTIES COMPILE_FLAGS "-g0") + ELSE(WIN32) + SET_SOURCE_FILES_PROPERTIES(DataStatics.cpp DataStaticsCtor.cpp DataStaticsFields.cpp + PROPERTIES COMPILE_FLAGS "/O1 /bigobj") +@@ -299,9 +299,9 @@ IF(UNIX) + else() + # On linux, copy our version of the df launch script which sets LD_PRELOAD + install(PROGRAMS ${dfhack_SOURCE_DIR}/package/linux/dfhack +- DESTINATION .) ++ DESTINATION ${DFHACK_BINARY_DESTINATION}) + install(PROGRAMS ${dfhack_SOURCE_DIR}/package/linux/dfhack-run +- DESTINATION .) ++ DESTINATION ${DFHACK_BINARY_DESTINATION}) + endif() + ELSE() + if(NOT BUILD_EGGY) +@@ -327,7 +327,7 @@ install(FILES xml/symbols.xml + DESTINATION ${DFHACK_DATA_DESTINATION}) #linux: share/dfhack + #install the example autoexec file + install(FILES ../dfhack.init-example +- DESTINATION ${DFHACK_BINARY_DESTINATION}) ++ DESTINATION ${DFHACK_USERDOC_DESTINATION}) + + install(TARGETS dfhack-run dfhack-client + LIBRARY DESTINATION ${DFHACK_LIBRARY_DESTINATION} +diff --git a/plugins/Dfusion/CMakeLists.txt b/plugins/Dfusion/CMakeLists.txt +index 6558720..ab3c9ff 100644 +--- a/plugins/Dfusion/CMakeLists.txt ++++ b/plugins/Dfusion/CMakeLists.txt +@@ -11,4 +11,4 @@ SET_SOURCE_FILES_PROPERTIES( ${DFUSION_HS} PROPERTIES HEADER_FILE_ONLY TRUE ) + DFHACK_PLUGIN(dfusion ${DFUSION_CPPS_ALL} ${DFUSION_HS} LINK_LIBRARIES lua dfhack-tinythread) + + # installs into DF root +-install(DIRECTORY luafiles/ DESTINATION dfusion) +\ No newline at end of file ++install(DIRECTORY luafiles/ DESTINATION "${DFHACK_DFUSION_DESTINATION}") +diff --git a/plugins/Plugins.cmake b/plugins/Plugins.cmake +index 0ea37ac..6907003 100644 +--- a/plugins/Plugins.cmake ++++ b/plugins/Plugins.cmake +@@ -1,8 +1,8 @@ + IF(UNIX) + add_definitions(-DLINUX_BUILD) +- SET(CMAKE_CXX_FLAGS_DEBUG "-g -Wall") +- SET(CMAKE_CXX_FLAGS "-fvisibility=hidden -m32 -std=c++0x") +- SET(CMAKE_C_FLAGS "-fvisibility=hidden -m32") ++ SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g -Wall") ++ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -m32 -std=c++0x") ++ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden -m32") + ENDIF() + + include_directories("${dfhack_SOURCE_DIR}/library/include") +@@ -94,4 +94,4 @@ MACRO(DFHACK_PLUGIN) + install(TARGETS ${PLUGIN_NAME} + LIBRARY DESTINATION ${DFHACK_PLUGIN_DESTINATION} + RUNTIME DESTINATION ${DFHACK_PLUGIN_DESTINATION}) +-ENDMACRO(DFHACK_PLUGIN) +\ No newline at end of file ++ENDMACRO(DFHACK_PLUGIN) +diff --git a/plugins/ruby/CMakeLists.txt b/plugins/ruby/CMakeLists.txt +index 9d821f9..e6d3eff 100644 +--- a/plugins/ruby/CMakeLists.txt ++++ b/plugins/ruby/CMakeLists.txt +@@ -35,7 +35,7 @@ ADD_DEPENDENCIES(ruby ruby-autogen-rb) + INSTALL(FILES ${RUBYLIB} DESTINATION ${DFHACK_LIBRARY_DESTINATION}) + + INSTALL(DIRECTORY . +- DESTINATION hack/ruby ++ DESTINATION ${DFHACK_RUBY_DESTINATION} + FILES_MATCHING PATTERN "*.rb") + +-INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/ruby-autogen.rb DESTINATION hack/ruby) ++INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/ruby-autogen.rb DESTINATION ${DFHACK_RUBY_DESTINATION}) +-- +1.7.12.4 + diff --git a/games-util/dfhack/files/dfhack-0.34.11-r2/0002-tell-various-components-about-non-magic-paths.patch b/games-util/dfhack/files/dfhack-0.34.11-r2/0002-tell-various-components-about-non-magic-paths.patch new file mode 100644 index 0000000..8014b09 --- /dev/null +++ b/games-util/dfhack/files/dfhack-0.34.11-r2/0002-tell-various-components-about-non-magic-paths.patch @@ -0,0 +1,148 @@ +From d7b79f3ec2903ab2d35072c0e802522e9c36be39 Mon Sep 17 00:00:00 2001 +From: eroen <eroen@occam.eroen.eu> +Date: Sat, 20 Oct 2012 00:37:44 +0200 +Subject: [PATCH 2/4] tell various components about non-magic paths + +--- + CMakeLists.txt | 5 +++++ + depends/lua/include/luaconf.h | 4 ++-- + library/Core.cpp | 6 +++--- + plugins/Dfusion/dfusion.cpp | 2 +- + plugins/ruby/ruby.cpp | 4 ++-- + plugins/zone.cpp | 3 --- + 6 files changed, 13 insertions(+), 11 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index a8eb1f4..3f15fb1 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -83,6 +83,7 @@ ELSE() + SET(DFHACK_LIBRARY_DESTINATION .) + SET(DFHACK_EGGY_DESTINATION .) + ENDIF() ++add_definitions(-DDFHACK_LIBRARY_DESTINATION="${DFHACK_LIBRARY_DESTINATION}") + # external tools will be installed here: + if(NOT DEFINED DFHACK_BINARY_DESTINATION) + SET(DFHACK_BINARY_DESTINATION .) +@@ -91,6 +92,7 @@ endif() + if(NOT DEFINED DFHACK_DATA_DESTINATION) + SET(DFHACK_DATA_DESTINATION hack) + endif() ++add_definitions(-DDFHACK_DATA_DESTINATION="${DFHACK_DATA_DESTINATION}") + # plugin libs go here: + if(NOT DEFINED DFHACK_PLUGIN_DESTINATION) + SET(DFHACK_PLUGIN_DESTINATION "${DFHACK_DATA_DESTINATION}/plugins") +@@ -103,12 +105,15 @@ endif() + if(NOT DEFINED DFHACK_LUA_DESTINATION) + SET(DFHACK_LUA_DESTINATION "${DFHACK_DATA_DESTINATION}/lua") + endif() ++add_definitions(-DDFHACK_LUA_DESTINATION="${DFHACK_LUA_DESTINATION}") + if(NOT DEFINED DFHACK_RUBY_DESTINATION) + SET(DFHACK_RUBY_DESTINATION "${DFHACK_DATA_DESTINATION}/ruby") + endif() ++add_definitions(-DDFHACK_RUBY_DESTINATION="${DFHACK_RUBY_DESTINATION}") + if(NOT DEFINED DFHACK_DFUSION_DESTINATION) + SET(DFHACK_DFUSION_DESTINATION "${DFHACK_DATA_DESTINATION}/dfusion") + endif() ++add_definitions(-DDFHACK_DFUSION_DESTINATION="${DFHACK_DFUSION_DESTINATION}") + # the windows .lib file goes here: + if(NOT DEFINED DFHACK_DEVLIB_DESTINATION) + SET(DFHACK_DEVLIB_DESTINATION "${DFHACK_DATA_DESTINATION}") +diff --git a/depends/lua/include/luaconf.h b/depends/lua/include/luaconf.h +index 766752f..69cf425 100644 +--- a/depends/lua/include/luaconf.h ++++ b/depends/lua/include/luaconf.h +@@ -98,8 +98,8 @@ + + #else /* }{ */ + +-#define LUA_LDIR "./hack/lua/" +-#define LUA_CDIR "./hack/" ++#define LUA_LDIR DFHACK_LUA_DESTINATION "/" ++#define LUA_CDIR DFHACK_DATA_DESTINATION "/" + #define LUA_PATH_DEFAULT \ + LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" "./?.lua" + #define LUA_CPATH_DEFAULT \ +diff --git a/library/Core.cpp b/library/Core.cpp +index 1015194..d02c234 100644 +--- a/library/Core.cpp ++++ b/library/Core.cpp +@@ -316,7 +316,7 @@ static command_result runRubyScript(color_ostream &out, PluginManager *plug_mgr, + rbcmd += "'" + args[i] + "', "; + rbcmd += "]\n"; + +- rbcmd += "load './hack/scripts/" + name + ".rb'"; ++ rbcmd += "load '" DFHACK_DATA_DESTINATION "/scripts/" + name + ".rb'"; + + return plug_mgr->eval_ruby(out, rbcmd.c_str()); + } +@@ -815,7 +815,7 @@ void Core::fatal (std::string output, bool deactivate) + std::string Core::getHackPath() + { + #ifdef LINUX_BUILD +- return p->getPath() + "/hack/"; ++ return DFHACK_DATA_DESTINATION "/"; + #else + return p->getPath() + "\\hack\\"; + #endif +@@ -830,7 +830,7 @@ 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"; + #endif +diff --git a/plugins/Dfusion/dfusion.cpp b/plugins/Dfusion/dfusion.cpp +index 78c3fa8..ae17648 100644 +--- a/plugins/Dfusion/dfusion.cpp ++++ b/plugins/Dfusion/dfusion.cpp +@@ -170,7 +170,7 @@ void RunDfusion(color_ostream &out, std::vector <std::string> ¶meters) + mymutex->lock(); + lua::state s=lua::glua::Get(); + try{ +- s.loadfile("dfusion/init.lua"); //load script ++ s.loadfile( DFHACK_DFUSION_DESTINATION "/init.lua"); //load script + for(size_t i=0;i<parameters.size();i++) + s.push(parameters[i]); + Lua::SafeCall(out, s, parameters.size(),0); +diff --git a/plugins/ruby/ruby.cpp b/plugins/ruby/ruby.cpp +index 7bd6d13..3593f84 100644 +--- a/plugins/ruby/ruby.cpp ++++ b/plugins/ruby/ruby.cpp +@@ -278,7 +278,7 @@ static int df_loadruby(void) + #elif defined(__APPLE__) + "/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/libruby.1.dylib"; + #else +- "hack/libruby.so"; ++ DFHACK_LIBRARY_DESTINATION "/libruby.so"; + #endif + + libruby_handle = OpenPlugin(libpath); +@@ -381,7 +381,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/zone.cpp b/plugins/zone.cpp +index c496f49..627a38b 100644 +--- a/plugins/zone.cpp ++++ b/plugins/zone.cpp +@@ -3110,9 +3110,6 @@ command_result df_autobutcher(color_ostream &out, vector <string> & parameters) + if(list_export) + { + string run = "dfhack-run autobutcher "; +-#ifdef LINUX_BUILD +- run = "./dfhack-run autobutcher "; +-#endif + // force creation of config + out << run << "start" << endl; + +-- +1.7.12.4 + diff --git a/games-util/dfhack/files/dfhack-0.34.11-r2/0003-don-t-build-static-libs.patch b/games-util/dfhack/files/dfhack-0.34.11-r2/0003-don-t-build-static-libs.patch new file mode 100644 index 0000000..302ae44 --- /dev/null +++ b/games-util/dfhack/files/dfhack-0.34.11-r2/0003-don-t-build-static-libs.patch @@ -0,0 +1,84 @@ +From c9dc55921cce2c9fd6a550401e723c5abe79c575 Mon Sep 17 00:00:00 2001 +From: eroen <eroen@occam.eroen.eu> +Date: Mon, 22 Oct 2012 08:52:07 +0200 +Subject: [PATCH 3/4] don't build static libs + +Linking shared libs against static libs is bad. +--- + library/CMakeLists.txt | 20 +++++++++++++------- + plugins/ruby/CMakeLists.txt | 3 ++- + 2 files changed, 15 insertions(+), 8 deletions(-) + +diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt +index f317ccb..58e0949 100644 +--- a/library/CMakeLists.txt ++++ b/library/CMakeLists.txt +@@ -148,6 +148,10 @@ modules/World.cpp + modules/Graphic.cpp + modules/Windows.cpp + ) ++FILE(GLOB CLSOCKET_SOURCES "${clsocket_SOURCE_DIR}/src/*.cpp") ++FILE(GLOB MD5_SOURCES "${dfhack-md5_SOURCE_DIR}/*.cpp") ++FILE(GLOB TINYXML_SOURCES "${dfhack-tinyxml_SOURCE_DIR}/*.cpp") ++FILE(GLOB TTHREAD_SOURCES "${dfhack-tinythread_SOURCE_DIR}/*.cpp") + + IF(WIN32) + SOURCE_GROUP("Modules\\Headers" FILES ${MODULE_HEADERS}) +@@ -233,19 +237,21 @@ IF(UNIX) + ENDIF() + + IF(UNIX) +- SET(PROJECT_LIBS rt dl dfhack-md5 dfhack-tinyxml dfhack-tinythread) ++ SET(PROJECT_LIBS rt dl) ++ SET(PROJECT_DEPEND_SOURCES ${CLSOCKET_SOURCES} ${MD5_SOURCES} ${TINYXML_SOURCES} ${TTHREAD_SOURCES}) + IF(APPLE) +- SET(PROJECT_LIBS dl dfhack-md5 dfhack-tinyxml dfhack-tinythread) ++ SET(PROJECT_LIBS dl) + ENDIF() + ELSE(WIN32) + #FIXME: do we really need psapi? +- SET(PROJECT_LIBS psapi dfhack-tinyxml dfhack-tinythread) ++ SET(PROJECT_LIBS psapi) ++ SET(PROJECT_DEPEND_SOURCES ${CLSOCKET_SOURCES} ${TINYXML_SOURCES} ${TTHREAD_SOURCES}) + ENDIF() + +-ADD_LIBRARY(dfhack SHARED ${PROJECT_SOURCES}) ++ADD_LIBRARY(dfhack SHARED ${PROJECT_SOURCES} ${PROJECT_DEPEND_SOURCES}) + ADD_DEPENDENCIES(dfhack generate_headers) + +-ADD_LIBRARY(dfhack-client SHARED RemoteClient.cpp ColorText.cpp MiscUtils.cpp ${PROJECT_PROTO_SRCS}) ++ADD_LIBRARY(dfhack-client SHARED RemoteClient.cpp ColorText.cpp MiscUtils.cpp ${PROJECT_PROTO_SRCS} ${CLSOCKET_SOURCES}) + ADD_DEPENDENCIES(dfhack-client dfhack) + + ADD_EXECUTABLE(dfhack-run dfhack-run.cpp) +@@ -280,10 +286,10 @@ IF(APPLE) + SET_TARGET_PROPERTIES(dfhack PROPERTIES SOVERSION 1.0.0) + ENDIF() + +-TARGET_LINK_LIBRARIES(dfhack protobuf-lite clsocket lua ${PROJECT_LIBS}) ++TARGET_LINK_LIBRARIES(dfhack protobuf-lite lua ${PROJECT_LIBS}) + SET_TARGET_PROPERTIES(dfhack PROPERTIES LINK_INTERFACE_LIBRARIES "") + +-TARGET_LINK_LIBRARIES(dfhack-client protobuf-lite clsocket) ++TARGET_LINK_LIBRARIES(dfhack-client protobuf-lite) + TARGET_LINK_LIBRARIES(dfhack-run dfhack-client) + + if(APPLE) +diff --git a/plugins/ruby/CMakeLists.txt b/plugins/ruby/CMakeLists.txt +index e6d3eff..e14ce37 100644 +--- a/plugins/ruby/CMakeLists.txt ++++ b/plugins/ruby/CMakeLists.txt +@@ -28,8 +28,9 @@ ADD_CUSTOM_COMMAND( + ADD_CUSTOM_TARGET(ruby-autogen-rb DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/ruby-autogen.rb) + + INCLUDE_DIRECTORIES("${dfhack_SOURCE_DIR}/depends/tthread") ++FILE(GLOB TTHREAD_SOURCES "${dfhack-tinythread_SOURCE_DIR}/*.cpp") + +-DFHACK_PLUGIN(ruby ruby.cpp LINK_LIBRARIES dfhack-tinythread) ++DFHACK_PLUGIN(ruby ruby.cpp ${TTHREAD_SOURCES}) + ADD_DEPENDENCIES(ruby ruby-autogen-rb) + + INSTALL(FILES ${RUBYLIB} DESTINATION ${DFHACK_LIBRARY_DESTINATION}) +-- +1.7.12.4 + diff --git a/games-util/dfhack/files/dfhack-0.34.11-r2/0004-compile-time-configurable-statedir.patch b/games-util/dfhack/files/dfhack-0.34.11-r2/0004-compile-time-configurable-statedir.patch new file mode 100644 index 0000000..2daf777 --- /dev/null +++ b/games-util/dfhack/files/dfhack-0.34.11-r2/0004-compile-time-configurable-statedir.patch @@ -0,0 +1,94 @@ +From d4f7109bd387d7bc63519776cab9b41d2e910cd8 Mon Sep 17 00:00:00 2001 +From: eroen <eroen@occam.eroen.eu> +Date: Mon, 22 Oct 2012 10:23:43 +0200 +Subject: [PATCH 4/4] compile-time configurable statedir + +--- + CMakeLists.txt | 6 ++++++ + library/Console-linux.cpp | 2 +- + library/Core.cpp | 4 ++-- + library/Hooks-egg.cpp | 2 +- + library/Hooks-linux.cpp | 2 +- + 5 files changed, 11 insertions(+), 5 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 3f15fb1..5aca195 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -128,6 +128,12 @@ if(NOT DEFINED DFHACK_DEVDOC_DESTINATION) + SET(DFHACK_DEVDOC_DESTINATION "${DFHACK_DATA_DESTINATION}") + endif() + ++# dfhack state goes here (at runtime): ++if(NOT DEFINED DFHACK_STATEDIR) ++ SET(DFHACK_STATEDIR ".") ++endif() ++add_definitions(-DDFHACK_STATEDIR="${DFHACK_STATEDIR}") ++ + ## some options for the user/developer to play with + OPTION(BUILD_LIBRARY "Build the library that goes into DF." ON) + OPTION(BUILD_PLUGINS "Build the plugins." ON) +diff --git a/library/Console-linux.cpp b/library/Console-linux.cpp +index f32fa1c..3cf6fa3 100644 +--- a/library/Console-linux.cpp ++++ b/library/Console-linux.cpp +@@ -658,7 +658,7 @@ bool Console::init(bool sharing) + inited = false; + return false; + } +- if (!freopen("stdout.log", "w", stdout)) ++ if (!freopen( DFHACK_STATEDIR "/stdout.log", "w", stdout)) + ; + d = new Private(); + // make our own weird streams so our IO isn't redirected +diff --git a/library/Core.cpp b/library/Core.cpp +index d02c234..60c5904 100644 +--- a/library/Core.cpp ++++ b/library/Core.cpp +@@ -713,7 +713,7 @@ void fIOthread(void * iodata) + PluginManager * plug_mgr = ((IODATA*) iodata)->plug_mgr; + + CommandHistory main_history; +- main_history.load("dfhack.history"); ++ main_history.load( DFHACK_STATEDIR "/dfhack.history"); + + Console & con = core->getConsole(); + if(plug_mgr == 0 || core == 0) +@@ -749,7 +749,7 @@ void fIOthread(void * iodata) + fprintf(stderr,"Adding command to history\n"); + main_history.add(command); + fprintf(stderr,"Saving history\n"); +- main_history.save("dfhack.history"); ++ main_history.save( DFHACK_STATEDIR "/dfhack.history"); + } + + fprintf(stderr,"Running command\n"); +diff --git a/library/Hooks-egg.cpp b/library/Hooks-egg.cpp +index 842573e..abd9cd4 100644 +--- a/library/Hooks-egg.cpp ++++ b/library/Hooks-egg.cpp +@@ -37,7 +37,7 @@ distribution. + DFhackCExport int egg_init(void) + { + // reroute stderr +- freopen("stderr.log", "w", stderr); ++ freopen( DFHACK_STATEDIR "/stderr.log", "w", stderr); + // we don't reroute stdout until we figure out if this should be done at all + // See: Console-linux.cpp + fprintf(stderr,"dfhack: hooking successful\n"); +diff --git a/library/Hooks-linux.cpp b/library/Hooks-linux.cpp +index 31c0323..74ac945 100644 +--- a/library/Hooks-linux.cpp ++++ b/library/Hooks-linux.cpp +@@ -114,7 +114,7 @@ static int (*_SDL_Init)(uint32_t flags) = 0; + DFhackCExport int SDL_Init(uint32_t flags) + { + // reroute stderr +- freopen("stderr.log", "w", stderr); ++ freopen( DFHACK_STATEDIR "/stderr.log", "w", stderr); + // we don't reroute stdout until we figure out if this should be done at all + // See: Console-linux.cpp + +-- +1.7.12.4 + diff --git a/games-util/dfhack/files/ssense/0001-compile-time-configuration-of-magic-cwd.patch b/games-util/dfhack/files/ssense/0001-compile-time-configuration-of-magic-cwd.patch new file mode 100644 index 0000000..0cb04b9 --- /dev/null +++ b/games-util/dfhack/files/ssense/0001-compile-time-configuration-of-magic-cwd.patch @@ -0,0 +1,192 @@ +From de815dc687998c32154c1f099e5316badc5d4fd5 Mon Sep 17 00:00:00 2001 +From: eroen <eroen@occam.eroen.eu> +Date: Sat, 20 Oct 2012 22:30:46 +0200 +Subject: [PATCH 1/5] compile time configuration of magic cwd + +--- + Block.cpp | 4 ++-- + CMakeLists.txt | 18 ++++++++++++++---- + Config.cpp | 2 +- + ContentLoader.cpp | 6 +++--- + GUI.cpp | 2 +- + Occlusion_Test.cpp | 6 +++--- + main.cpp | 6 +++--- + 7 files changed, 27 insertions(+), 17 deletions(-) + +diff --git a/Block.cpp b/Block.cpp +index 3a5bb7d..c3406eb 100644 +--- a/Block.cpp ++++ b/Block.cpp +@@ -665,9 +665,9 @@ void createEffectSprites() + sprite_dust = CreateSpriteFromSheet( 182, IMGObjectSheet);
+ sprite_magma = CreateSpriteFromSheet( 185, IMGObjectSheet);
+ sprite_smoke = CreateSpriteFromSheet( 186, IMGObjectSheet);
+- sprite_dragonfire = load_bitmap_withWarning("stonesense/Effect_flames.png");
++ sprite_dragonfire = load_bitmap_withWarning( DFHACK_DATA_DESTINATION "/stonesense/Effect_flames.png");
+ sprite_fire = CreateSpriteFromSheet( 188, IMGObjectSheet);
+- sprite_webing = load_bitmap_withWarning("stonesense/Effect_web.png");
++ sprite_webing = load_bitmap_withWarning( DFHACK_DATA_DESTINATION "/stonesense/Effect_web.png");
+ sprite_boiling = CreateSpriteFromSheet( 190, IMGObjectSheet);
+ sprite_oceanwave = CreateSpriteFromSheet( 191, IMGObjectSheet);
+ }
+diff --git a/CMakeLists.txt b/CMakeLists.txt +index 1a6dc00..86c2c76 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -3,6 +3,16 @@ SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMake/Modules) + + include_directories (${CMAKE_SOURCE_DIR}) + ++IF(NOT DEFINED DFHACK_LIBRARY_DESTINATION) ++ SET(DFHACK_LIBRARY_DESTINATION "stonesense/deplibs") ++ENDIF() ++IF(NOT DEFINED DFHACK_DATA_DESTINATION) ++ SET(DFHACK_DATA_DESTINATION ".") ++ENDIF() ++IF(NOT DEFINED DFHACK_USERDOC_DESTINATION) ++ SET(DFHACK_USERDOC_DESTINATION ".") ++ENDIF() ++add_definitions(-DDFHACK_DATA_DESTINATION="${DFHACK_DATA_DESTINATION}") + + SET(PROJECT_SRCS + Block.cpp +@@ -57,7 +67,7 @@ IF(UNIX) + ${stonesense_SOURCE_DIR}/allegro-osx/include + ) + install(DIRECTORY allegro-osx/lib/ +- DESTINATION "stonesense/deplibs" ++ DESTINATION "${DFHACK_LIBRARY_DESTINATION}" + PATTERN "CVS" EXCLUDE + PATTERN ".svn" EXCLUDE) + ELSE() +@@ -92,7 +102,7 @@ IF(UNIX) + ${stonesense_SOURCE_DIR}/allegro/include + ) + install(DIRECTORY allegro/lib/ +- DESTINATION "stonesense/deplibs" ++ DESTINATION "${DFHACK_LIBRARY_DESTINATION}" + PATTERN "CVS" EXCLUDE + PATTERN ".svn" EXCLUDE) + ELSE() +@@ -151,8 +161,8 @@ ENDIF(UNIX) + DFHACK_PLUGIN(stonesense ${PROJECT_SRCS} LINK_LIBRARIES dfhack-tinyxml ${PROJECT_LIBS}) + #install resources into DF/stonesense + install(DIRECTORY resources/ +- DESTINATION "stonesense" ++ DESTINATION "${DFHACK_DATA_DESTINATION}/stonesense" + PATTERN "CVS" EXCLUDE + PATTERN ".svn" EXCLUDE) + # install readme +-install(FILES README.txt DESTINATION stonesense) ++install(FILES README.txt DESTINATION "${DFHACK_USERDOC_DESTINATION}/stonesense") +diff --git a/Config.cpp b/Config.cpp +index c5c73b4..8a1d1e3 100644 +--- a/Config.cpp ++++ b/Config.cpp +@@ -558,7 +558,7 @@ void parseConfigLine( string line ){ + bool loadConfigFile() + { + string line; +- ALLEGRO_PATH * p =al_create_path("stonesense/init.txt"); ++ ALLEGRO_PATH * p =al_create_path( DFHACK_DATA_DESTINATION "/stonesense/init.txt"); + const char * path = al_path_cstr(p,ALLEGRO_NATIVE_PATH_SEP); + ifstream myfile (path); + if (myfile.is_open() == false) +diff --git a/ContentLoader.cpp b/ContentLoader.cpp +index 1014d1e..7becd44 100644 +--- a/ContentLoader.cpp ++++ b/ContentLoader.cpp +@@ -208,7 +208,7 @@ bool ContentLoader::Load(){ + contentLoader->obsidian = lookupMaterialIndex(INORGANIC, "OBSIDIAN");
+
+ loadGraphicsFromDisk(); //these get destroyed when flushImgFiles is called.
+- ALLEGRO_PATH * p = al_create_path("stonesense/index.txt");
++ ALLEGRO_PATH * p = al_create_path( DFHACK_DATA_DESTINATION "/stonesense/index.txt");
+ bool overallResult = parseContentIndexFile( al_path_cstr(p, ALLEGRO_NATIVE_PATH_SEP) );
+ al_destroy_path(p);
+ translationComplete = false;
+@@ -230,7 +230,7 @@ bool ContentLoader::reload_configs() + flushImgFiles();
+
+ loadGraphicsFromDisk(); //these get destroyed when flushImgFiles is called.
+- ALLEGRO_PATH * p = al_create_path("stonesense/index.txt");
++ ALLEGRO_PATH * p = al_create_path( DFHACK_DATA_DESTINATION "/stonesense/index.txt");
+ bool overallResult = parseContentIndexFile( al_path_cstr(p, ALLEGRO_NATIVE_PATH_SEP) );
+ al_destroy_path(p);
+
+@@ -846,4 +846,4 @@ ShadeBy getShadeType(const char* Input) + if( strcmp(Input, "item") == 0)
+ return ShadeItem;
+ return ShadeNone;
+-} +\ No newline at end of file ++}
+diff --git a/GUI.cpp b/GUI.cpp +index da69aae..0469b12 100644 +--- a/GUI.cpp ++++ b/GUI.cpp +@@ -1053,7 +1053,7 @@ bool load_from_path (ALLEGRO_PATH * p, const char * filename, ALLEGRO_BITMAP *& +
+ void loadGraphicsFromDisk()
+ {
+- ALLEGRO_PATH * p = al_create_path_for_directory("stonesense");
++ ALLEGRO_PATH * p = al_create_path_for_directory( DFHACK_DATA_DESTINATION "/stonesense");
+ if(!load_from_path(p, "objects.png", IMGObjectSheet)) return;
+ if(!load_from_path(p, "creatures.png", IMGCreatureSheet)) return;
+ if(!load_from_path(p, "ramps.png", IMGRampSheet)) return;
+diff --git a/Occlusion_Test.cpp b/Occlusion_Test.cpp +index 08e26ee..56fbf13 100644 +--- a/Occlusion_Test.cpp ++++ b/Occlusion_Test.cpp +@@ -140,8 +140,8 @@ void init_masks() + //load up some mask files
+ int flags = al_get_new_bitmap_flags();
+ al_set_new_bitmap_flags(ALLEGRO_MEMORY_BITMAP);
+- ALLEGRO_BITMAP * wall = load_bitmap_withWarning("stonesense/mask_wall.png");
+- ALLEGRO_BITMAP * floor = load_bitmap_withWarning("stonesense/mask_floor.png");
++ ALLEGRO_BITMAP * wall = load_bitmap_withWarning( DFHACK_DATA_DESTINATION "/stonesense/mask_wall.png");
++ ALLEGRO_BITMAP * floor = load_bitmap_withWarning( DFHACK_DATA_DESTINATION "/stonesense/mask_floor.png");
+ al_set_new_bitmap_flags(flags);
+
+ //copy the mask to the bitsets. Each half is seperate to simplify things.
+@@ -253,4 +253,4 @@ void occlude_block(Block * b) + {
+ b->visible = 0;
+ }
+-} +\ No newline at end of file ++}
+diff --git a/main.cpp b/main.cpp +index be421cd..033b757 100644 +--- a/main.cpp ++++ b/main.cpp +@@ -152,7 +152,7 @@ void correctBlockForSegmetOffset(int32_t& x, int32_t& y, int32_t& z){ +
+ bool loadfont(DFHack::color_ostream & output)
+ {
+- ALLEGRO_PATH * p = al_create_path_for_directory("stonesense");
++ ALLEGRO_PATH * p = al_create_path_for_directory( DFHACK_DATA_DESTINATION "/stonesense");
+ if(!al_join_paths(p, config.font))
+ {
+ al_destroy_path(p);
+@@ -205,7 +205,7 @@ void drawcredits() + {
+ if(!SplashImage)
+ {
+- ALLEGRO_PATH * p = al_create_path("stonesense/splash.png");
++ ALLEGRO_PATH * p = al_create_path( DFHACK_DATA_DESTINATION "/stonesense/splash.png");
+ SplashImage = load_bitmap_withWarning(al_path_cstr(p, ALLEGRO_NATIVE_PATH_SEP));
+ al_destroy_path(p);
+ }
+@@ -448,7 +448,7 @@ static void * stonesense_thread(ALLEGRO_THREAD * main_thread, void * parms) + al_set_new_bitmap_flags(ALLEGRO_MEMORY_BITMAP|ALLEGRO_ALPHA_TEST|ALLEGRO_MIN_LINEAR|ALLEGRO_MIPMAP);
+ else al_set_new_bitmap_flags(ALLEGRO_MIN_LINEAR|ALLEGRO_MIPMAP);
+
+- ALLEGRO_PATH * p = al_create_path("stonesense/stonesense.png");
++ ALLEGRO_PATH * p = al_create_path( DFHACK_DATA_DESTINATION "/stonesense/stonesense.png");
+ IMGIcon = load_bitmap_withWarning(al_path_cstr(p, ALLEGRO_NATIVE_PATH_SEP));
+ al_destroy_path(p);
+ if(!IMGIcon)
+-- +1.7.12.4 + diff --git a/games-util/dfhack/files/ssense/0002-screenshots-in-home-dir.patch b/games-util/dfhack/files/ssense/0002-screenshots-in-home-dir.patch new file mode 100644 index 0000000..0bbb93b --- /dev/null +++ b/games-util/dfhack/files/ssense/0002-screenshots-in-home-dir.patch @@ -0,0 +1,74 @@ +From edd2fcd994d88ee2f473aa7ff3f0421a47214f27 Mon Sep 17 00:00:00 2001 +From: eroen <eroen@occam.eroen.eu> +Date: Sat, 20 Oct 2012 23:38:28 +0200 +Subject: [PATCH 2/5] screenshots in home dir + +--- + GUI.cpp | 25 ++++++++++++++++--------- + 1 file changed, 16 insertions(+), 9 deletions(-) + +diff --git a/GUI.cpp b/GUI.cpp +index 0469b12..031b239 100644 +--- a/GUI.cpp ++++ b/GUI.cpp +@@ -1286,12 +1286,14 @@ void saveScreenshot(){ + al_clear_to_color(al_map_rgb(config.backr,config.backg,config.backb));
+ paintboard();
+ //get filename
+- char filename[20] ={0};
++ char* filepath = getenv("HOME");
++ size_t filenamelength = 20 + 8 + strlen(filepath);
++ char* filename = new char[filenamelength];
+ FILE* fp;
+ int index = 1;
+ //search for the first screenshot# that does not exist already
+- while(true){
+- sprintf(filename, "screenshot%i.png", index);
++ while(index <= 99999){
++ snprintf(filename, filenamelength, "%s/ssense-screenshot%i.png", filepath, index);
+
+ fp = fopen(filename, "r");
+ if( fp != 0)
+@@ -1313,15 +1315,18 @@ void saveScreenshot(){ + al_set_target_bitmap(al_get_backbuffer(al_get_current_display()));
+ al_destroy_bitmap(temp);
+ //al_set_new_bitmap_format(ALLEGRO_PIXEL_FORMAT_ANY);
++ delete[] filename;
+ }
+ void saveImage(ALLEGRO_BITMAP* image){
+ //get filename
+- char filename[20] ={0};
++ char* filepath = getenv("HOME");
++ size_t filenamelength = 20 + 8 + strlen(filepath);
++ char* filename = new char[filenamelength];
+ FILE* fp;
+ int index = 1;
+ //search for the first screenshot# that does not exist already
+- while(true){
+- sprintf(filename, "Image%i.png", index);
++ while(index < INT_MAX ){
++ snprintf(filename, filenamelength, "%s-Image%i.png", filepath, index);
+
+ fp = fopen(filename, "r");
+ if( fp != 0)
+@@ -1420,12 +1425,14 @@ void saveMegashot(bool tall) +
+ draw_textf_border(font, al_map_rgb(255,255,255), al_get_bitmap_width(al_get_target_bitmap())/2, al_get_bitmap_height(al_get_target_bitmap())/2, ALLEGRO_ALIGN_CENTRE, "saving large screenshot...");
+ al_flip_display();
+- char filename[20] ={0};
++ char* filepath = getenv("HOME");
++ size_t filenamelength = 20 + 8 + strlen(filepath);
++ char* filename = new char[filenamelength];
+ FILE* fp;
+ int index = 1;
+ //search for the first screenshot# that does not exist already
+- while(true){
+- sprintf(filename, "screenshot%i.png", index);
++ while(index <= 99999){
++ snprintf(filename, filenamelength, "%s/ssense-screenshot%i.png", filepath, index);
+ fp = fopen(filename, "r");
+ if( fp != 0)
+ fclose(fp);
+-- +1.7.12.4 + diff --git a/games-util/dfhack/files/ssense/0003-dont-segfault-if-logfile-is-unwritable.patch b/games-util/dfhack/files/ssense/0003-dont-segfault-if-logfile-is-unwritable.patch new file mode 100644 index 0000000..dc0d275 --- /dev/null +++ b/games-util/dfhack/files/ssense/0003-dont-segfault-if-logfile-is-unwritable.patch @@ -0,0 +1,46 @@ +From e0408df333902a214ce6762376a1e57063a9deb0 Mon Sep 17 00:00:00 2001 +From: eroen <eroen@occam.eroen.eu> +Date: Sun, 21 Oct 2012 04:06:19 +0200 +Subject: [PATCH 3/5] dont segfault if logfile is unwritable + +--- + main.cpp | 10 ++++++---- + 1 file changed, 6 insertions(+), 4 deletions(-) + +diff --git a/main.cpp b/main.cpp +index 033b757..77917e0 100644 +--- a/main.cpp ++++ b/main.cpp +@@ -86,11 +86,12 @@ void LogError(const char* msg, ...){ + vsprintf(buf, msg, arglist);
+ Core::printerr(buf);
+ FILE* fp = fopen( "Stonesense.log", "a");
+- if(fp)
++ if(fp) {
+ vfprintf( fp, msg, arglist );
++ fclose(fp);
++ }
+ // Core::printerr(msg, arglist);
+ va_end(arglist);
+- fclose(fp);
+ }
+
+
+@@ -112,11 +113,12 @@ void LogVerbose(const char* msg, ...){ + vsprintf(buf, msg, arglist);
+ Core::printerr(buf);
+ FILE* fp = fopen( "Stonesense.log", "a");
+- if(fp)
++ if(fp) {
+ vfprintf( fp, msg, arglist );
++ fclose(fp);
++ }
+ // Core::printerr(msg, arglist);
+ va_end(arglist);
+- fclose(fp);
+ }
+
+ void SetTitle(const char *format, ...)
+-- +1.7.12.4 + diff --git a/games-util/dfhack/files/ssense/0004-create-various-output-files-in-HOME-not-cwd.patch b/games-util/dfhack/files/ssense/0004-create-various-output-files-in-HOME-not-cwd.patch new file mode 100644 index 0000000..6197c1e --- /dev/null +++ b/games-util/dfhack/files/ssense/0004-create-various-output-files-in-HOME-not-cwd.patch @@ -0,0 +1,160 @@ +From d56a796c5e61af4434a8a0deca68763e6059fca1 Mon Sep 17 00:00:00 2001 +From: eroen <eroen@occam.eroen.eu> +Date: Sun, 21 Oct 2012 05:29:56 +0200 +Subject: [PATCH 4/5] create various output files in $HOME, not cwd. + +This is necessary, since Dwarf Fortress demands to control the cwd. +--- + ContentLoader.cpp | 8 +++++++- + CreatureConfiguration.cpp | 7 ++++++- + GroundMaterialConfiguration.cpp | 7 ++++++- + common.h | 1 + + main.cpp | 21 ++++++++++++++++++--- + 5 files changed, 38 insertions(+), 6 deletions(-) + +diff --git a/ContentLoader.cpp b/ContentLoader.cpp +index 7becd44..65d07df 100644 +--- a/ContentLoader.cpp ++++ b/ContentLoader.cpp +@@ -197,11 +197,17 @@ bool ContentLoader::Load(){ + }
+ */
+
++ char* filepath = getenv("HOME");
+ //DumpPrefessionNamesToDisk(professionStrings, "priofessiondump.txt");
+ //DumpPrefessionNamesToDisk(classIdStrings, "buildingdump.txt");
+ //DumpMaterialNamesToDisk(inorganicMaterials, "DUMPSES.txt");
+ //DumpMaterialNamesToDisk(Mats->race, "creaturedump.txt");
+- DumpItemNamesToDisk("itemdump.txt");
++ char filebasename[] = "itemdump.txt";
++ size_t filenamelen = strlen(filepath) + strlen(filebasename) + 2;
++ char* filename = new char[filenamelen];
++ snprintf(filename, filenamelen, "%s/%s", filepath, filebasename);
++ DumpItemNamesToDisk(filename);
++ delete[] filename;
+ //DF.Resume();
+
+ //Find what is obsidian
+diff --git a/CreatureConfiguration.cpp b/CreatureConfiguration.cpp +index 4d75b4c..9136f75 100644 +--- a/CreatureConfiguration.cpp ++++ b/CreatureConfiguration.cpp +@@ -39,13 +39,18 @@ void DumpCreatureNamesToDisk(){ + fclose(fp);*/
+ }
+ void DumpProfessionsToDisk(){
+- FILE* fp = fopen("dump.txt", "w");
++ char* filepath = getenv("HOME");
++ size_t filenamelength = 9 + 8 + strlen(filepath);
++ char* filename = new char[filenamelength];
++ snprintf(filename, filenamelength, "%s/ssense-dump.txt", filepath);
++ FILE* fp = fopen(filename, "w");
+ if(!fp) return;
+ string proffStr;
+ for(int j=0; (proffStr = contentLoader->professionStrings[j]) != "" ; j++){
+ fprintf(fp, "%i:%s\n",j, proffStr.c_str());
+ }
+ fclose(fp);
++ delete[] filename;
+ }
+
+ int translateProfession(const char* currentProf)
+diff --git a/GroundMaterialConfiguration.cpp b/GroundMaterialConfiguration.cpp +index 84c26b1..f5ffc06 100644 +--- a/GroundMaterialConfiguration.cpp ++++ b/GroundMaterialConfiguration.cpp +@@ -43,12 +43,17 @@ TerrainConfiguration::~TerrainConfiguration() + }
+
+ void DumpInorganicMaterialNamesToDisk(){
+- FILE* fp = fopen("dump.txt", "w");
++ char* filepath = getenv("HOME");
++ size_t filenamelen = 9 + 8 + strlen(filepath);
++ char* filename = new char[filenamelen];
++ snprintf(filename, filenamelen, "%s/ssense-dump.txt", filepath);
++ FILE* fp = fopen(filename, "w");
+ if(!fp) return;
+ for(uint32_t j=0; j < contentLoader->inorganic.size(); j++){
+ fprintf(fp, "%i:%s\n",j, contentLoader->inorganic[j].id.c_str());
+ }
+ fclose(fp);
++ delete[] filename;
+ }
+
+ void parseWallFloorSpriteElement( TiXmlElement* elemWallFloorSprite, vector<TerrainConfiguration*>& configTable ,int basefile, bool floor)
+diff --git a/common.h b/common.h +index 118ed47..7c19af7 100644 +--- a/common.h ++++ b/common.h +@@ -38,6 +38,7 @@ using namespace df::enums; + #include "Block.h"
+ #include <stdio.h>
+ #include <stdarg.h>
++#include <limits.h>
+
+ #define RELEASE
+
+diff --git a/main.cpp b/main.cpp +index 77917e0..d66fdce 100644 +--- a/main.cpp ++++ b/main.cpp +@@ -85,13 +85,18 @@ void LogError(const char* msg, ...){ + char buf[512] = {0};
+ vsprintf(buf, msg, arglist);
+ Core::printerr(buf);
+- FILE* fp = fopen( "Stonesense.log", "a");
++ char* filepath = getenv("HOME");
++ size_t filenamelength = 16 + strlen(filepath);
++ char* filename = new char[filenamelength];
++ snprintf(filename, filenamelength, "%s/Stonesense.log", filepath);
++ FILE* fp = fopen( filename, "a");
+ if(fp) {
+ vfprintf( fp, msg, arglist );
+ fclose(fp);
+ }
+ // Core::printerr(msg, arglist);
+ va_end(arglist);
++ delete[] filename;
+ }
+
+
+@@ -112,13 +117,18 @@ void LogVerbose(const char* msg, ...){ + char buf[512] = {0};
+ vsprintf(buf, msg, arglist);
+ Core::printerr(buf);
+- FILE* fp = fopen( "Stonesense.log", "a");
++ char* filepath = getenv("HOME");
++ size_t filenamelength = 16 + strlen(filepath);
++ char* filename = new char[filenamelength];
++ snprintf(filename, filenamelength, "%s/Stonesense.log", filepath);
++ FILE* fp = fopen( filename, "a");
+ if(fp) {
+ vfprintf( fp, msg, arglist );
+ fclose(fp);
+ }
+ // Core::printerr(msg, arglist);
+ va_end(arglist);
++ delete[] filename;
+ }
+
+ void SetTitle(const char *format, ...)
+@@ -179,10 +189,15 @@ void benchmark(){ + while(i--)
+ reloadDisplayedSegment();
+
+- FILE* fp = fopen("benchmark.txt", "w" );
++ char* filepath = getenv("HOME");
++ size_t filenamelength = 15 + strlen(filepath);
++ char* filename = new char[filenamelength];
++ snprintf(filename, filenamelength, "%s/benchmark.txt", filepath);
++ FILE* fp = fopen( filename, "w");
+ if(!fp) return;
+ fprintf( fp, "%lims", clock() - startTime);
+ fclose(fp);
++ delete[] filepath;
+ }
+
+ void animUpdateProc()
+-- +1.7.12.4 + diff --git a/games-util/dfhack/files/ssense/0005-don-t-build-static-tinyxml-as-lib.patch b/games-util/dfhack/files/ssense/0005-don-t-build-static-tinyxml-as-lib.patch new file mode 100644 index 0000000..4e3320f --- /dev/null +++ b/games-util/dfhack/files/ssense/0005-don-t-build-static-tinyxml-as-lib.patch @@ -0,0 +1,33 @@ +From 1a928b40e7f071fb31b182809db15ac037a0f48a Mon Sep 17 00:00:00 2001 +From: eroen <eroen@occam.eroen.eu> +Date: Mon, 22 Oct 2012 09:33:55 +0200 +Subject: [PATCH 5/5] don't build static tinyxml as lib + +--- + CMakeLists.txt | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 86c2c76..54d4570 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -43,6 +43,7 @@ SET(PROJECT_SRCS + VegetationConfiguration.cpp + main.cpp + ) ++FILE(GLOB TINYXML_SOURCES "${dfhack-tinyxml_SOURCE_DIR}/*.cpp") + + IF(UNIX) + IF(APPLE) +@@ -158,7 +159,7 @@ ELSE(UNIX) + ${stonesense_SOURCE_DIR}/allegrow/lib + ) + ENDIF(UNIX) +-DFHACK_PLUGIN(stonesense ${PROJECT_SRCS} LINK_LIBRARIES dfhack-tinyxml ${PROJECT_LIBS}) ++DFHACK_PLUGIN(stonesense ${PROJECT_SRCS} ${TINYXML_SOURCES} LINK_LIBRARIES ${PROJECT_LIBS}) + #install resources into DF/stonesense + install(DIRECTORY resources/ + DESTINATION "${DFHACK_DATA_DESTINATION}/stonesense" +-- +1.7.12.4 + diff --git a/games-util/dfhack/metadata.xml b/games-util/dfhack/metadata.xml new file mode 100644 index 0000000..f852a83 --- /dev/null +++ b/games-util/dfhack/metadata.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <longdescription lang="en"> + </longdescription> + <use> + <flag name="api">Install development headers. This breaks slotting.</flag> + <flag name="egg">Build libegg in stead of the libsdl overriding library for interfacing with dwarffortress. Requires a patched libgraphics.</flag> + <flag name="ssense">Build the Stonesense plugin.</flag> + <flag name="dfusion">Build the Dfusion plugin. This does not work properly.</flag> + </use> +</pkgmetadata> |