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

pkgname=stressapptest
pkgver=1.0.1
pkgrel=1ab
arch=i486
source=("http://stressapptest.googlecode.com/files/stressapptest-${pkgver}_autoconf.tar.gz")
sourcetemplate="http://gaia.homelinux.org/salix/packages/$pkgname/$pkgver/"
docs=("copying")
url='http://code.google.com/p/stressapptest/'

slackdesc=\
(
#|-----handy-ruler------------------------------------------------------|
"$pkgname (Stressful Application Test)"
"Stressful Application Test (or stressapptest, its unix name) tries to"
"maximize randomized traffic to memory from processor and I/O, with the"
"intent of creating a realistic high load situation in order to test"
"the existing hardware devices in a computer."
)


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/stressapptest-${pkgver}_autoconf
	
	./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 -m644 $startdir/pkg/usr/share/doc/stressapptest/stressapptest.1 $startdir/pkg/usr/man/man1/stressapptest.1
  rm -r $startdir/pkg/usr/share/
}