summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: a3869395a794221639541d875c188be50bdd8e03 (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
# Maintainer: Peter Cai <peter at typeblog dot net>

pkgname=unciv
_pkgname=Unciv
_gradle_ver=6.1.1 # This package does not work with system gradle
pkgver=3.9.10.REL
_pkgver=${pkgver%.*}-patch${pkgver##*.}
_pkgver=${_pkgver/-patchREL/}
pkgrel=1
_srcdir=$_pkgname-$_pkgver
pkgdesc="Open-source remake of Civilization V"
url="https://github.com/yairm210/Unciv"
license=('MPL-2.0')
depends=('jre8-openjdk' 'bash' 'xorg-xrandr')
makedepends=('jdk8-openjdk')
arch=('any')
source=(
  "https://github.com/yairm210/Unciv/archive/$_pkgver.zip"
  "https://services.gradle.org/distributions/gradle-$_gradle_ver-all.zip"
  "$_pkgname.sh"
  "$pkgname.desktop"
)
noextract=("gradle-$_gradle_ver-all.zip")
md5sums=('1b7291aefd1d363d71d4d6db1df97de0'
         'd1df7d94816bbedb2ab45187fceda7e5'
         'f8eab098f20681b8db232cc5709713d3'
         '42d5f7ea8ee48d2d643d070786f039ba')

prepare() {
  # Use gradle downloaded by our pkgbuild to allow caching
  sed -i "6s|https\\\://services.gradle.org/distributions|../../../|" $_srcdir/gradle/wrapper/gradle-wrapper.properties
  # Get rid of the Android part (it somehow always asks for Android SDK)
  gawk -i inplace 'BEGIN { doPrint = 1; } /project\(":android"\) {/ { doPrint = 0; } /^}$/ { if (doPrint != 1) { doPrint = 1; next }} { if (doPrint) print $0;}' $_srcdir/build.gradle.kts
  # We cannot just get rid of the android/ folder becuase we need assets from it
  rm -rf $_srcdir/android/{res,src,build.gradle.kts,gradle.properties,project.properties}
}

build() {
  cd $_srcdir
  unset _JAVA_OPTIONS
  export PATH=/usr/lib/jvm/java-8-openjdk/jre/bin/:$PATH
  GRADLE_USER_HOME="$srcdir" ./gradlew desktop:dist
}

package() {
  install -Dm755 $_pkgname.sh "$pkgdir/usr/bin/$_pkgname"
  install -Dm644 $pkgname.desktop "$pkgdir/usr/share/applications/$pkgname.desktop"
  install -Dm644 $_srcdir/extraImages/"Unciv icon v4.png" "$pkgdir/usr/share/pixmaps/unciv.png"
  install -Dm644 $_srcdir/desktop/build/libs/$_pkgname.jar "$pkgdir/usr/share/$_pkgname/$_pkgname.jar"
}