updated on Thu Jan 12 20:00:29 UTC 2012
[aur-mirror.git] / spacechem / PKGBUILD
blobb7abd591760fae4b329b4c0b1aad7dc679b1d58a
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=("${pkgname}.sh" "${pkgname}.desktop")
22 md5sums=('dff2d4a980e324c46198fb9193a23099'
23 'b458899c445a8baa8238b9594ebee6c1')
25 if [[ $CARCH == x86_64 ]]; then
26     _gamepkg="${pkgname}_${pkgver}_amd64.tar.gz"
27     _gamepkg2="${_pkgname}-${pkgver}.tar.gz"
28     _gamepkg3="${_pkgname}-${_pkgver}-hib.tar.gz"
29 else
30     _gamepkg="${pkgname}_${pkgver}_i386.tar.gz"
31     _gamepkg2="${_pkgname}-${pkgver}.tar.gz"
32     _gamepkg3="${_pkgname}-${_pkgver}-hib.tar.gz"
35 depends=('mono' 'sdl' 'sdl_image' 'sdl_mixer' 'xclip')
37 build() {
38     cd ${srcdir}
39     msg "You need a full copy of this game in order to install it"
40     msg "Searching for ${_gamepkg} or ${_gamepkg2} or ${_gamepkg3} in dir: \"$startdir\""
41     pkgpath=$startdir
43     if [ ! -f ${_gamepkg3} ] && [ -n "${_humblefsbundlekey}" ]; then
44         rm -f ${_archive}* index.html\?key\=${_humblefsbundlekey}*
45         wget http://www.humblebundle.com/?key=${_humblefsbundlekey}
46         wget $(cat index.html\?key\=${_humblefsbundlekey} | grep "${_gamepkg3}" | cut -d "'" -f 10)
47         mv ${_gamepkg3}* $startdir/${_gamepkg3}
48     fi
50     if [[ ! -f "$startdir/${_gamepkg}" ]] && [[ ! -f "$startdir/${_gamepkg2}" ]] && [[ ! -f "$startdir/${_gamepkg3}" ]]; then
51         error "Game package not found, please type absolute path to ${_gamepkg} or ${_gamepkg2} or ${_gamepkg3} (/home/joe):"
52         read pkgpath
53         if [[ ! -f "${pkgpath}/${_gamepkg}" ]] && [[ ! -f "${pkgpath}/${_gamepkg2}" ]] && [[ ! -f "${pkgpath}/${_gamepkg3}" ]] ; then
54             error "Unable to find game package." && return 1
55         fi
56     fi
57     msg "Found game package, installing..."
59     ## Store Gameolith
61     if [[ -f ${pkgpath}/${_gamepkg} ]] ; then
62         ln -fs ${pkgpath}/${_gamepkg} . || return 1
63         tar xvf ${pkgpath}/${_gamepkg} || 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         ln -fs ${pkgpath}/${_gamepkg2} . || return 1
78         tar xvf ${pkgpath}/${_gamepkg2} || return 1
79         ar x ${srcdir}/${_pkgname}-i386.deb
80         tar -zxf ${srcdir}/data.tar.gz
81         rm -R ${srcdir}/usr
82         install -d ${pkgdir}/opt/${pkgname}
83         cp -R ${srcdir}/opt/zachtronicsindustries/${pkgname}/* ${pkgdir}/opt/${pkgname}/
84     fi
86     ## Humble Indie Bundle
88     if [[ -f ${pkgpath}/${_gamepkg3} ]] ; then
89         ln -fs ${pkgpath}/${_gamepkg3} . || return 1
90         tar xvf ${pkgpath}/${_gamepkg3} || return 1
91         ar x ${srcdir}/${_pkgname}-i386.deb
92         tar -zxf ${srcdir}/data.tar.gz
93         rm -R ${srcdir}/usr
94         install -d ${pkgdir}/opt/${pkgname}
95         cp -R ${srcdir}/opt/zachtronicsindustries/${pkgname}/* ${pkgdir}/opt/${pkgname}/
96     fi
99 package(){
100     cd ${srcdir}
102     # Install Launcher
103     install -Dm 755 ${srcdir}/${pkgname}.sh ${pkgdir}/usr/bin/${pkgname}
105     # Install Desktop
106     install -D -m644 ${srcdir}/${pkgname}.desktop \
107         ${pkgdir}/usr/share/applications/${pkgname}.desktop
109     # Install license
110     install -Dm 644 ${pkgdir}/opt/${pkgname}/readme/LICENSE.txt ${pkgdir}/usr/share/licenses/${pkgname}/license