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

pkgname=scummvm
pkgver=1.2.1
pkgrel=1gv
source=("http://prdownloads.sourceforge.net/scummvm/scummvm-$pkgver.tar.bz2" "icons.tar.gz")
docs=("readme" "install" "copying" "changelog" "authors" "news" "todo" "maintainers")
url=http://www.scummvm.org/

slackdesc=\
(
#|-----handy-ruler------------------------------------------------------|
"ScummVM (an emulator for LucasArts adventures and other games)"
"ScummVM is a collection of interpreters, capable of emulating several"
"adventure game engines. ScummVM mainly supports engines created using"
"SCUMM (Script Creation Utility for Maniac Mansion), used in various"
"LucasArts games such as Monkey Island, Day of the Tentacle, and"
"others. ScummVM also contains interpreters for several non-SCUMM"
"games. This package is built with fluidsynth support for better midi"
"sounds with the use of soundfonts."
)


build() {
	cd $startdir/src/$pkgname-$pkgver
	./configure --prefix=/usr --libdir=/usr/lib${LIBDIRSUFFIX} --enable-all-engines
	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;
	mkdir -p $startdir/pkg/usr/share/icons/hicolor/scalable/apps
	cp -a $startdir/src/$pkgname-$pkgver/icons/scummvm.svg $startdir/pkg/usr/share/icons/hicolor/scalable/apps
	rm -rf $startdir/pkg/usr/share/pixmaps

	mkdir -p $startdir/pkg/usr/share/applications
	cp -a $startdir/src/$pkgname-$pkgver/dists/scummvm.desktop $startdir/pkg/usr/share/applications
	sed -i -e "s/.xpm//" $startdir/pkg/usr/share/applications/scummvm.desktop
	chown -R root:root $startdir/pkg/usr/share/
}