updated on Tue Jan 10 04:01:21 UTC 2012
[aur-mirror.git] / hammerfight / PKGBUILD
blob64b403b735d8189717637046ed5dd27e4cf1b148
1 # Maintainer: Gadget3000 <gadget3000 at msn dot com>
3 pkgname=hammerfight
4 pkgver=20110812
5 pkgrel=1
6 pkgdesc="A 2D physics-based video game in which you swing large melee weapons to destroy enemies"
7 arch=('i686' 'x86_64')
8 url="http://www.koshutin.com/"
9 license=('unknown')
10 groups=('humblebundle3' 'humblebundle4' 'humblebundles')
11 makedepends=('unzip' 'imagemagick')
12 source=(hammerfight.desktop)
13 md5sums=('e23ba95fa5623d37bdd0f3b520e36343')
14 install=('hammerfight.install')
15 depends=('openal' 'gcc-libs' 'sdl' 'hicolor-icon-theme')
17 _archive="hf-linux-08122011-bin"
18 _archive_md5="73b3824c3a199a646f19d5a952fc1c44"
20 build() {
21   install -Dd ${srcdir}/extractedInstaller
22   cd $srcdir
24   if [ ! -f ${_hammerfightarchivelocation}${_archive} ]; then
25           if [ -n "${_hammerfightarchivelocation}" ] && [ $(echo ${_hammerfightarchivelocation} | rev | cut -c 1) != "/" ]; then
26                 echo _hammerfightarchivelocation must end in /
27                 return 1
28           fi
29           if [ ! -f ${_archive} ] && [ -n "${_humblebundle3key}" ]; then
30                 rm -f ${_archive}* index.html\?key\=${_humblebundle3key}*
31                 wget http://www.humblebundle.com/?key=${_humblebundle3key}
32                 wget $(cat index.html\?key\=${_humblebundle3key} | grep "${_archive}" | cut -d "'" -f 10)
33                 mv ${_archive}* ${_archive}
34           elif [ ! -f ${_archive} ] && [ -n "${_humblebundle4key}" ]; then
35                 rm -f ${_archive}* index.html\?key\=${_humblebundle4key}*
36                 wget http://www.humblebundle.com/?key=${_humblebundle4key}
37                 wget $(cat index.html\?key\=${_humblebundle4key} | grep "${_archive}" | cut -d "'" -f 10)
38                 mv ${_archive}* ${_archive}
39           elif [ -z "${_humblebundle3key}" ] && [ -z "${_humblebundle4key}" ]; then
40                 echo You can now automate the download of the archive using the _humblebundle3key or _humblebundle4key bash variables.
41                 echo Just add \'export _humblebundle3key\=\<Your key here\>\' and/or
42                 echo \'export _humblebundle4key\=\<Your key here\>\' to \.bashrc
43                 echo
44                 echo Otherwise please just place ${_archive} into $(pwd)/
45                 echo Press Enter to continue
46                 read -a _unused
47           fi
48   fi
50   if [ ! -f ${_hammerfightarchivelocation}${_archive} ]; then
51     echo "${_hammerfightarchivelocation}${_archive} not found!"
52     return 1
53   fi
55   if ! echo "${_archive_md5}  ${_hammerfightarchivelocation}${_archive}" | md5sum -c --quiet; then
56     echo "Invalid checksum for ${_hammerfightarchivelocation}${_archive}"
57     return 1
58   fi
60   install -Dd ${pkgdir}/opt/
61   unzip -qqo ${_hammerfightarchivelocation}${_archive} -x guis/* meta/* scripts/* -d ${srcdir}/extractedInstaller/ && msg Finished Extracting
62   install -Dd ${pkgdir}/opt/hammerfight
63   mv ${srcdir}/extractedInstaller/data/* ${pkgdir}/opt/hammerfight/
65   rm -rf ${pkgdir}/opt/hammerfight/{amd64,x86}
67   install -Dd ${pkgdir}/usr/bin
68   echo \#\!/bin/bash > ${pkgdir}/usr/bin/hammerfight
69   echo /opt/hammerfight/Hammerfight >> ${pkgdir}/usr/bin/hammerfight
70   chmod +x ${pkgdir}/usr/bin/hammerfight
72   if [ "$CARCH" = "x86_64" ]; then
73         rm -rf ${pkgdir}/opt/hammerfight/Hammerfight-x86
74   else
75         rm -rf ${pkgdir}/opt/hammerfight/Hammerfight-amd64
76   fi
78   for i in 16x16 22x22 32x32 48x48 64x64 128x128; do
79     mkdir -p ${pkgdir}/usr/share/icons/hicolor/${i}/apps
80     convert -resize ${i} \
81         ${pkgdir}/opt/hammerfight/hammerfight.png \
82         ${pkgdir}/usr/share/icons/hicolor/${i}/apps/hammerfight.png
83   done
85   install -D ${srcdir}/hammerfight.desktop ${pkgdir}/usr/share/applications/hammerfight.desktop