#Packager: George Vlahavas <vlahavas~at~gmail~dot~com>
#
# Needs ode to build

pkgname=xmoto
pkgver=0.5.5
pkgrel=1gv
source=("http://download.tuxfamily.org/xmoto/xmoto/$pkgver/xmoto-$pkgver-src.tar.gz" "xmoto.desktop" "xmoto.png" "xmoto-0.5.5-sqlite3.patch" "localedir.diff" "libpng-1.4.patch")
docs=("readme" "install" "copying" "changelog" "authors" "news" "todo" "about-nls")
url=http://xmoto.tuxfamily.org/

slackdesc=\
(
#|-----handy-ruler------------------------------------------------------|
"xmoto (a 2D motocross game)"
"X-Moto is a challenging 2D motocross platform game, where physics"
"plays an all important role in the gameplay. You need to control your"
"bike to its limits, if you want to have a chance to finish the most"
"difficult challenges."
)


build() {
	cd $startdir/src/$pkgname-$pkgver

	patch -p1 < $startdir/src/xmoto-0.5.5-sqlite3.patch || exit 1
	patch -p1 < $startdir/src/localedir.diff || exit 1
	patch -p1 < $startdir/src/libpng-1.4.patch || exit

	./configure \
		--prefix=/usr \
		--libdir=/usr/lib${LIBDIRSUFFIX} \
		--localstatedir=/var \
		--sysconfdir=/etc \
		--localedir=/usr/share/locale \
		--with-localesdir=/usr/share/locale \
		--with-internal-xdg=1 \
		--build=$arch-slackware-linux
	make || return 1
	make install DESTDIR=$startdir/pkg

	mkdir -p $startdir/pkg/usr/share/applications
	cp $startdir/src/xmoto.desktop $startdir/pkg/usr/share/applications/
	mkdir -p $startdir/pkg/usr/share/icons/hicolor/48x48/apps
	cp -a $startdir/src/xmoto.png $startdir/pkg/usr/share/icons/hicolor/48x48/apps/
}