From b3eae2dd818b2e355ca340923ce72aa49fdf66b0 Mon Sep 17 00:00:00 2001 From: mckaygerhard Date: Mon, 3 Jun 2024 13:51:09 -0400 Subject: [PATCH] set install paths and files for the system config * if not run_in_place is defined. install daemon files and assume the path of PREFIX/usr/games for binary lauchers, not PREFIX/usr/bin * use FHS as https://www.pathname.com/fhs/2.2/fhs-4.11.html that defines the right place for game data files as in the path of PREFIX/usr/share/games * install all the daemons files for openrc, sysvinit and shitstemd * install defaults and config files as default for daemon scripts --- .gitlab-ci.yml | 6 ++---- CMakeLists.txt | 21 +++++++++++++++------ doc/multicraftserver.defaults | 1 + 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 073c4e696..644516bd6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -13,11 +13,9 @@ stages: script: - mkdir cmakebuild - mkdir -p artifact/multicraft/usr/ -# - mkdir -p games -# - cd games -# - git clone -b stable-5.2 --single-branch https://codeberg.org/minenux/minetest-game-minetest minetest - cd cmakebuild - - cmake -DCMAKE_INSTALL_PREFIX=../artifact/multicraft/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 .. + - cmake -DCMAKE_INSTALL_PREFIX=../artifact/multicraft/usr/ -DBUILD_SERVER=ON -DBUILD_CLIENT=ON -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 .. - make -j$(nproc) - make install artifacts: diff --git a/CMakeLists.txt b/CMakeLists.txt index 8a6c4f39b..8d5321f7f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -130,11 +130,11 @@ elseif(UNIX) # Linux, BSD etc set(ICONDIR "unix/icons") set(LOCALEDIR "locale") else() - set(SHAREDIR "${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}") - set(BINDIR "${CMAKE_INSTALL_PREFIX}/bin") + set(SHAREDIR "${CMAKE_INSTALL_PREFIX}/share") + set(BINDIR "${CMAKE_INSTALL_PREFIX}/games") set(DOCDIR "${CMAKE_INSTALL_PREFIX}/share/doc/${PROJECT_NAME}") set(MANDIR "${CMAKE_INSTALL_PREFIX}/share/man") - set(EXAMPLE_CONF_DIR ${DOCDIR}) + 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") set(ICONDIR "${CMAKE_INSTALL_PREFIX}/share/icons") @@ -157,8 +157,8 @@ endif() set(CUSTOM_DOCDIR "" CACHE STRING "Directory to install documentation into") if(NOT CUSTOM_DOCDIR STREQUAL "") set(DOCDIR "${CUSTOM_DOCDIR}") - if(NOT RUN_IN_PLACE) - set(EXAMPLE_CONF_DIR ${DOCDIR}) + if(RUN_IN_PLACE) + set(EXAMPLE_CONF_DIR ".") endif() message(STATUS "Using DOCDIR=${DOCDIR}") endif() @@ -221,7 +221,7 @@ install(FILES "doc/client_lua_api.txt" DESTINATION "${DOCDIR}" COMPONENT "Docs") install(FILES "doc/menu_lua_api.txt" DESTINATION "${DOCDIR}" COMPONENT "Docs") install(FILES "doc/texture_packs.txt" DESTINATION "${DOCDIR}" COMPONENT "Docs") install(FILES "doc/world_format.txt" DESTINATION "${DOCDIR}" COMPONENT "Docs") -install(FILES "multicraft.conf.example" DESTINATION "${EXAMPLE_CONF_DIR}") +install(FILES "multicraft.conf.example" DESTINATION "${EXAMPLE_CONF_DIR}" RENAME "${PROJECT_NAME}.conf") if(UNIX AND NOT APPLE) install(FILES "doc/minetest.6" DESTINATION "${MANDIR}/man6" RENAME "${PROJECT_NAME}.6") @@ -232,6 +232,15 @@ 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") + 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.initd" DESTINATION "${CMAKE_INSTALL_PREFIX}/etc/init.d" RENAME "${PROJECT_NAME}server") + install(FILES "doc/multicraftserver.service" DESTINATION "${CMAKE_INSTALL_PREFIX}/usr/lib/systemd/system") + install(FILES "doc/multicraftserver@.service" DESTINATION "${CMAKE_INSTALL_PREFIX}/usr/lib/systemd/system") + install(FILES "doc/multicraftserver.logrotate" DESTINATION "${CMAKE_INSTALL_PREFIX}/etc/logrotate.d/" RENAME "${PROJECT_NAME}server") + endif() endif() if(APPLE) diff --git a/doc/multicraftserver.defaults b/doc/multicraftserver.defaults index 0c41d8688..505afb58a 100644 --- a/doc/multicraftserver.defaults +++ b/doc/multicraftserver.defaults @@ -1,4 +1,5 @@ # DEB/RPM based server default distro config file +# for apk place as /etc/conf.d/multicraftserver # for deb place as /etc/defaults/multicraftserver # for rpm place as /etc/sysconfig/multicraftserver USER="multicraft"