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/
12 _pkgver=1012-1 # Just for HIB
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')
19 groups=('humblefsbundle' 'humblebundles')
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"
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')
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\""
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}
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):"
53 if [[ ! -f "${pkgpath}/${_gamepkg}" ]] && [[ ! -f "${pkgpath}/${_gamepkg2}" ]] && [[ ! -f "${pkgpath}/${_gamepkg3}" ]] ; then
54 error "Unable to find game package." && return 1
57 msg "Found game package, installing..."
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}/
68 rm ${pkgdir}/opt/${pkgname}/${_gamepkg}
69 rm ${pkgdir}/opt/${pkgname}/${pkgname}.desktop
70 rm ${pkgdir}/opt/${pkgname}/${pkgname}.sh
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
82 install -d ${pkgdir}/opt/${pkgname}
83 cp -R ${srcdir}/opt/zachtronicsindustries/${pkgname}/* ${pkgdir}/opt/${pkgname}/
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
94 install -d ${pkgdir}/opt/${pkgname}
95 cp -R ${srcdir}/opt/zachtronicsindustries/${pkgname}/* ${pkgdir}/opt/${pkgname}/
103 install -Dm 755 ${srcdir}/${pkgname}.sh ${pkgdir}/usr/bin/${pkgname}
106 install -D -m644 ${srcdir}/${pkgname}.desktop \
107 ${pkgdir}/usr/share/applications/${pkgname}.desktop
110 install -Dm 644 ${pkgdir}/opt/${pkgname}/readme/LICENSE.txt ${pkgdir}/usr/share/licenses/${pkgname}/license