# Maintainer: Gadget3000 <gadget3000 at msn dot com>
pkgname=hammerfight
pkgver=20111707
pkgrel=6
pkgdesc="A 2D physics-based video game in which you swing large melee weapons to destroy enemies"
arch=('i686' 'x86_64')
url="http://www.koshutin.com/"
license=('unknown')
groups=('humblebundle3' 'humblebundles')
makedepends=('unzip' 'imagemagick')
source=(hammerfight.desktop)
md5sums=('e23ba95fa5623d37bdd0f3b520e36343')
install=('hammerfight.install')
if [ "$CARCH" = "x86_64" ]; then
depends=('lib32-openal' 'lib32-gcc-libs' 'lib32-sdl' 'hicolor-icon-theme')
else
depends=('openal' 'gcc-libs' 'sdl' 'hicolor-icon-theme')
fi
_archive_file="hf-linux-07172011-bin"
if [ ! -d ${_humblebundle3dir} ] || [ ! -f ${_humblebundle3dir}/${_archive_file} ]; then
_humblebundle3dir=${srcdir}
fi
_archive=${_humblebundle3dir}/${_archive_file}
_archive_md5="4b979c6d0741aa0626018cf451309c25"
build() {
install -Dd ${srcdir}/extractedInstaller
cd $srcdir
if [ ! -f ${_archive} ]; then
if [ -n "${_humblebundle3key}" ]; then
rm -f ${_archive}* index.html\?key\=${_humblebundle3key}*
wget http://www.humblebundle.com/?key=${_humblebundle3key}
wget $(cat index.html\?key\=${_humblebundle3key} | grep "${_archive_file}" | cut -d "'" -f 10)
mv ${_archive}* ${_archive}
else
echo You can now automate the download of the archive using the _humblebundle3key bash variable.
echo Just add \'export _humblebundle3key\=\<Your key here\>\' to \.bashrc
echo
echo Otherwise please just place ${_archive_file} into ${srcdir}/ or
echo "export _humblebundledir3=<Your dir here> and place ${_archive_file} there"
echo Press Enter to continue
read -a _unused
fi
fi
if [ ! -f ${_archive} ]; then
echo "${_archive} not found!"
return 1
fi
if ! echo "${_archive_md5} ${_archive}" | md5sum -c --quiet; then
echo "Invalid checksum for ${_archive}"
return 1
fi
install -Dd ${pkgdir}/opt/
unzip -qqo ${_archive} -x guis/* meta/* scripts/* -d ${srcdir}/extractedInstaller/ && msg Finished Extracting
install -Dd ${pkgdir}/opt/hammerfight
mv ${srcdir}/extractedInstaller/data/* ${pkgdir}/opt/hammerfight/
rm -r ${pkgdir}/opt/hammerfight/lib*
install -Dd ${pkgdir}/usr/bin
echo \#\!/bin/bash > ${pkgdir}/usr/bin/hammerfight
echo /opt/hammerfight/Hammerfight >> ${pkgdir}/usr/bin/hammerfight
chmod +x ${pkgdir}/usr/bin/hammerfight
for i in 16x16 22x22 32x32 48x48 64x64 128x128; do
mkdir -p ${pkgdir}/usr/share/icons/hicolor/${i}/apps
convert -resize ${i} \
${pkgdir}/opt/hammerfight/hammerfight.png \
${pkgdir}/usr/share/icons/hicolor/${i}/apps/hammerfight.png
done
install -D ${srcdir}/hammerfight.desktop ${pkgdir}/usr/share/applications/hammerfight.desktop
}