summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: c9ad0033e8167a97a33f7dd71f42aa2367d6b3f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# Maintainer: Manuel Thalmann <m@nuth.ch>
_projname="Polyversal"
_pkgname="$(echo "$_projname" | tr "P" "p")-patcher"
pkgname="$_pkgname-bin"
pkgver=2.2.0
_pkgver="$(echo "$pkgver" | tr "." "_")"
_repo="CommitteeOfZero/polyversal-coz-linux-patcher"
_archive="$_projname-v$_pkgver"
pkgrel=1
pkgdesc="The Polyversal Linux Steam Patcher for the Committee of Zero's Science Adventure Steam Patches on Linux"
arch=("any")
url="https://github.com/$_repo"
license=("MIT")
groups=()
depends=()
makedepends=("curl" "jq" "sed")
optdepends=(
  "protontricks: Tool required for running the patcher"
  "flatpak: Allows automatic installation of \`protontricks\` from Flathub"
  "zenity: Required for using Polyversal Patcher as a GUI"
)
provides=("$_pkgname")
conflicts=("$_pkgname")
install="$pkgname.install"

source=(
  "$_pkgname.tar.gz::https://github.com/$_repo/releases/download/$pkgver/$_archive.tar.gz"
  "$_pkgname.svg::https://raw.githubusercontent.com/$_repo/$pkgver/assets/logo-square.svg"
)
sha256sums=(
  "f26006323e00de04d421d1ac94656208c18cf6868cede5d0654e7d410e2b8373"
  "62f3a79c1446932e1ce1d4a56991113739c7d7c6d8b4a8d9c994b62468229960"
)

pkgver() {
  curl --silent -L "https://api.github.com/repos/$_repo/releases/latest" | # Get latest release from GitHub api
    jq -r .tag_name # Get tag name
}

package() {
  _binDir="$pkgdir/usr/bin";
  _desktopDir="$pkgdir/usr/share/applications"
  _iconDir="$pkgdir/usr/share/icons/hicolor/scalable/apps"
  _binFile="$_archive/polyversal"
  _desktopFile="$_archive/Polyversal.desktop"

  sed -i \
    -e 's/\(DATADIR=\).*$/\1"$HOME\/.cache\/polyversal-patcher"/' \
    "$_binFile"

  sed -i \
    -e "s/\(Exec=\).*\/\(polyversal\( .*\)\?\)\$/\1\2/" \
    -e "\$a Icon=$_pkgname" \
    "$_desktopFile"

  install -dm755 "$_binDir" "$_desktopDir" "$_iconDir"
  install -Dm755 "$_binFile" "$_binDir"
  install -Dm644 "$_pkgname.svg" "$_iconDir"
  install -Dm644 "$_desktopFile" "$_desktopDir"
  install -Dm644 "$_archive/LICENSE" "$pkgdir/usr/share/licenses/$_pkgname/LICENSE"
}