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

pkgname=hatari
pkgver=1.7.0
pkgrel=1gv
source=("http://download.tuxfamily.org/hatari/1.7.0/hatari-1.7.0.tar.bz2" "hatari.desktop" "icons.tar.gz")
docs=("readme" "install" "copying" "changelog" "authors" "news" "todo" "maintainers" "gpl.txt")
url=http://hatari.sourceforge.net/

slackdesc=\
(
#|-----handy-ruler------------------------------------------------------|
"hatari (an Atari ST and STE emulator)"
"Hatari is an Atari ST and STE emulator. The Atari ST was a 16/32 bit"
"computer system which was first released by Atari in 1985. Using the"
"Motorola 68000 CPU, it was a very popular computer having quite a lot"
"of CPU power at that time. Unlike many other Atari ST emulators which"
"try to give you a good environment for running GEM applications,"
"Hatari tries to emulate the hardware of a ST as close as possible so"
"that it is able to run most of the old ST games and demos."
"The hatari package includes also a copy of emutos, an open-source"
"replacement for TOS, the operating system used by Atari computers."
)


build() {
	cd $startdir/src/$pkgname-$pkgver
	./configure --prefix=/usr
	make || return 1
	make install DESTDIR=$startdir/pkg

	mkdir -p $startdir/pkg/usr/share/applications
	cp $startdir/src/hatari.desktop $startdir/pkg/usr/share/applications/

	# These don't function properly
	rm $startdir/pkg/usr/bin/hatariui
	rm $startdir/pkg/usr/share/applications/hatariui.desktop
	find $startdir/pkg/usr/share/icons -name hatari-icon.png -exec rm {} \;

	# Copy icons to the right place
	ICONSIZES="128 72 64 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;

	# Move docs to a better place
	mkdir -p $startdir/pkg/usr/doc/$pkgname-$pkgver
	mv $startdir/pkg/usr/share/doc/hatari/* $startdir/pkg/usr/doc/$pkgname-$pkgver
	rm -rf $startdir/pkg/usr/share/doc
}