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

pkgname=rubyripper
pkgver=0.5.7
pkgrel=2ab
arch=i486
source=("http://rubyripper.googlecode.com/files/rubyripper-$pkgver.tar.bz2")
sourcetemplate="http://gaia.homelinux.org/salix/packages/$pkgname/$pkgver/"
docs=("readme")
url='http://code.google.com/p/rubyripper/'

slackdesc=\
(
#|-----handy-ruler------------------------------------------------------|
"$pkgname - audio ripper like EAC"
"Rubyripper is a digital audio extraction algorithm that uses"
"cdparanoia error correcting power and it's own secure ripping"
"algorithm to make sure that a CD rip is done successfully and"
"accurately. It is very similar to and inspired by EAC. Rubyripper is"
"written in the ruby programming language."
)


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
	
	export PATH="$(echo "$PATH" | sed -e 's,:\.,,')"
	
	./configure \
		--prefix=/usr \
		--libdir=/usr/lib${LIBDIRSUFFIX} \
		--localstatedir=/var \
		--sysconfdir=/etc \
		--mandir=/usr/man \
		--enable-lang-all \
		--enable-gtk2 \
		--enable-cli || return 1
	make $threads || return 1
	make install DESTDIR=$startdir/pkg || return 1
	
	# this shouldn't be needed anymore
	(	cd $startdir/pkg
		find . -perm 664 -exec chmod 644 {} \;
		find . -perm 600 -exec chmod 644 {} \;
		find . -perm 444 -exec chmod 644 {} \;
		find . -perm 400 -exec chmod 644 {} \;
		find . -perm 440 -exec chmod 644 {} \;
		find . -perm 777 -exec chmod 755 {} \;
		find . -perm 775 -exec chmod 755 {} \;
		find . -perm 511 -exec chmod 755 {} \;
		find . -perm 711 -exec chmod 755 {} \;
		find . -perm 555 -exec chmod 755 {} \;
	)
}