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

pkgname=libmpdclient
pkgver=2.1
pkgrel=1ab
arch=i486
source=("http://downloads.sourceforge.net/project/musicpd/libmpdclient/2.1/libmpdclient-2.1.tar.bz2")
sourcetemplate="http://gaia.homelinux.org/salix/packages/$pkgname/$pkgver/"
docs=("readme" "install" "copying" "changelog" "authors" "news" "todo")
url='http://mpd.wikia.com/wiki/ClientLib:libmpdclient'

slackdesc=\
(
#|-----handy-ruler------------------------------------------------------|
"$pkgname (an API library for MPD)"
"A stable, documented, asynchronous API library for interfacing MPD in"
"the C, C++ & Objective C languages."
)


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/libmpdclient-$pkgver/
  mv -v $startdir/pkg/usr/share/doc/libmpdclient/* $startdir/pkg/usr/doc/libmpdclient-$pkgver/
  rmdir -v $startdir/pkg/usr/share/doc/libmpdclient/ $startdir/pkg/usr/share/doc/ $startdir/pkg/usr/share/
} 
