#Packager: George Vlahavas <vlahavas~at~gmail~dot~com>
#Previous packager: Andreas Born <futur(dot)andy(at)web(dot)de>

pkgname=audacity
pkgver=2.0.2
pkgrel=1rl
source=("http://audacity.googlecode.com/files/audacity-minsrc-$pkgver.tar.bz2"
		"http://audacity.googlecode.com/files/audacity-manual-$pkgver.zip")
docs=("readme.txt" "license.txt")
url='http://www.audacity.de'

doinst() {
	# update the mime desktop database
	if [ -x usr/bin/update-desktop-database ]; then
		usr/bin/update-desktop-database -q
	fi
	# update the mime database
	if [ -x usr/bin/update-mime-database ]; then
		usr/bin/update-mime-database usr/share/mime > /dev/null 2>&1
	fi
}


slackdesc=\
(
#|-----handy-ruler------------------------------------------------------|
"$pkgname (cross-platform sound editor)"
"Audacity is a free, easy-to-use audio editor and recorder, which can"
"be used to:"
" * Record live audio."
" * Convert tapes and records into digital recordings or CDs."
" * Edit Ogg Vorbis, MP3, WAV or AIFF sound files."
" * Cut, copy, splice or mix sounds together."
" * Change the speed or pitch of a recording."
" * And more! See the complete list of features"
"   (http://audacity.sourceforge.net/about/features)"
)


build() {
	set -e

	cd $startdir/src/audacity-src-$pkgver

  	WX_CONFIG=/usr/bin/wx-config PKG_CONFIG_PATH+="/usr/lib/ffmpeg-compat/pkgconfig" \
    	./configure --prefix=/usr \
    		--with-portaudio --with-libsamplerate \
    		--without-libresample --with-libmad \
    		--with-ffmpeg --with-id3tag --with-libflac \
			--with-vorbis --with-libexpat \
    		--with-libsndfile --with-soundtouch \
			--enable-unicode --without-taglib	\
			--disable-sse 
	make -j $numjobs || return 1
	make install DESTDIR=$startdir/pkg || return 1

	rm -r $startdir/pkg/usr/share/doc

	install -vd $startdir/pkg/usr/share/icons/hicolor/48x48/apps
	convert $startdir/pkg/usr/share/pixmaps/audacity.xpm -transparent white $startdir/pkg/usr/share/icons/hicolor/48x48/apps/audacity.png

	sed -i "s/Icon=\/usr\/share\/audacity\/audacity.xpm/Icon=audacity/" $startdir/pkg/usr/share/applications/audacity.desktop

	install -vd $startdir/pkg/usr/share/audacity
	cp -r $startdir/src/help $startdir/pkg/usr/share/audacity/

	set +e
}
