summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 27e36b215294d0e39dc41004a82ed875dfd134b2 (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
# Maintainer: Jon Gjengset <jon@tsp.io>
# Based on PKGBUILD for oilrush
# Repository here: https://github.com/Jonhoo/gamedevtycoon-PKGBUILD
# Changelog here: http://www.greenheartgames.com/game-dev-tycoon-changelog/
pkgname=game-dev-tycoon
pkgver=1.4.5
pkgrel=1
pkgdesc="a business simulation game where you start a video game development company"
arch=('i686' 'x86_64')
makedepends=('unzip')
depends=('mesa' 'node-webkit' 'alsa-lib')
conflicts=('game-dev-tycoon-demo')
provides=()
options=(!strip)
PKGEXT=".pkg.tar" # Because we don't want to recompress everything
                  # Compressing takes time and only saves about 6MB anyway
license=("commercial")
url="http://www.greenheartgames.com/app/game-dev-tycoon/"
_gamepkg="gamedevtycoon-${pkgver}.i386-x64.tar.gz"
_gamerel="1"
_gamemd5="954f535a0ebd67cb134e251ebbbe120b"
source=('game-dev-tycoon' 'game-dev-tycoon.desktop')
md5sums=('ae28f2cd5480964f05cf5699f3f1693c'
         '29e0fcaa10380835931bedc56530caac')

build() {
  cd ${srcdir}

  msg "You need a full copy of this game in order to install it"
  msg "Download the .tar.gz version of the game and give its path below"
  msg "Searching for \"${_gamepkg}\" in dir: $(readlink -f ${startdir})"
  pkgpath="${startdir}/${_gamepkg}"

  if [[ ! ( -f "${startdir}/${_gamepkg}" ) ]]; then
    error "Game file not found, please type path to game setup package:"
    read pkgpath
    if [[ ! ( "${pkgpath:0:1}" == "/" ) ]]; then
      pkgpath="${startdir}/${pkgpath}"
    fi
    if [[ ! ( -f "${pkgpath}" ) ]] ; then
       error "Unable to find game file." && return 1
    fi
  fi

  if [[ ! (`md5sum ${pkgpath} | cut -f1 -d' '` == "${_gamemd5}") ]]; then
    error "Game file seems to be a different version, problems may occur!"
  fi
  msg "Found game file, installing..."

  msg2 "Extracting archive"
  ln -fs "${pkgpath}" .
  # for some reason the .tar.gz is really a zip..?
  unzip -f "$(basename "$pkgpath")"

  msg2 "Fishing out ${CARCH} version"
  # not that it matters considering we're using the source directly...
  if [[ $CARCH == "x86_64" ]]; then
    tar xzf "gamedevtycoon-${pkgver}-${_gamerel}-x64.tar.gz"
    cd "gamedevtycoon-${pkgver}-${_gamerel}-x64"
  else
    tar xzf "gamedevtycoon-${pkgver}-${_gamerel}-i386.tar.gz"
    cd "gamedevtycoon-${pkgver}-${_gamerel}-i386"
  fi

  msg2 "Extracting game files"
  if [[ -e ../app.nw ]]; then
    rm -rf ../app.nw
  fi
  unzip -qq gamedevtycoon-bin -d ../app.nw && true

  # package.png is prettier than icon.png (transparent background)
  mv ../app.nw/package.png ../launcher.png
}

package() {
  cd "${srcdir}"
  install -d ${pkgdir}/opt/greenheartgames/${pkgname}

  msg2 "Copy game files"
  cp -R ${srcdir}/{app.nw,launcher.png} ${pkgdir}/opt/greenheartgames/${pkgname}/

  # Install Launcher
  msg2 "Install launcher to /usr/bin"
  install -D -m755 ${srcdir}/${pkgname} ${pkgdir}/usr/bin/${pkgname}

  msg2 "Ensuring node-webkit mods folder exists"
  install -d -m755 ${pkgdir}/usr/lib/node-webkit/mods

  # Install Desktop
  msg2 "Add .desktop file"
  install -D -m644 ${srcdir}/${pkgname}.desktop \
    ${pkgdir}/usr/share/applications/${pkgname}.desktop
}