Don't like ads? PRO users don't see any ads ;-)
Guest

SpaceChem PKGBUILD

By: a guest on Nov 2nd, 2011  |  syntax: Bash  |  size: 4.04 KB  |  hits: 163  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. # Maintainer: Wido <widowild at myopera dot com>
  2. # HIB environment variable contributor: TastyPi
  3.  
  4. # a PKGBUILD is now compatible with:
  5.  
  6. # Official Store http://store.zachtronicsindustries.com/product/spacechem
  7. # Store Gameolith http://www.gameolith.com/game/spacechem/
  8. # The Humble Idie Bundle http://www.humblebundle.com/
  9.  
  10. pkgname=spacechem
  11. _pkgname=SpaceChem
  12. pkgver=1011
  13. _pkgver=1012 # Just for HIB
  14. pkgrel=4
  15. pkgdesc="An obscenely addictive, design-based puzzle game about building machines and fighting monsters in the name of science!"
  16. url="http://spacechemthegame.com/"
  17. license=('custom: "commercial"')
  18. arch=('i686' 'x86_64')
  19. makedepends=()
  20. options=(!strip)
  21. source=("${pkgname}.sh" "${pkgname}.desktop")
  22. md5sums=('dff2d4a980e324c46198fb9193a23099'
  23.          'b458899c445a8baa8238b9594ebee6c1')
  24.  
  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"
  33. fi
  34.  
  35. depends=('mono' 'sdl' 'sdl_image' 'sdl_mixer' 'xclip')
  36.  
  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
  42.    if [[ ! -f "$startdir/${_gamepkg}" ]] && [[ ! -f "$startdir/${_gamepkg2}" ]] && [[ ! -f "$startdir/${_gamepkg3}" ]]; then
  43.        msg "Checking HIB_FROZENSYNAPSE environment variable"
  44.        if [ -n "$HIB_FROZENSYNAPSE" ]; then
  45.            msg "Environment variable found, checking key"
  46.            wget -O ${startdir}/${_gamepkg3} $(wget -O - http://www.humblebundle.com/?key=${HIB_FROZENSYNAPSE} | grep "${_gamepkg3}" | cut -d "'" -f 10)
  47.              else
  48.            error "Game package not found. Either set the HIB_FROZENSYNAPSE environment variable to your Humble Indie Bundle key, or give the absolute path to the directory containing the game archive:"
  49.            read pkgpath
  50.            if [[ ! -f "${pkgpath}/${_gamepkg}" ]] && [[ ! -f "${pkgpath}/${_gamepkg2}" ]] && [[ ! -f "${pkgpath}/${_gamepkg3}" ]] ; then
  51.                error "Unable to find game package." && return 1
  52.            fi
  53.        fi
  54.    fi
  55.     msg "Found game package, installing..."
  56.  
  57.     ## Store Gameolith
  58.  
  59.     if [[ -f ${pkgpath}/${_gamepkg} ]] ; then
  60.         ln -fs ${pkgpath}/${_gamepkg} . || return 1
  61.         tar xvf ${pkgpath}/${_gamepkg} || return 1
  62.         install -d ${pkgdir}/opt/${pkgname}
  63.         cp -R ${srcdir}/* ${pkgdir}/opt/${pkgname}/
  64.  
  65.         # Clean package
  66.         rm ${pkgdir}/opt/${pkgname}/${_gamepkg}
  67.         rm ${pkgdir}/opt/${pkgname}/${pkgname}.desktop
  68.         rm ${pkgdir}/opt/${pkgname}/${pkgname}.sh
  69.  
  70.     fi
  71.  
  72.     ## Official Store
  73.  
  74.     if [[ -f ${pkgpath}/${_gamepkg2} ]] ; then
  75.         ln -fs ${pkgpath}/${_gamepkg2} . || return 1
  76.         tar xvf ${pkgpath}/${_gamepkg2} || return 1
  77.         ar x ${srcdir}/${_pkgname}-i386.deb
  78.         tar -zxf ${srcdir}/data.tar.gz
  79.         rm -R ${srcdir}/usr
  80.         install -d ${pkgdir}/opt/${pkgname}
  81.         cp -R ${srcdir}/opt/zachtronicsindustries/${pkgname}/* ${pkgdir}/opt/${pkgname}/
  82.     fi
  83.  
  84.     ## Humble Indie Bundle
  85.  
  86.     if [[ -f ${pkgpath}/${_gamepkg3} ]] ; then
  87.         ln -fs ${pkgpath}/${_gamepkg3} . || return 1
  88.         tar xvf ${pkgpath}/${_gamepkg3} || 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
  95. }
  96.  
  97. package(){
  98.   cd ${srcdir}
  99.  
  100.   # Install Launcher
  101.   install -Dm 755 ${srcdir}/${pkgname}.sh ${pkgdir}/usr/bin/${pkgname}
  102.  
  103.   # Install Desktop
  104.   install -D -m644 ${srcdir}/${pkgname}.desktop \
  105.         ${pkgdir}/usr/share/applications/${pkgname}.desktop
  106.  
  107.   # Install license
  108.   install -Dm 644 ${pkgdir}/opt/${pkgname}/readme/LICENSE.txt ${pkgdir}/usr/share/licenses/${pkgname}/license
  109. }
  110.