#Maintainer: George Vlahavas (vlahavas~at~gmail~dot~com)

pkgname=ltris
pkgver=1.0.15
pkgrel=1gv
source=("http://prdownloads.sourceforge.net/lgames/ltris-$pkgver.tar.gz" "icons.tar.gz" "ltris.desktop")
docs=("readme" "install" "copying" "changelog" "authors" "news" "todo" "maintainers" "about-nls")
url=http://lgames.sourceforge.net/index.php?project=LTris

slackdesc=\
(
#|-----handy-ruler------------------------------------------------------|
"ltris (an open-source Tetris clone)"
"LTris as a tetris clone which means you have a bowl with blocks"
"falling down. By rotating and moving the blocks you try to"
"assemble whole lines which then disappear."
)


build() {
	cd $startdir/src/$pkgname-$pkgver
	# --localstatedir is just needed for the highscores file
	./configure --prefix=/usr --libdir=/usr/lib${LIBDIRSUFFIX} --localstatedir=/usr/share/ltris --sysconfdir=/etc --build=$arch-slackware-linux
	make || return 1
	make install DESTDIR=$startdir/pkg

	# Copy icons to the right place
	ICONSIZES="48 32 24 22 16"
	for i in $ICONSIZES; do
		mkdir -p $startdir/pkg/usr/share/icons/hicolor/$i\x$i/apps;
		mv $startdir/src/$pkgname-$i.png $startdir/pkg/usr/share/icons/hicolor/$i\x$i/apps/$pkgname.png;
	done;
	
	# What is this doing here?
	rm $startdir/pkg/usr/share/icons/ltris48.gif

	# Menu entry
	mkdir -p $startdir/pkg/usr/share/applications
	cp $startdir/src/ltris.desktop $startdir/pkg/usr/share/applications/

	# We need the highscores file writable by everyone
	chmod a+w $startdir/pkg/usr/share/ltris/ltris.hscr
}