makedeb


rotp-git 1.04.r1.e3726fc-1


Remnants of the Precursors is a modernization of the original Master of Orion game from 1993

Viewing /PKGBUILD.

View raw.

Click here to go back to the Git tree for rotp-git.

# Maintainer: exponential <echo ZXhwb25lbnRpYWxtYXRyaXhAcHJvdG9ubWFpbC5jb20K | base64 -d>
_srcname=rotp-public
_pkgname=rotp
pkgname=rotp-git
pkgver=1.04.r1.e3726fc
pkgrel=1
pkgdesc="Remnants of the Precursors is a modernization of the original Master of Orion game from 1993"
arch=('all')
url="https://www.remnantsoftheprecursors.com/"
license=('GPL3' 'by-nc-nd4')
bookworm_depends=('openjdk-17-jre')
# at least one jre
optdepends=('openjdk-17-jre')
makedepends=('git' 'ffmpeg')
bookworm_makedepends=('openjdk-17-jdk')
# at least one jdk
optmakedepends=('openjdk-17-jdk')
source=("git+https://github.com/rayfowler/rotp-public")
b2sums=("SKIP")

pkgver() {
  cd "${srcdir}/${_srcname}/src"
  printf "%s.r%s.%s" "$(grep "public static String releaseId" rotp/Rotp.java | cut -d '"' -f 2)" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

prepare() {
  cd "${srcdir}/${_srcname}/launch4j"
  # convert icom
  [ -e "${_pkgname}.png" ] || ffmpeg -i "${_pkgname}.ico"  "${_pkgname}.png"
}

build(){
  cd "$srcdir/${_srcname}/src"
  javac -verbose rotp/Rotp.java
}

package() {
  cd "$srcdir/${_srcname}"
  # Create directories
  install -m755 -d $pkgdir/usr/{games,share/{applications,games}}
  # install
  cp -R src/rotp "$pkgdir/usr/share/games/${_pkgname}"
  install -Dm644 launch4j/${_pkgname}.png "${pkgdir}/usr/share/pixmaps/${_pkgname}.png"
  # doc
  install -Dm644 "README.md" "$pkgdir/usr/share/doc/${_pkgname}/readme"
  install -Dm644 "LICENSE" "$pkgdir/usr/share/doc/${_pkgname}/"

  # wrapper script
echo '#!/bin/sh

_name="rotp"
config_dir="${XDG_CONFIG_HOME:-$HOME/.config}/$_name"

# create home directory
mkdir -p "$config_dir/opt"
[ -e "$config_dir/opt/$_name" ] || ln -s "/usr/share/games/$_name" "$config_dir/opt/$_name"

# change to directory and launch
cd "$config_dir/opt"
exec java $_name.Rotp' > "$pkgdir/usr/games/${_pkgname}"
chmod 755 "$pkgdir/usr/games/${_pkgname}"

  # Desktop file
echo "[Desktop Entry]
Type=Application
Version=1.0
Encoding=UTF-8
Name=Remnants of the Precursors
Name[en]=Remnants of the Precursors
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" > $pkgdir/usr/share/applications/${_pkgname}.desktop
}