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
# Maintainer: gadget3000 <gadget3000 at msn dot com>
# Contributor: mikers <mikeonthecomputer at gmail dot com>

pkgname=vvvvvv
pkgver=2.01
_build=
pkgrel=2
pkgdesc="A retro styled 2D platformer"
arch=('i686' 'x86_64')
url="http://thelettervsixtim.es/"
groups=('humblebundle3' 'humblebundle4' 'humblebundles')
license=('unknown')
depends=('sdl_image' 'sdl_mixer' 'gcc-libs')
source=('vvvvvv.desktop')
sha256sums=('a5eea031606f206b14f752eee7079fb18b6462fd751087d4641ca1831beb867f')

_archive="VVVVVV_${pkgver}_Linux${_build}.tar.gz"
_archive_md5="54d3679da69d92adb65fe9633f3c67d7"

build() {
  cd $srcdir
  
  if [ ! -f ${_vvvvvvarchivelocation}${_archive} ]; then
	  if [ ! -f ${_archive} ] && [ -n "${_humblebundle3key}" ]; then
		rm -f ${_archive}* index.html\?key\=${_humblebundle3key}*
		wget http://www.humblebundle.com/?key=${_humblebundle3key}
		wget $(cat index.html\?key\=${_humblebundle3key} | grep "${_archive}" | cut -d "'" -f 10)
		mv ${_archive}* ${_archive}
          elif [ ! -f ${_archive} ] && [ -n "${_humblebundle4key}" ]; then
                rm -f ${_archive}* index.html\?key\=${_humblebundle4key}*
                wget http://www.humblebundle.com/?key=${_humblebundle4key}
                wget $(cat index.html\?key\=${_humblebundle4key} | grep "${_archive}" | cut -d "'" -f 10)
                mv ${_archive}* ${_archive}
	  elif [ -z "${_humblebundle3key}" ] && [ -z "${_humblebundle4key}" ]; then
		echo You can now automate the download of the archive using the _humblebundle3key or _humblebundle4key bash variables.
		echo Just add \'export _humblebundle3key\=\<Your key here\>\' and/or
		echo \'export _humblebundle4key\=\<Your key here\>\' to \.bashrc
		echo
		echo Otherwise please just place ${_archive} into $(pwd)/
		echo Press Enter to continue
		read -a _unused
	  fi
  fi

  if [ ! -f ${_vvvvvvarchivelocation}${_archive} ]; then
    echo "${_vvvvvvarchivelocation}${_archive} not found!"
    return 1
  fi  

  if ! echo "${_archive_md5}  ${_vvvvvvarchivelocation}${_archive}" | md5sum -c --quiet; then
    echo "Invalid checksum for ${_vvvvvvarchivelocation}${_archive}"
    return 1
  fi

  install -d ${pkgdir}/opt/games/
  tar xzf ${_vvvvvvarchivelocation}${_archive} -C ${pkgdir}/opt/games/
  rm -fr ${pkgdir}/opt/games/VVVVVV/LIB{32,64}
  install -d ${pkgdir}/usr/bin
  ln -s /opt/games/VVVVVV/VVVVVV ${pkgdir}/usr/bin/vvvvvv
  
  # Install the icon file
  install -D -m 644 ${pkgdir}/opt/games/VVVVVV/data/icons/32_2.png \
      ${pkgdir}/usr/share/pixmaps/vvvvvv_icon.png

  # Install desktop file
  install -D -m 644 ${srcdir}/vvvvvv.desktop \
      ${pkgdir}/usr/share/applications/vvvvvv.desktop

  chown -Rh root:root ${pkgdir}/opt/games/VVVVVV
}