updated on Fri Jan 20 00:01:56 UTC 2012
[aur-mirror.git] / spacechem / PKGBUILD
blob7def5063f74afd9a1f970177a685e1f9d6a2f6ca
1 # Maintainer: Wido <widowild at myopera dot com>
3 # a PKGBUILD is now compatible with:
5 # Official Store http://store.zachtronicsindustries.com/product/spacechem
6 # Store Gameolith http://www.gameolith.com/game/spacechem/
7 # The Humble Idie Bundle http://www.humblebundle.com/
9 pkgname=spacechem
10 _pkgname=SpaceChem
11 pkgver=1012
12 _pkgver=1012-1 # Just for HIB
13 pkgrel=1
14 pkgdesc="an obscenely addictive, design-based puzzle game about building machines and fighting monsters in the name of science!"
15 url="http://www.gameolith.com/game/spacechem/"
16 license=('custom: "commercial"')
17 arch=('i686' 'x86_64')
18 makedepends=()
19 groups=('humblefsbundle' 'humblebundles')
20 options=(!strip)
21 source=('spacechem.sh'
22         'spacechem.desktop')
23 md5sums=('dff2d4a980e324c46198fb9193a23099'
24          'b458899c445a8baa8238b9594ebee6c1')
26 if [[ $CARCH == x86_64 ]]; then
27     _gamepkg="${pkgname}_${pkgver}_amd64.tar.gz"
28     _gamepkg2="${_pkgname}-${pkgver}.tar.gz"
29     _gamepkg3="${_pkgname}-${_pkgver}-hib.tar.gz"
30 else
31     _gamepkg="${pkgname}_${pkgver}_i386.tar.gz"
32     _gamepkg2="${_pkgname}-${pkgver}.tar.gz"
33     _gamepkg3="${_pkgname}-${_pkgver}-hib.tar.gz"
36 depends=('mono' 'sdl' 'sdl_image' 'sdl_mixer' 'xclip')
38 build() {
39     cd ${srcdir}
40     msg "You need a full copy of this game in order to install it"
41     msg "Searching for ${_gamepkg} or ${_gamepkg2} or ${_gamepkg3} in dir: \"$srcdir\""
42     pkgpath=$srcdir
44     if [ ! -f ${_gamepkg3} ] && [ -n "${_humblefsbundlekey}" ]; then
45         rm -f ${_archive}* index.html\?key\=${_humblefsbundlekey}*
46         wget http://www.humblebundle.com/?key=${_humblefsbundlekey}
47         wget $(cat index.html\?key\=${_humblefsbundlekey} | grep "${_gamepkg3}" | cut -d "'" -f 10)
48         mv ${_gamepkg3}* ${_gamepkg3}
49     fi
51     if [[ ! -f "$srcdir/${_gamepkg}" ]] && [[ ! -f "$srcdir/${_gamepkg2}" ]] && [[ ! -f "$srcdir/${_gamepkg3}" ]]; then
52         error "Game package not found, please type absolute path to ${_gamepkg} or ${_gamepkg2} or ${_gamepkg3} (/home/joe):"
53         read pkgpath
54         if [[ ! -f "${pkgpath}/${_gamepkg}" ]] && [[ ! -f "${pkgpath}/${_gamepkg2}" ]] && [[ ! -f "${pkgpath}/${_gamepkg3}" ]] ; then
55             error "Unable to find game package." && return 1
56         fi
57     fi
58     msg "Found game package, installing..."
60     ## Store Gameolith
62     if [[ -f ${pkgpath}/${_gamepkg} ]] ; then
63         tar xvf ${pkgpath}/${_gamepkg} -C ${srcdir} || return 1
64         install -d ${pkgdir}/opt/${pkgname}
65         cp -R ${srcdir}/* ${pkgdir}/opt/${pkgname}/
67         # Clean package
68         rm ${pkgdir}/opt/${pkgname}/${_gamepkg}
69         rm ${pkgdir}/opt/${pkgname}/${pkgname}.desktop
70         rm ${pkgdir}/opt/${pkgname}/${pkgname}.sh
72     fi
74     ## Official Store
76     if [[ -f ${pkgpath}/${_gamepkg2} ]] ; then
77         tar xvf ${pkgpath}/${_gamepkg2} -C ${srcdir} || return 1
78         ar x ${srcdir}/${_pkgname}-i386.deb
79         tar -zxf ${srcdir}/data.tar.gz
80         rm -R ${srcdir}/usr
81         install -d ${pkgdir}/opt/${pkgname}
82         cp -R ${srcdir}/opt/zachtronicsindustries/${pkgname}/* ${pkgdir}/opt/${pkgname}/
83     fi
85     ## Humble Indie Bundle
87     if [[ -f ${pkgpath}/${_gamepkg3} ]] ; then
88         tar xvf ${pkgpath}/${_gamepkg3} -C $srcdir|| return 1
89         ar x ${srcdir}/${_pkgname}-i386.deb
90         tar -zxf ${srcdir}/data.tar.gz
91         rm -R ${srcdir}/usr
92         install -d ${pkgdir}/opt/${pkgname}
93         cp -R ${srcdir}/opt/zachtronicsindustries/${pkgname}/* ${pkgdir}/opt/${pkgname}/
94     fi
97 package(){
98     cd ${srcdir}
100     # Install Launcher
101     install -Dm 755 ${srcdir}/${pkgname}.sh ${pkgdir}/usr/bin/${pkgname}
103     # Install Desktop
104     install -D -m644 ${srcdir}/${pkgname}.desktop \
105         ${pkgdir}/usr/share/applications/${pkgname}.desktop
107     # Install license
108     install -Dm 644 ${pkgdir}/opt/${pkgname}/readme/LICENSE.txt ${pkgdir}/usr/share/licenses/${pkgname}/license