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

pkgname=audacity
pkgver=2.1.2
pkgrel=1rl
source=("https://github.com/audacity/audacity/archive/Audacity-2.1.2.tar.gz" \
	"audacity-ffmpeg.patch")
sourcetemplate=http://people.salixos.org/laprjns/$pkgname/$pkgver/
docs=("readme.txt" "license.txt")
url='http://www.audacity.de'

#doinst() {
	
#}


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-Audacity-$pkgver
	#cd audacity-Audacity-${pkgver}
 	patch -p1 -i "${startdir}/audacity-ffmpeg.patch"


	./configure \
		--prefix=/usr \
		--libdir=/usr/lib${LIBDIRSUFFIX} \
		--localstatedir=/var \
		--sysconfdir=/etc \
		--mandir=/usr/man \
		--docdir=/usr/doc/$pkgname-$pkgver/ \
		--enable-unicode \
		--enable-nyquist \
		--with-expat=system \
		--with-libvorbis=system \
		--with-libmad=system \
		--with-libflac=system \
		--with-libsndfile=system \
		--with-libid3tag=system \
		--with-libsoxr \
		--with-portaudio \
		--with-ladspa \
		--with-ffmpeg=system \
		--without-lv2 \
		--with-soundtouch \
		--with-libtwolame=system \
		--with-sbsms \
		--with-midi \
		--with-portmixer \
		--without-libvamp \
		--without-libresample \
		--without-libsamplerate \
		--build=$arch-slackware-linux || return 1

		
# ensure we use the system headers for these, note we do this after
# configure as it wants to run sub-configures in these dirs
	for i in ffmpeg expat libid3tag libflac libmad libresample libsndfile libvamp lv2 soundtouch twolame; do
		rm -rf lib-src/$i
	done		
		
		
	make -j $numjobs || return 1
	make install DESTDIR=$startdir/pkg || return 1

	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
	
	set +e
}