This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

modified PKGBUILD for wakingmars #2

By: a guest on Nov 22nd, 2012  |  syntax: Bash  |  size: 3.41 KB  |  views: 6  |  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. # Contributor: Ben R. <thebenj88 *AT* gmail *DOT* com>
  2.  
  3. pkgname=wakingmars-hib
  4. pkgver=1.0.4
  5. pkgrel=3
  6. pkgdesc='Explore Mars in this 2D sidescrolling adventure game (Humble Bundle version)'
  7. url='http://www.tigerstylegames.com/wakingmars/'
  8. arch=('i686' 'x86_64')
  9. license=('custom:commercial')
  10. depends=('libgl' 'mesa')
  11. optdepends=('catalyst: AMD Proprietary 3D driver'
  12.                         'nvidia: NVIDIA Proprietary 3D driver')
  13. PKGEXT='.pkg.tar'
  14. source=('https://dl.dropbox.com/s/6p1dvlpqiyccenf/oal14.tar.gz?dl=1')
  15. md5sums=('a684078b08bac6578e915fd1c812bfdc')
  16.  
  17. _gamepkg="WakingMars-${pkgver}-Linux.tar.gz"
  18.  
  19. package() {
  20.         # Get installer
  21.                 _get_humblebundle_source "${_gamepkg}" || {
  22.                         error "Unable to find the game archive. Please download it from your Humble
  23.                         Bundle page, and place it into one of the above locations."
  24.                 exit 1;
  25. }
  26.     msg "Extract files"
  27.     bsdtar -xf ${srcdir}/${_gamepkg}
  28.    
  29.     msg "Create directories"
  30.     mkdir -p ${pkgdir}/usr/bin
  31.     mkdir -p ${pkgdir}/opt/${pkgname}/
  32.     mkdir -p ${pkgdir}/usr/share/{licenses,doc}/${pkgname}
  33.     mkdir ${pkgdir}/usr/share/applications
  34.  
  35.     msg "Install license, documentation and desktop file"
  36.     install -Dm644 ${srcdir}/WakingMars-${pkgver}-Linux/Licenses/EULA.txt ${pkgdir}/usr/share/licenses/${pkgname}/LICENSE
  37.     install -Dm644 ${srcdir}/WakingMars-${pkgver}-Linux/README.txt ${pkgdir}/usr/share/doc/${pkgname}/README.html
  38.  
  39.     sed -i 's|Path=/usr/local/games/wakingmars|Path=/usr/bin/wakingmars|g' ${srcdir}/WakingMars-${pkgver}-Linux/wakingmars.desktop
  40.     sed -i 's|Icon=/usr/local/games/wakingmars/wakingmars.png|Path=/opt/wakingmars-hib/wakingmars.png|g' ${srcdir}/WakingMars-${pkgver}-Linux/wakingmars.desktop
  41.     install -Dm644 ${srcdir}/WakingMars-${pkgver}-Linux/wakingmars.desktop ${pkgdir}/usr/share/applications/wakingmars.desktop
  42.     rm -r ${srcdir}/WakingMars-${pkgver}-Linux/{Licenses,install,README.txt,wakingmars.desktop}
  43.  
  44.     msg "Install game contents"
  45.     mv -v ${srcdir}/WakingMars-${pkgver}-Linux/wakingmars/* ${pkgdir}/opt/${pkgname}/
  46.  
  47.     msg "Add patch for preventing lock ups."
  48.     rm -f ${pkgdir}/opt/${pkgname}/lib/libopenal.so*
  49.     cp ${srcdir}/libopenal.so* ${pkgdir}/opt/${pkgname}/lib/
  50.  
  51.     msg "Set owner and permissions"
  52.     chown root:games ${pkgdir}/opt/${pkgname} -R
  53.     find ${pkgdir}/opt/${pkgname} -type f -print0 | xargs -0 chmod 644
  54.     find ${pkgdir}/opt/${pkgname} -type d -print0 | xargs -0 chmod 755
  55.     chmod 755 ${pkgdir}/opt/${pkgname}/wakingmars
  56.  
  57.     msg "Link binary to /usr/bin"
  58.     ln -s /opt/${pkgname}/wakingmars ${pkgdir}/usr/bin/wakingmars
  59. }
  60.        
  61.        
  62. # Thanks again to smls for the following two functions, these saved me
  63. # a lot of time.
  64.  
  65. # Locate a game archive from one of the Humble Bundles, and symlink it into $srcdir
  66. _get_humblebundle_source() {
  67.   _get_local_source "$1" || return 1;
  68. }
  69.  
  70. # Locate a file or folder provided by the user, and symlink it into $srcdir
  71. _get_local_source() {
  72.   msg "Looking for '$1'..."
  73.   declare -A _search=(['build dir']="$startdir"
  74.                       ['$LOCAL_PACKAGE_SOURCES']="$LOCAL_PACKAGE_SOURCES")
  75.   for _key in "${!_search[@]}"; do local _dir="${_search["$_key"]}"
  76.     if [ -z "$_dir" ]; then _dir="<undefined>"; fi
  77.     echo -n "    - in $_key ['$_dir'] ... ";
  78.     if [ -e "$_dir/$1" ]; then
  79.       echo "FOUND"; ln -sfT "$(readlink -f "$_dir/$1")" "$srcdir/$1"; break; fi
  80.     echo "NOT FOUND"
  81.   done
  82.   if [ ! -e "$srcdir/$1" ]; then return 1; fi
  83. }
clone this paste RAW Paste Data