summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 491a9eb6235404121bcf780b7d7c90b6470f28b6 (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
# Maintainer: Graham Edgecombe <graham@grahamedgecombe.com>
pkgname=openrct2-git
pkgver=r3168.2ed1963
pkgrel=1
pkgdesc="Open source clone of RollerCoaster Tycoon 2"
arch=('i686' 'x86_64')
url="https://openrct2.com"
license=('GPL3')
depends=('wine' 'mingw-w64-sdl2' 'gtk-update-icon-cache' 'desktop-file-utils')
makedepends=('git' 'cmake' 'mingw-w64-gcc')
options=('!buildflags')
install=openrct2.install
source=("$pkgname"::'git://github.com/IntelOrca/OpenRCT2.git#branch=develop'
        'openrct2'
        'openrct2.desktop')
md5sums=('SKIP'
         'b750eaf997a27e981232b21a68fa868e'
         '035a407b940492c584c72f4f59f1bd69')

pkgver() {
  cd "$srcdir/$pkgname"
  printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

build() {
  cd "$srcdir/$pkgname"
  cmake -DCMAKE_TOOLCHAIN_FILE=CMakeLists_mingw.txt -DCMAKE_BUILD_TYPE=Debug .
  make

  # Create g2.dat. See the comment in the package() function for why we need to
  # symlink the DLLs here. openrct2.exe also seems to return a non-zero exit
  # code even if it builds the sprites successfully, so we have to ignore its
  # exit code.
  ln -sf /usr/i686-w64-mingw32/bin/SDL2.dll
  ln -sf /usr/i686-w64-mingw32/bin/libwinpthread-1.dll
  wine openrct2.exe sprite build data/g2.dat resources/g2 || true
}

package() {
  cd "$srcdir/$pkgname"

  # Standard OpenRCT2 distribution files.
  install -Dm644 openrct2.dll "$pkgdir/usr/share/openrct2/openrct2.dll"
  install -Dm755 openrct2.exe "$pkgdir/usr/share/openrct2/openrct2.exe"

  install -Dm644 data/g2.dat "$pkgdir/usr/share/openrct2/data/g2.dat"

  install -dm755 "$pkgdir/usr/share/openrct2/data/language"
  install -m644 data/language/* "$pkgdir/usr/share/openrct2/data/language/"

  # ArchLinux-specific stuff (launcher, .desktop file and icon).
  install -Dm755 "$srcdir/openrct2" "$pkgdir/usr/bin/openrct2"
  install -Dm644 "$srcdir/openrct2.desktop" "$pkgdir/usr/share/applications/openrct2.desktop"
  install -Dm644 resources/logo/icon_flag.svg "$pkgdir/usr/share/icons/hicolor/scalable/apps/openrct2.svg"

  # For Wine to find the SDL2.dll and libwinpthread-1.dll files they need to be
  # in the same directory as openrct2.exe, so we symlink them in place. We don't
  # use $CARCH here because on x86_64 OpenRCT2 is compiled with -m32,
  # therefore we always want to use the i686 DLLs. OpenRCT2 relies on
  # Wine's WoW64 support to actually run on x86_64 machines.
  ln -s /usr/i686-w64-mingw32/bin/SDL2.dll "$pkgdir/usr/share/openrct2"
  ln -s /usr/i686-w64-mingw32/bin/libwinpthread-1.dll "$pkgdir/usr/share/openrct2"
}