summaryrefslogtreecommitdiff
path: root/pcr/terasology/PKGBUILD
blob: 3cf9c4d4f3fc2bd68c98a90eb3694afe977ecfca (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
62
63
64
65
66
# Maintainer: André Silva <emulatorman@hyperbola.info>

pkgname=terasology
epoch=1
pkgver=1.0.0
pkgrel=1
pkgdesc="Yet another high resolution game with blocks like Minecraft!"
arch=('any')
license=('Apache')
url="http://terasology.org"
options=('!strip')
depends=('jdk8-openjdk' 'xorg-server-utils' 'openal')
makedepends=('gradle' 'unzip')
source=(
  terasology-${pkgver}.tar.gz::"https://github.com/MovingBlocks/Terasology/archive/v${pkgver}.tar.gz"
  "${pkgname}"
  "${pkgname}.desktop"
)
sha512sums=(
  'e184a92fed1ed9c602a8c8d561f40a9e121b3dceb2c4a112b7374e4d34d26754da609d56e5078ab3a06d91482bec51e92a54031390be1f18e3a63e5bce039180'
  'f94c1ac3d85e4fb91cc47056eeec3648d02be9090252401acb740af8c0580623c7ee57470d9e7317d6b577d613e317b5c16ec014f232ec68bc755e0eba7a975e'
  '737953ab10027100b6bd03ca60a3f1cd4fff503c4c5a1689b3e12ef8df66a3e3347c99d498e48dccc3be8d00e9e37fcab56d5c97bbb81dd310ce757979aa0276'
)

build() {
  cd Terasology-${pkgver}
  gradle --gradle-user-home=. distForLauncher
}

check() {
  cd Terasology-${pkgver}
  gradle --gradle-user-home=. test
}

package() {
  cd Terasology-${pkgver}
  install -Dm 755 "${srcdir}/${pkgname}" "$pkgdir/usr/bin/${pkgname}"
  install -Dm 644 "${srcdir}/${pkgname}.desktop" "${pkgdir}/usr/share/applications/${pkgname}.desktop"

  cd build/distributions
  unzip Terasology.zip

  # extract and install icons
  unzip -u libs/engine-* "org/terasology/icons/*"
  pushd org/terasology/icons
  for icon in *
  do
      size=${icon##*_}        #gooey_sweet_XX.png -> XX.png
      size=${size/.png/}      #XX.png -> XX
      install -Dm 644 "$icon" "${pkgdir}/usr/share/icons/${size}x${size}/apps/${pkgname}.png"
  done
  install -Dm 644 "${pkgdir}/usr/share/icons/64x64/apps/${pkgname}.png" "${pkgdir}/usr/share/pixmaps/${pkgname}.png"
  popd
  rm -rv org

  # add license
  install -Dm 644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"

  # remove files/dirs for other operating systems
  rm -v run_macosx.command Terasology.{x86,x64}.exe
  rm -rv natives/{macosx,windows}

  # remove/copy anything that's left
  rm -v Terasology.zip LICENSE README NOTICE
  cp -rav . "${pkgdir}/usr/share/${pkgname}"
}