makedeb


rotp-governor-mod-bin 4.04.0-2


Governor mod and compressed assets of Remnants of the Precursors game.

Viewing /PKGBUILD.

View raw.

Click here to go back to the Git tree for rotp-governor-mod-bin.

# Maintainer: exponential <echo ZXhwb25lbnRpYWxtYXRyaXhAcHJvdG9ubWFpbC5jb20K | base64 -d>

_pkgname=rotp-governor-mod
pkgname=rotp-governor-mod-bin
pkgver=4.04.0
pkgrel=2
pkgdesc="Governor mod and compressed assets of Remnants of the Precursors game."
# bundled libwebp-imageio.so
arch=('amd64')
url="https://github.com/coder111111/rotp-public"
license=('GPL3' 'by-nc-nd4' 'APACHE2')
bookworm_optdepends=('openjdk-17-jre')
# many jre
optdepends=('openjdk-17-jre' 'libcanberra-gtk-module')
makedepends=('ffmpeg')
source=("${_pkgname}-${pkgver}-mini.jar::https://github.com/coder111111/rotp-public/releases/download/v${pkgver}/rotp-${pkgver}-mini.jar"
        "https://github.com/coder111111/rotp-public/raw/refs/tags/v${pkgver}/LICENSE"
        "https://github.com/coder111111/rotp-public/raw/refs/tags/v${pkgver}/launch4j/rotp.ico")
b2sums=('2db1e8a0bde6f0d2c71ea63c0bb3b9aebe78c6fef6c6d2593492990967b6a78462c2db0b972a745500cfa8775ea0bac72d5c70940061e52ac03dfbf033f9a740'
        '9299ced9dc45e8bb4b5daefb1a001f41dd99faba2be69aec960431b6a2535861cd9b26fe2d58a9e6165bad4f78a19589b6f0ee71bb655cfa8287b6c7f46ee3a4'
        '5b1958dc8ce2bf39505095b63164e1db62390224b4e250a451d28e725895005691e9b45b60142532172421789b93f38a4a6b2a22b3401b72a620ebdb9e77d5b4')
noextract=("${_pkgname}-${pkgver}-mini.jar")
extensions=()

prepare() {
  cd "${srcdir}"
  # extract
  mkdir -p "${_pkgname}-${pkgver}"
  bsdtar -xf "${_pkgname}-${pkgver}-mini.jar" -C "${_pkgname}-${pkgver}"
  # rm junk
  rm -Rf "${_pkgname}-${pkgver}/native/"{mac,win}
  # convert icom
  [ -e "${_pkgname}.png" ] || ffmpeg -i rotp.ico  "${_pkgname}.png"
}

build() {
  cd "${srcdir}"
  # hicolor icons
  _resolutions=(96 64 48 32 16)
  for _res in "${_resolutions[@]}"; do
    mkdir -p "hicolor/${_res}x${_res}/apps"
    ffmpeg -y -i "${_pkgname}.png" -vf scale="${_res}:${_res}" "hicolor/${_res}x${_res}/apps/${_pkgname}.png"
  done
  # WRAPPER
  export _WRAPPER='#!/bin/sh

set -eu

## VARIABLES
_name="rotp-governor-mod"
_LIBPREFIX="/usr/lib/games/${_name}"
_SHAREPREFIX="/usr/share/games/${_name}"
config_dir="${XDG_CONFIG_HOME:-$HOME/.config}/$_name"

# Home directory
mkdir -p "$config_dir/opt"
for _file in $(ls "${_SHAREPREFIX}") ; do
  [ -e "$config_dir/opt/$_file" ] || ln -s "${_SHAREPREFIX}/$_file"  "$config_dir/opt"
done
[ -e "$config_dir/opt/native" ] || ln -s "${_LIBPREFIX}/native" "$config_dir/opt"

## change to directory and launch
cd "$config_dir/opt"
exec java rotp.Rotp "$@"'

  # Desktop file
  export _DESKTOPFILE="[Desktop Entry]
Type=Application
Version=1.0
Encoding=UTF-8
Name=Remnants of the Precursors (governor mod)
Name[en]=Remnants of the Precursors (governor mod)
GenericName=A Master of Orion clone
GenericName[en]=A Master of Orion clone
Comment=Conquer the galaxy
Comment[en]=Conquer the galaxy
Icon=${_pkgname}
Exec=${_pkgname}
Terminal=false
StartupNotify=false
Categories=Application;Game"

}

package() {
  cd "$srcdir"
  # Create directories
  install -m755 -d $pkgdir/usr/{games,"lib/games/${_pkgname}",share/{applications,games,doc/${_pkgname}}}
  # install
  cp -R "${_pkgname}-${pkgver}" "$pkgdir/usr/share/games/${_pkgname}"
  mv "$pkgdir/usr/share/games/${_pkgname}/native" "$pkgdir/usr/lib/games/${_pkgname}/"
  install -Dm644 "${_pkgname}.png" "${pkgdir}/usr/share/pixmaps/${_pkgname}.png"
  # doc
  install -Dm644 "LICENSE" "$pkgdir/usr/share/doc/${_pkgname}/"
  ln -s "/usr/share/games/${_pkgname}/README.md" "$pkgdir/usr/share/doc/${_pkgname}/readme"
  ln -s "/usr/share/games/${_pkgname}/META-INF/LICENSE" "$pkgdir/usr/share/doc/${_pkgname}/LICENSE-jackson"
  ln -s /usr/share/common-licenses/Apache-2.0 "$pkgdir/usr/share/doc/${_pkgname}/"
  # Wrapper
  echo "$_WRAPPER" > "$pkgdir/usr/games/${_pkgname}"
  chmod 755 "$pkgdir/usr/games/${_pkgname}"
  # Icons and desktop file
  echo "$_DESKTOPFILE" > $pkgdir/usr/share/applications/${_pkgname}.desktop
  cp -R "${srcdir}/hicolor" "${pkgdir}/usr/share/icons/"
}