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

pkgname=prboom
pkgver=2.5.0
pkgrel=1gv
arch=i486
source=("http://downloads.sourceforge.net/prboom/prboom-$pkgver.tar.gz" "http://ftp.cc.uoc.gr/mirrors/nongnu.org/freedoom/freedoom-iwad/freedoom-iwad-0.6.4.zip" "icons.tar.gz" "prboom.desktop")
docs=("readme*" "install" "copying" "changelog" "authors" "news" "todo" "maintainers" "*.txt")
url=http://prboom.sourceforge.net/index.html

slackdesc=\
(
#|-----handy-ruler------------------------------------------------------|
"prboom - a much enhanced port of Doom"
"PrBoom is made up of the combined projects DosDoom, Boom, MBF, LxDoom"
"and lSDLDoom. Free maps from the freedoom project are included in the"
"package."
)


build() {
	cd $startdir/src/$pkgname-$pkgver
	./configure --prefix=/usr --libdir=/usr/lib${LIBDIRSUFFIX} --localstatedir=/var --sysconfdir=/etc --with-waddir=/usr/share/prboom
	make || return 1
	make install DESTDIR=$startdir/pkg
	mkdir -p $startdir/pkg/usr/bin
	mv $startdir/pkg/usr/games/* $startdir/pkg/usr/bin
	rmdir $startdir/pkg/usr/games

	mv $startdir/src/freedoom-iwad-0.6.4/*.wad $startdir/pkg/usr/share/prboom
	mkdir -p $startdir/pkg/usr/doc/$pkgname-$pkgver/freedoom-iwad-0.6.4
	mv $startdir/src/freedoom-iwad-0.6.4/* $startdir/pkg/usr/doc/$pkgname-$pkgver/freedoom-iwad-0.6.4

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

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

	# Remove not needed doc dir
	rm -rf $startdir/pkg/usr/share/doc
}