Skip to content

Commit

Permalink
Added PKGBUILD script.
Browse files Browse the repository at this point in the history
  • Loading branch information
klei1984 committed Jun 1, 2024
1 parent be12328 commit 45a7c77
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 7 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required (VERSION 3.24)
cmake_minimum_required (VERSION 3.24)

project(max LANGUAGES C CXX)

Expand Down Expand Up @@ -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")
Expand Down
6 changes: 4 additions & 2 deletions assets/max-port.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
46 changes: 46 additions & 0 deletions cmake/scripts/linux/PKGBUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Copyright: 2024 M.A.X. Port Team
# License: MIT

# Maintainer: M.A.X. Port Team <[email protected]>
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}"
}
2 changes: 1 addition & 1 deletion debian/changelog
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ max-port (0.6.1-1) UNRELEASED; urgency=low

* Initial release. Closes: #nnnn

-- M.A.X. Port Team <maxport@gmail.com> Sun, 28 Apr 2024 10:57:12 +0200
-- M.A.X. Port Team <maxport@maxport.org> Sun, 28 Apr 2024 10:57:12 +0200
2 changes: 1 addition & 1 deletion debian/control
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Source: max-port
Section: contrib/games
Priority: optional
Maintainer: M.A.X. Port Team <maxport@gmail.com>
Maintainer: M.A.X. Port Team <maxport@maxport.org>
Build-Depends: cmake, ninja-build, wget, gettext, p7zip-full, libsdl2-dev,
debhelper-compat (= 13)
Standards-Version: 4.6.2
Expand Down
2 changes: 1 addition & 1 deletion debian/copyright
Original file line number Diff line number Diff line change
@@ -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 <maxport@gmail.com>
Upstream-Contact: M.A.X. Port Team <maxport@maxport.org>
Source: https://klei1984.github.io/max/download/

Files: *
Expand Down

0 comments on commit 45a7c77

Please sign in to comment.