#Maintainer: Shador <futur~DOT~andy~AT~googlemail.com>

pkgname=scrobby
pkgver=0.1
pkgrel=1ab
arch=i486
source=("http://unkart.ovh.org/scrobby/scrobby-${pkgver}.tar.bz2")
sourcetemplate="http://gaia.homelinux.org/salix/packages/$pkgname/$pkgver/"
docs=("copying" "authors")
url='http://unkart.ovh.org/scrobby/'

slackdesc=\
(
#|-----handy-ruler------------------------------------------------------|
"$pkgname (an audioscrobbler mpd client)"
"Features:"
" * 'now playing' notifications"
" * recognizing when one track is being played multiple times"
" * working in background"
" * caching not submitted songs"
" * unix sockets support"

)


build() {
	threadcount=$(($(sed -ne '/cpu cores/h;${g;s/[^0-9]*//p}' \
						< /proc/cpuinfo)*2))
	if [ $threadcount -lt 2 ]; then
		threadcount=2
	elif [ $threadcount -gt 8 ]; then
		threadcount=8
	fi
	threads="-j${threadcount}"

	cd $startdir/src/$pkgname-$pkgver
	
	./configure \
		--prefix=/usr \
		--libdir=/usr/lib${LIBDIRSUFFIX} \
		--localstatedir=/var \
		--sysconfdir=/etc \
		--mandir=/usr/man || return 1
	make $threads || return 1
	make install DESTDIR=$startdir/pkg || return 1
	
	install -vd $startdir/pkg/usr/doc/scrobby-$pkgver/
	mv $startdir/pkg/usr/share/doc/scrobby/* $startdir/pkg/usr/doc/scrobby-$pkgver/
	rmdir -v $startdir/pkg/usr/share/doc/scrobby/ $startdir/pkg/usr/share/doc/ $startdir/pkg/usr/share/
}