diff --git a/CMakeLists.txt b/CMakeLists.txt index 481d2621..0fb3e8ea 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.24) +cmake_minimum_required (VERSION 3.24) project(max LANGUAGES C CXX) @@ -96,7 +96,7 @@ if(UNIX) include(GNUInstallDirs) set(GAME_INSTALL_PATH "${CMAKE_INSTALL_DATADIR}/max-port") - if(MAXPORT_FLATPAK_BUILD OR MAXPORT_PKGMAKE_BUILD) + if(MAXPORT_FLATPAK_BUILD) set(GAME_INSTALL_LIB_PATH "${CMAKE_INSTALL_LIBDIR}") else() set(GAME_INSTALL_LIB_PATH "${CMAKE_INSTALL_LIBDIR}/max-port") diff --git a/assets/max-port.in b/assets/max-port.in index a6d944c8..96463872 100644 --- a/assets/max-port.in +++ b/assets/max-port.in @@ -182,8 +182,10 @@ cp -n "$maxport_game_data_dir/*.mlt" "$maxport_prefs_dir" 2>/dev/null || true cp -n "$maxport_game_data_dir/*.bak" "$maxport_prefs_dir" 2>/dev/null || true # Play the game -if [ -x "@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@/max-port/max" ]; then - exec "@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@/max-port/max" +if [ -x "@CMAKE_INSTALL_PREFIX@/@GAME_INSTALL_LIB_PATH@/max" ]; then + LD_LIBRARY_PATH="${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}@CMAKE_INSTALL_PREFIX@/@GAME_INSTALL_LIB_PATH@" + exec "@CMAKE_INSTALL_PREFIX@/@GAME_INSTALL_LIB_PATH@/max" elif [ -x "$maxport_base_dir/max" ]; then + LD_LIBRARY_PATH="${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}$maxport_base_dir" exec "$maxport_base_dir/max" fi diff --git a/cmake/scripts/linux/PKGBUILD b/cmake/scripts/linux/PKGBUILD new file mode 100644 index 00000000..6c237d1b --- /dev/null +++ b/cmake/scripts/linux/PKGBUILD @@ -0,0 +1,46 @@ +# Copyright: 2024 M.A.X. Port Team +# License: MIT + +# Maintainer: M.A.X. Port Team +pkgname="max-port" +pkgver=0.6.1 +pkgrel=1 +pkgdesc="conquer and plunder-type turn-based sci-fi strategy game" +arch=("${CARCH}") +url="https://github.com/klei1984/max" +license=("MIT") +depends=("sh" "libnewt" "glibc" "gcc-libs") +makedepends=("git" "cmake" "gcc" "ninja" "wget" "gettext" "p7zip" "libx11" + "libxcursor" "libxext" "libxrender" "pipewire" "libpulse" + "wayland" "wayland-protocols" "desktop-file-utils" + "libdecor" "libxss") +source=("$pkgname::git+https://github.com/klei1984/max.git") +provides=("$pkgname") +conflicts=("$pkgname") +sha256sums=("SKIP") + +pkgver() { + cd "$pkgname" + git describe --long --tags --abbrev=8 --exclude="*[a-zA-Z][a-zA-Z]*" \ + | sed -E "s/^[^0-9]*//;s/([^-]*-g)/r\1/;s/-/./g" +} + +build() { + cd "${srcdir}/${pkgname}" + DESTDIR=$pkgdir cmake --no-warn-unused-cli -Wno-dev -G "Ninja" \ + -DCMAKE_TOOLCHAIN_FILE=./cmake/toolchain-linux-${CARCH}.cmake \ + -DMAXPORT_PKGMAKE_BUILD=TRUE \ + -DCMAKE_BUILD_TYPE=None \ + -DBUILD_SHARED_LIBS=ON \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -S . -B build + cmake --build build --parallel +} + +package() { + cd "${srcdir}/${pkgname}" + DESTDIR="$pkgdir" cmake --install build + chmod 755 "${pkgdir}/usr/bin/${pkgname}" + desktop-file-edit --set-key="Exec" --set-value="max-port" "$pkgdir/usr/share/applications/$pkgname.desktop" + install -Dm644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}" +} diff --git a/debian/changelog b/debian/changelog index 0006b1e7..56fd7b16 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,4 +2,4 @@ max-port (0.6.1-1) UNRELEASED; urgency=low * Initial release. Closes: #nnnn - -- M.A.X. Port Team Sun, 28 Apr 2024 10:57:12 +0200 + -- M.A.X. Port Team Sun, 28 Apr 2024 10:57:12 +0200 diff --git a/debian/control b/debian/control index d8196262..124d69f2 100644 --- a/debian/control +++ b/debian/control @@ -1,7 +1,7 @@ Source: max-port Section: contrib/games Priority: optional -Maintainer: M.A.X. Port Team +Maintainer: M.A.X. Port Team Build-Depends: cmake, ninja-build, wget, gettext, p7zip-full, libsdl2-dev, debhelper-compat (= 13) Standards-Version: 4.6.2 diff --git a/debian/copyright b/debian/copyright index 474619ce..4b26ed8f 100644 --- a/debian/copyright +++ b/debian/copyright @@ -1,6 +1,6 @@ Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: max-port -Upstream-Contact: M.A.X. Port Team +Upstream-Contact: M.A.X. Port Team Source: https://klei1984.github.io/max/download/ Files: *