summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 6ec4bc5bad486e9985a29f2c88529d49bf3a748d (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
67
68
69
70
71
72
73
74
75
# Maintainer: Sam S <smls75@gmail.com>
# Contributor: Daniel Wallace < danielwallace at gtmanfred dot com>

pkgname=bastion-hib
_installname=bastion
pkgver=1.2+h20161016
_hibver=10162016
pkgrel=1
pkgdesc="An action role-playing game set in a lush imaginative world (Humble Bundle/Store version)"
url="http://www.supergiantgames.com/games/bastion/"
license=('custom')
arch=('i686' 'x86_64')
groups=("hib5" "hib9")
depends=('sdl' 'mono' 'fmodex' 'libxft')
makedepends=('imagemagick')
optdepends=('xdg-utils: For the website links in the menu')
conflicts=('bastion')
replaces=('bastion')
options=('!strip')
PKGEXT=".pkg.tar"

_gamepkg="bastion-${_hibver}-bin"

source=("hib://$_gamepkg"
        "$_installname.desktop")
md5sums=('19fea173ff2da0f990f60bd5e7c3b237'
         'ff287fa599220f913e8a1ba7b062037e')

case $CARCH in
    i686)   _arch=x86    ; _lib=lib   ; _lib_other=lib64 ;;
    x86_64) _arch=x86_64 ; _lib=lib64 ; _lib_other=lib   ;;
esac

prepare() {
    # Set apart files to install separately
    mv data/{Bastion.bmp,Linux.README} .
    
    msg2 "Preparing icon..."
    convert Bastion.bmp Bastion.png
    
    msg2 "Preparing launch script..."
    echo -e "#!/usr/bin/env sh\n" \
            "cd /opt/$_installname\n" \
            "export force_s3tc_enable=true\n" \
            "export LD_LIBRARY_PATH='./$_lib:\$LD_LIBRARY_PATH'\n" \
            'exec mono Bastion.exe "$@"' \
        > launcher.sh
}

package() {
    _target="$pkgdir"/opt/$_installname
    
    # Install game data
    install -d "$_target"
    cp -alrT data "$_target"
    
    # Remove unneeded files
    rm -r "$_target"/$_lib_other
    rm -r "$_target"/$_lib/{libSDL*,libfmodex.so,libmono*}
    rm -r "$_target"/{mono,Bastion,Bastion.bin.*}
    rm -r "$_target"/{mscorlib,Mono.*,System*}.dll
    
    # Install launch script
    install -Dm755 launcher.sh "$pkgdir"/usr/bin/$_installname
    
    # Install desktop file & icon
    install -Dm644 $_installname.desktop \
                   "$pkgdir"/usr/share/applications/$_installname.desktop
    install -Dm644 Bastion.png \
                  "$pkgdir"/usr/share/icons/$_installname.png
    
    # Install docs
    install -Dm644 Linux.README \
                   "$pkgdir"/usr/share/doc/$_installname/Linux.README
}