diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d4f1663ba..6409fae86 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -15,7 +15,7 @@ stages: - mkdir -p artifact - cd cmakebuild - cmake -DCMAKE_INSTALL_PREFIX=/usr/ -DBUILD_SERVER=ON -DBUILD_CLIENT=ON -DRUN_IN_PLACE=OFF -DENABLE_CURL=ON -DENABLE_SOUND=ON -DENABLE_LUAJIT=ON -DENABLE_GETTEXT=ON -DENABLE_FREETYPE=ON -DENABLE_SYSTEM_GMP=ON -DENABLE_SYSTEM_JSONCPP=ON -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo -DENABLE_POSTGRESQL=ON \ - -DRUN_IN_PLACE=OFF -DCUSTOM_BINDIR=/usr/games -DCUSTOM_LOCALEDIR=/usr/share/locale -DCUSTOM_SHAREDIR=/usr/share/games/multicraft -DCUSTOM_EXAMPLE_CONF_DIR=/etc/multicraft .... + -DRUN_IN_PLACE=OFF -DCUSTOM_BINDIR=/usr/games -DCUSTOM_LOCALEDIR=/usr/share/locale -DCUSTOM_SHAREDIR=/usr/share/games/multicraft -DCUSTOM_EXAMPLE_CONF_DIR=/etc/multicraft .. - make -j$(nproc) - make install DESTDIR=../artifact artifacts: diff --git a/CMakeLists.txt b/CMakeLists.txt index 11a4945ed..815de9e2c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -134,6 +134,7 @@ elseif(UNIX) # Linux, BSD etc set(BINDIR "${CMAKE_INSTALL_PREFIX}/games") set(DOCDIR "${CMAKE_INSTALL_PREFIX}/share/doc/${PROJECT_NAME}") set(MANDIR "${CMAKE_INSTALL_PREFIX}/share/man") + set(ETCDIR "${CMAKE_INSTALL_PREFIX}/../etc") set(EXAMPLE_CONF_DIR "${CMAKE_INSTALL_PREFIX}/../etc/${PROJECT_NAME}") set(XDG_APPS_DIR "${CMAKE_INSTALL_PREFIX}/share/applications") set(APPDATADIR "${CMAKE_INSTALL_PREFIX}/share/metainfo") @@ -142,6 +143,14 @@ elseif(UNIX) # Linux, BSD etc endif() endif() +if(NOT RUN_IN_PLACE) +set(CUSTOM_ETCDIR "" CACHE STRING "Directory to install data files into") +if(NOT CUSTOM_ETCDIR STREQUAL "") + set(ETCDIR "${CUSTOM_ETCDIR}") + message(STATUS "Using ETCDIR=${ETCDIR}") +endif() +endif() + set(CUSTOM_SHAREDIR "" CACHE STRING "Directory to install data files into") if(NOT CUSTOM_SHAREDIR STREQUAL "") set(SHAREDIR "${CUSTOM_SHAREDIR}") @@ -232,14 +241,14 @@ if(UNIX AND NOT APPLE) install(FILES "misc/multicraft-xorg-icon-128.png" DESTINATION "${ICONDIR}/hicolor/128x128/apps" RENAME "multicraft.png") - install(FILES "doc/multicraftserver.confd" DESTINATION "${EXAMPLE_CONF_DIR}/conf.d" RENAME "${PROJECT_NAME}server") - install(FILES "doc/multicraftserver.defaults" DESTINATION "${EXAMPLE_CONF_DIR}/defaults" RENAME "${PROJECT_NAME}server") + install(FILES "doc/multicraftserver.confd" DESTINATION "${ETCDIR}/conf.d" RENAME "${PROJECT_NAME}server") + install(FILES "doc/multicraftserver.defaults" DESTINATION "${ETCDIR}/defaults" RENAME "${PROJECT_NAME}server") if(NOT RUN_IN_PLACE) - install(FILES "doc/multicraftserver.init" DESTINATION "${CMAKE_INSTALL_PREFIX}/../etc/init.d" RENAME "${PROJECT_NAME}server") + install(FILES "doc/multicraftserver.init" DESTINATION "${ETCDIR}/init.d" RENAME "${PROJECT_NAME}server") # install(FILES "doc/multicraftserver.initd" DESTINATION "${CMAKE_INSTALL_PREFIX}/etc/init.d" RENAME "${PROJECT_NAME}server") install(FILES "doc/multicraftserver.service" DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/systemd/system") install(FILES "doc/multicraftserver@.service" DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/systemd/system") - install(FILES "doc/multicraftserver.logrotate" DESTINATION "${CMAKE_INSTALL_PREFIX}/../etc/logrotate.d/" RENAME "${PROJECT_NAME}server") + install(FILES "doc/multicraftserver.logrotate" DESTINATION "${ETCDIR}/logrotate.d/" RENAME "${PROJECT_NAME}server") endif() endif()