diff --git a/CMakeLists.txt b/CMakeLists.txt index 293dde426..9c3b2d5da 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,8 +17,23 @@ endif() set(CPACK_PACKAGE_VERSION_MAJOR "0") set(CPACK_PACKAGE_VERSION_MINOR "5") set(CPACK_PACKAGE_VERSION_PATCH "8") +set(DFHACK_REVISION "1") + set(DFHACK_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}") +set(CPACK_PACKAGE_VERSION ${DFHACK_VERSION}) + set(CPACK_PACKAGE_NAME "dfhack") +SET(CPACK_PACKAGE_VENDOR "dethware.org") +SET(CPACK_PACKAGE_CONTACT "peterix@dethware.org") +SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Memory hacks for Dwarf Fortress") +SET(CPACK_PACKAGE_DESCRIPTION +"DFHack is a Dwarf Fortress memory access library and a set of basic +tools using this library. The library is a work in progress, so things +might change as more tools are written for it. +. +It is an attempt to unite the various ways tools access DF memory and +allow for easier development of new tools.") + ## setting the build type IF(NOT DEFINED CMAKE_BUILD_TYPE OR CMAKE_BUILD_TYPE STREQUAL "") @@ -35,8 +50,14 @@ IF(WIN32) ELSE() set (DFHACK_INST_DEFAULT "linux") ENDIF() -SET( DFHACK_INSTALL ${DFHACK_INST_DEFAULT} CACHE STRING "Choose the install type: 'portable' for a portable zip or tar.gz package (windows default), 'linux' for packaging and system installs on linux (linux default).") -SET( MEMXML_DATA_PATH . CACHE PATH "Path to a valid Memory.xml file. This is baked into the library, so when you package DFHack for linux, set it to the right path.") +SET( DFHACK_INSTALL ${DFHACK_INST_DEFAULT} CACHE STRING +"Choose the install type: +'portable' for a portable zip or tar.gz package (windows default) +'linux' for generic packaging and system installs on linux (linux default) +'ubuntu-10.10' for ubuntu maverick package.") +SET( MEMXML_DATA_PATH . CACHE PATH +"Path to a valid Memory.xml file. +This is baked into the library, so when you package DFHack for linux, set it to the right path.") IF(${DFHACK_INSTALL} STREQUAL "portable") # the dfhack libraries will be installed here: @@ -82,6 +103,31 @@ IF(${DFHACK_INSTALL} STREQUAL "linux") SET(DFHACK_DOXYGEN_DESTINATION share/dfhack/doc/doxygen) ENDIF() +IF(${DFHACK_INSTALL} STREQUAL "ubuntu-10.10") + if(WIN32) + MESSAGE(FATAL_ERROR "WTF are you doing?") + endif() + # set RPATH to always point at the dfhack lib using relative path. + SET(CMAKE_INSTALL_RPATH "$ORIGIN/../lib/") + # the dfhack libraries will be installed here: + SET(DFHACK_LIBRARY_DESTINATION usr/lib) + # the dfhack tools will be installed here: + SET(DFHACK_BINARY_DESTINATION usr/bin) + # Memory.xml goes here: + SET(DFHACK_DATA_DESTINATION usr/share/dfhack) + # Includes go here: + SET(DFHACK_INCLUDES_DESTINATION usr/include) + # documentation goes here: + SET(DFHACK_USERDOC_DESTINATION usr/share/dfhack/doc) + SET(DFHACK_DEVDOC_DESTINATION usr/share/dfhack/doc) + SET(DFHACK_DOXYGEN_DESTINATION usr/share/dfhack/doc/doxygen) + INSTALL(FILES + "${CMAKE_CURRENT_SOURCE_DIR}/package/ubuntu-10.10/99-dfhack.conf" + DESTINATION etc/sysctl.d) +ENDIF() + + + ## some options for the user/developer to play with OPTION(BUILD_DFHACK_LIBRARY "Build the library. Needed for all the tools." ON) OPTION(BUILD_DFHACK_C_BINDINGS "Build the C portion of the library." ON) @@ -153,4 +199,43 @@ IF(${DFHACK_INSTALL} STREQUAL "portable") ENDIF() set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${DFHACK_VERSION}-${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}") INCLUDE(CPack) +ENDIF() + +#------------------------------------------------------------------------------- +# Figure out debian architecture +#------------------------------------------------------------------------------- + +FUNCTION(GET_DEBIAN_ARCHITECTURE arch) + SET(dpkgarch) + + FIND_PROGRAM(DPKG_CMD dpkg) + IF(NOT DPKG_CMD) + MESSAGE(STATUS "Can not find dpkg in your path, default to i386.") + SET(${arch} i386 PARENT_SCOPE) + ENDIF() + EXECUTE_PROCESS(COMMAND "${DPKG_CMD}" --print-architecture + OUTPUT_VARIABLE dpkgarch + OUTPUT_STRIP_TRAILING_WHITESPACE ) + SET(${arch} ${dpkgarch} PARENT_SCOPE) +ENDFUNCTION() + +IF(${DFHACK_INSTALL} STREQUAL "ubuntu-10.10") + SET(CPACK_GENERATOR "DEB") + + #wtf, wtf, wtf. force them to be empty + set(CMAKE_INSTALL_PREFIX "" FORCE) + set(CPACK_INSTALL_PREFIX "") + SET(CPACK_PACKAGING_INSTALL_PREFIX "") + set(CPACK_SET_DESTDIR true) + + SET(CPACK_DEBIAN_PACKAGE_SECTION "Games") # yep. magma. + SET(CPACK_DEBIAN_PACKAGE_PRIORITY "optional") # very. + SET(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON) # find deps automatically! hopefully... maybe... + SET(INSTSCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/package/ubuntu-10.10") + SET(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${INSTSCRIPT}/postinst;${INSTSCRIPT}/preinst;${INSTSCRIPT}/postrm") + + GET_DEBIAN_ARCHITECTURE(PKG_ARCHITECTURE) + + set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}_${DFHACK_VERSION}-${DFHACK_REVISION}_${PKG_ARCHITECTURE}") + INCLUDE(CPack) ENDIF() \ No newline at end of file diff --git a/dfhack-icon.png b/dfhack-icon.png new file mode 100644 index 000000000..9f0de50b1 Binary files /dev/null and b/dfhack-icon.png differ diff --git a/library/private/ModuleFactory.h b/library/private/ModuleFactory.h new file mode 100644 index 000000000..be6be3799 --- /dev/null +++ b/library/private/ModuleFactory.h @@ -0,0 +1,44 @@ +/* + w ww.so*urceforge.net/projects/dfhack + Copyright (c) 2009 Petr Mrázek (peterix), Kenneth Ferland (Impaler[WrG]), dorf + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any + damages arising from the use of this software. + + Permission is granted to anyone to use this software for any + purpose, including commercial applications, and to alter it and + redistribute it freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must + not claim that you wrote the original software. If you use this + software in a product, an acknowledgment in the product documentation + would be appreciated but is not required. + + 2. Altered source versions must be plainly marked as such, and + must not be misrepresented as being the original software. + + 3. This notice may not be removed or altered from any source + distribution. + */ + +#ifndef MODULE_FACTORY_H_INCLUDED +#define MODULE_FACTORY_H_INCLUDED + +namespace DFHack +{ + class Module; + class DFContextShared; + Module* createCreatures(DFContextShared * d); + Module* createGui(DFContextShared * d); + Module* createWindowIO(DFContextShared * d); + Module* createWorld(DFContextShared * d); + Module* createMaterials(DFContextShared * d); + Module* createItems(DFContextShared * d); + Module* createTranslation(DFContextShared * d); + Module* createVegetation(DFContextShared * d); + Module* createBuildings(DFContextShared * d); + Module* createConstructions(DFContextShared * d); + Module* createMaps(DFContextShared * d); +} +#endif \ No newline at end of file diff --git a/package/ubuntu-10.10/99-dfhack.conf b/package/ubuntu-10.10/99-dfhack.conf new file mode 100644 index 000000000..bc7cd2bc2 --- /dev/null +++ b/package/ubuntu-10.10/99-dfhack.conf @@ -0,0 +1,6 @@ +# some settings required for dfhack. fucks up local security... +# shame on kernel devs and ubuntu people for not providing +# an /official/ way to manipulate things and just putting up roadblocks +# instead of proper design +kernel.randomize_va_space = 0 +kernel.yama.ptrace_scope = 0 \ No newline at end of file diff --git a/package/ubuntu-10.10/postinst b/package/ubuntu-10.10/postinst new file mode 100755 index 000000000..040e2b032 --- /dev/null +++ b/package/ubuntu-10.10/postinst @@ -0,0 +1,3 @@ +#!/bin/sh +sysctl -w kernel.randomize_va_space=0 +sysctl -w kernel.yama.ptrace_scope=0 \ No newline at end of file diff --git a/package/ubuntu-10.10/postrm b/package/ubuntu-10.10/postrm new file mode 100755 index 000000000..3b8cdfc62 --- /dev/null +++ b/package/ubuntu-10.10/postrm @@ -0,0 +1,2 @@ +#!/bin/sh +# do nothing. blah. \ No newline at end of file diff --git a/package/ubuntu-10.10/preinst b/package/ubuntu-10.10/preinst new file mode 100755 index 000000000..b194ee6c6 --- /dev/null +++ b/package/ubuntu-10.10/preinst @@ -0,0 +1,3 @@ +#!/bin/sh +mkdir -p /usr/share/dfhack/doc +mkdir -p /usr/share/dfhack \ No newline at end of file