diff options
| -rw-r--r-- | CMakeLists.txt | 15 | ||||
| -rw-r--r-- | src/base/path.h.in | 23 |
2 files changed, 25 insertions, 13 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 65a6efb..54d79ae 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,12 +14,13 @@ ############################################################################### # DEFAULT OPTIONS ############################################################################### -OPTION (BUILD_SERVER "Build the server instead of client" OFF) +OPTION (BUILD_SERVER "Build the server instead of client" OFF) OPTION (ENABLE_IPV6 "Build with the ipv6 support" ON) OPTION (WITH_AUDIO "Build with audio enabled" ON) OPTION (ENABLE_DEBUG "Build debug features" OFF) -OPTION (ENABLE_COMPRESSION "Compress documentation files" OFF) +OPTION (ENABLE_COMPRESSION "Compress documentation files" OFF) OPTION (DEVELOPER "Modify stuff to please tuxanci devs" OFF) +OPTION (PACKAGE "Define building binary package" OFF) OPTION (WITH_NLS "Build the translations" ON) OPTION (Apple "Build some apple quirks. USE ONLY ON MAC!" OFF) OPTION (WITH_OPENGL "Use opengl as renderer instead of SW" ON) @@ -30,7 +31,11 @@ OPTION (CROSSCOMPILE "Crosscompile tuxanci defined by ENV{TARGET}" OFF) SET ( WORKDIR ${CMAKE_SOURCE_DIR}/src ) # data because some distributions want different data placement SET ( CMAKE_CONF_PATH "/etc" CACHE PATH "Config path prefix" ) -SET ( CMAKE_INSTALL_PREFIX "/usr/local/" CACHE PATH "Install path prefix" ) +IF ( PACKAGE ) + SET ( CMAKE_INSTALL_PREFIX "/" CACHE PATH "Install path prefix" ) +ELSE ( PACKAGE ) + SET ( CMAKE_INSTALL_PREFIX "/usr/local/" CACHE PATH "Install path prefix" ) +ENDIF ( PACKAGE ) SET ( CMAKE_LOCALE_PATH "share/locale" CACHE PATH "Locale path prefix" ) SET ( CMAKE_DATA_PATH "share/" CACHE PATH "Data path prefix" ) SET ( CMAKE_LIB_PATH "lib/" CACHE PATH "Library path prefix" ) @@ -74,6 +79,10 @@ SET ( CMAKE_INSTALL_LOCALEDIR ${CMAKE_LOCALE_PATH} ) SET ( CMAKE_INSTALL_DATADIR ${CMAKE_DATA_PATH} ) SET ( CMAKE_INSTALL_LIBDIR ${LIB_INSTALL_DIR} ) SET ( CMAKE_INSTALL_DOCDIR ${CMAKE_DOC_PATH} ) +# defines to determine if we build package or not +IF ( PACKAGE ) + ADD_DEFINITIONS ( -DBUILD_PACKAGE ) +ENDIF ( PACKAGE ) # uninstall CONFIGURE_FILE ( "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in" diff --git a/src/base/path.h.in b/src/base/path.h.in index afa4161..69b7c55 100644 --- a/src/base/path.h.in +++ b/src/base/path.h.in @@ -4,19 +4,22 @@ #include "main.h" #cmakedefine USE_MAGICK +#ifdef BUILD_PACKAGE + #define PACKAGE_PREFIX "../" +#else /* BUILD_PACKAGE */ + #define PACKAGE_PREFIX "" +#endif /* BUILD_PACKAGE */ #define TUXANCI_VERSION "@TUXANCI_VERSION@" -#define PREFIX "@CMAKE_INSTALL_PREFIX@" -#ifndef PUBLIC_SERVER - #define APPNAME "tuxanci" -#else /* PUBLIC_SERVER */ - #define APPNAME "tuxanci-server" - #define SERVER_CONFIG "@CMAKE_CONF_PATH@" "/" APPNAME "/server.conf" +#define PREFIX PACKAGE_PREFIX "@CMAKE_INSTALL_PREFIX@" "/" +#define APPNAME "@APPNAME@" +#ifdef PUBLIC_SERVER + #define SERVER_CONFIG PREFIX "@CMAKE_CONF_PATH@" "/" APPNAME "/server.conf" #endif /* PUBLIC_SERVER */ -#define PATH_DIR "@CMAKE_DATA_PATH@" "/" APPNAME "/" +#define PATH_DIR PREFIX "@CMAKE_DATA_PATH@" "/" APPNAME "/" /* windows bug */ #ifndef __WIN32__ - #define PATH_MODULES "@LIB_INSTALL_DIR@" "/" APPNAME "/" + #define PATH_MODULES PREFIX "@LIB_INSTALL_DIR@" "/" APPNAME "/" #else /* __WIN32__ */ #define PATH_MODULES PREFIX #endif /* __WIN32__ */ @@ -25,8 +28,8 @@ #define PATH_ARENA PATH_DIR "arena/" #define PATH_SOUND PATH_DIR "sound/" #define PATH_MUSIC PATH_DIR "music/" -#define PATH_LOCALE "@CMAKE_LOCALE_PATH@" "/" -#define PATH_DOC "@CMAKE_DOC_PATH@" "/" +#define PATH_LOCALE PREFIX "@CMAKE_LOCALE_PATH@" "/" +#define PATH_DOC PREFIX "@CMAKE_DOC_PATH@" "/" #define PACKAGE "tuxanci" #endif /* PATH_H */ |