#Packager: Shador <futur~DOT~andy~AT~googlemail.com>

pkgname=hedgewars
pkgver=0.9.17
pkgrel=1ab
source=("http://download.gna.org/hedgewars/hedgewars-src-$pkgver.tar.bz2")
sourcetemplate="http://gaia.homelinux.org/salix/slkbuilds/$pkgname/"
docs=("install" "copying" "changelog.txt" "fonts_license.txt" "readme")
url='http://www.hedgewars.org/'

slackdesc=\
(
#|-----handy-ruler------------------------------------------------------|
"$pkgname (a Worms-like turn based strategy game)"
"Hedgewars, it's a Blast! This is the funniest and most addictive game"
"you'll ever play - hilarious fun that you can enjoy anywhere, anytime."
"Hedgewars is a turn based strategy game but the real buzz is from"
"watching the devastation caused by those pesky hedgehogs with those"
"fantastic weapons - sneaky little blighters with a bad attitude!"
)


build() {
	set -e

	cd $startdir/src/hedgewars-src-$pkgver

	cmake \
		-DCMAKE_CXX_FLAGS="$CXXFLAGS" \
		-DCMAKE_BUILD_TYPE="Release" \
		-DWITH_SERVER=0 \
		-DCMAKE_INSTALL_PREFIX="/usr" || return 1
	sed -e "s/cLuaLibrary = 'liblua.a';/cLuaLibrary = 'lua';/" -i hedgewars/config.inc
	make -j $numjobs || return 1
	make install DESTDIR=$startdir/pkg || return 1

	install -m644 -vD man/hedgewars.6 $startdir/pkg/usr/man/man6/hedgewars.6
	cd misc
	for size in 16x16 24x24 32x32 48x48 64x64 128x128 512x512; do
		mkdir -p $startdir/pkg/usr/share/icons/hicolor/$size/apps
		convert hedgewars.png -scale $size $startdir/pkg/usr/share/icons/hicolor/$size/apps/hedgewars.png
	done
	install -m644 -vD hedgewars.desktop $startdir/pkg/usr/share/applications/hedgewars.desktop

	set +e
}