SUMMARY="Audio software for multi-track recording and editing"
DESCRIPTION="Audacity can be used to perform a number of audio editing and \
recording tasks such as making ringtones, mixing stero tracks, transferring \
tapes and records to computer or CD, splitting recordings into separate \
tracks and more."
HOMEPAGE="https://www.audacityteam.org"
COPYRIGHT="1999-2017 by Audacity Team"
LICENSE="GNU GPL v2"
REVISION="3"
# The official site (FossHub) doesn't allow direct downloads, and has been
# hit with really bad malware injections in the past. So use Fedora's mirror.
SOURCE_URI="http://pkgs.fedoraproject.org/lookaside/extras/audacity/audacity-minsrc-2.1.2.tar.xz/2336353377132971fd8e22fc95fd6b83/audacity-minsrc-2.1.2.tar.xz"
CHECKSUM_SHA256="0df79fe0647a4cd68e46ad40d6e73d2f8eaae413b6d8b186ac036be3554d7e44"
SOURCE_DIR="audacity-minsrc-$portVersion"

ARCHITECTURES="?all !x86_gcc2"
SECONDARY_ARCHITECTURES="?x86"

PROVIDES="
	audacity$secondaryArchSuffix = $portVersion
	app:Audacity$secondaryArchSuffix = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	wxqt$secondaryArchSuffix
	lib:libavcodec$secondaryArchSuffix
	lib:libavformat$secondaryArchSuffix
	lib:libavutil$secondaryArchSuffix
	lib:libexpat$secondaryArchSuffix
	lib:libflac$secondaryArchSuffix
	lib:libiconv$secondaryArchSuffix
#	lib:libid3tag$secondaryArchSuffix		-- missing pkgconfig
	lib:libintl$secondaryArchSuffix
#	lib:libmad$secondaryArchSuffix			-- missing pkgconfig
	lib:libsndfile$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	wxqt${secondaryArchSuffix}_devel
	devel:libavcodec$secondaryArchSuffix
	devel:libavformat$secondaryArchSuffix
	devel:libavutil$secondaryArchSuffix
	devel:libexpat$secondaryArchSuffix
	devel:libflac$secondaryArchSuffix
	devel:libiconv$secondaryArchSuffix
#	devel:libid3tag$secondaryArchSuffix
	devel:libintl$secondaryArchSuffix
#	devel:libmad$secondaryArchSuffix
	devel:libQt5Widgets$secondaryArchSuffix
	devel:libsndfile$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:awk
	cmd:cmake
	cmd:diff
	cmd:gcc$secondaryArchSuffix
	cmd:gettext$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	cmd:which
	cmd:wx_config$secondaryArchSuffix
	"

PATCH()
{
	# Hack in support for wxWidgets 3.1.
	sed -i 's/3.0.\*)/3.1.\*)/g' configure
	sed -i 's/3.0.\*)/3.1.\*)/g' lib-src/lib-widget-extra/configure

	# pthreads
	sed -i 's/-pthread/-lpthread/g' lib-src/portaudio-v19/configure
}

BUILD()
{
	runConfigure ./configure --disable-dynamic-loading --without-lv2 \
		--without-portmixer --disable-nyquist
	make $jobArgs
}

INSTALL()
{
	make install
}
