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

pkgname=nitrogen
pkgver=1.4
pkgrel=1ab
arch=i486
source=("http://projects.l3ib.org/nitrogen/files/nitrogen-1.4.tar.gz"
        "thumbview-pngconf.patch" "nitrogen.desktop")
sourcetemplate="http://gaia.homelinux.org/salix/packages/$pkgname/$pkgver/"
docs=("readme" "copying" "changelog" "authors" "news")
url='http://projects.l3ib.org/nitrogen/'

slackdesc=\
(
#|-----handy-ruler------------------------------------------------------|
"$pkgname (a background browser and setter)"
"Nitrogen is a background browser and setter for X windows. It is"
"written in C++ using the gtkmm toolkit. It can be used in two modes:"
"browser and recall. Nitrogen has been in development for over 2 years,"
"due to real life and laziness."
)


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
	
  patch -p1 -i $startdir/src/thumbview-pngconf.patch
	./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/src/nitrogen.desktop $startdir/pkg/usr/share/applications/nitrogen.desktop
}