summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 6db77531f063e6553f2d35d4bed657e830dafe38 (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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# Maintainer: Malte Wessel <muunleit AT lavabit DOT com>

pkgname=atomzombiesmasher
pkgver=1.94
pkgrel=2
pkgdesc="RTS, evacuating civilians out of zombie-contaminated cities. (Commercial)"
arch=('any')
url="http://blendogames.com/atomzombiesmasher/"
license=("custom:commercial")
[ "$CARCH" = "x86_64" ] && depends=('libgdiplus' 'mono' 'csfml-bin')
conflicts=("atomzombiesmasherdemo")
#source=("http://blendogames.com/files/atomzombiepatch_v${pkgver//./_}_linux.tar")
source=("http://blendogames.com/files/atomzombiepatch_v${pkgver//./_}_linux.tar.gz")
md5sums=('c9512b8c841841967c20a81d36f7a6bc')

# Different known files delivered by Blendo-Games
_v1_23="${pkgname}_v1_23.tar.gz"
_v1_23md5="3286a655fd6a34cf376d69a185b5e53f"
_v1_85="${pkgname}_v1_85.tar"
_v1_85md5="304a494d4c81296c0d13b6cbe051e04c"


build() {
  # Check if game-archive is in build directory
  cd $startdir
  if [[ -e $_v1_23 ]]; then   # If you get another file from Blendo Games, please change it here
    _gamepkg=$_v1_23
    _gamemd5=$_v1_23md5
  elif [[ -e $_v1_85 ]]; then
    _gamepkg=$_v1_85
    _gamemd5=$_v1_85md5
  else
    msg "!! AtomZombieSmasher is a commercial game.
    !! You need a full copy of this game in order to install it.
    !! Please copy $_v1_23 or $_v1_85
    !! to $startdir " && return 1
  fi

  # Validate game-archive
  if [[ "$(md5sum $_gamepkg | awk '{print $1}')" == "$_gamemd5" ]]; then
    msg "Check: $_gamepkg is the correct."
  else
    msg "!! Check: $_gamepkg didn't match md5sum!" && return 1
  fi

  # Extract game-archive
  msg "Extracting archive..."
  tar xaf $startdir/$_gamepkg -C $srcdir 

  cd $srcdir/$pkgname
  sed -i "s/\.\/data/\/opt\/$pkgname\/data/g" AtomZombieSmasher

  # Copy from patch to game
  if ! [[ "$_gamepkg" =~ "${pkgver//./_}" ]]; then
    msg "Patching to version $pkgver ..."
    cp -a $srcdir/data        $srcdir/$pkgname/
    cp -a $srcdir/readme.htm  $srcdir/$pkgname/
  fi

  # Create startscript
	cat > $srcdir/$pkgname.desktop <<- EOF
  [Desktop Entry]
  Name=AtomZombieSmasher
  GenericName=AtomZombieSmasher
  Comment=RTS, evacuating civilians out of zombie-contaminated cities
  Exec=atomzombiesmasher
  Icon=/opt/atomzombiesmasher/data/content/textures/icon.png
  Terminal=false
  Type=Application
  Categories=Game;
	EOF
}

package() {
  # Create pkgdir folders
  install -d $pkgdir/usr/bin
  install -d $pkgdir/usr/share/doc/$pkgname
  install -d $pkgdir/usr/share/applications
  install -g games -d $pkgdir/opt/$pkgname

  # Copy game
  cp -a $srcdir/$pkgname/*              $pkgdir/opt/$pkgname
  mv $pkgdir/opt/$pkgname/readme.htm    $pkgdir/usr/share/doc/$pkgname
  cp -a $srcdir/$pkgname.desktop        $pkgdir/usr/share/applications/

  # executable link
  ln -s /opt/$pkgname/AtomZombieSmasher $pkgdir/usr/bin/$pkgname
  
  if [ "$CARCH" = "x86_64" ]; then
    # remove packaged libraries
    cd $pkgdir/opt/$pkgname/data
    rm *.so*
    rm `ls | grep .dll | grep -v ^sfmlnet | grep -v ^Tao`

    # point startup script to system mono
    sed -i "s|\./mono|mono|" atomzombiesmasher
  fi

}

# vim:set ts=2 sw=2 et: