SUMMARY="A library to label music and sounds"
DESCRIPTION="aubio is a library to label music and sounds. It listens to \
audio signals and attempts to detect events. For instance, when a drum is \
hit, at which frequency is a note, or at what tempo is a rhythmic melody.

Its features include segmenting a sound file before each of its attacks, \
performing pitch detection, tapping the beat and producing midi streams from \
live audio."
HOMEPAGE="https://aubio.org"
COPYRIGHT="2003-2019 Paul Brossier"
LICENSE="GNU GPL v3"
REVISION="1"
SOURCE_URI="https://aubio.org/pub/aubio-$portVersion.tar.bz2"
CHECKSUM_SHA256="d48282ae4dab83b3dc94c16cf011bcb63835c1c02b515490e1883049c3d1f3da"
SOURCE_DIR="aubio-$portVersion"

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

libVersion="5.4.8"
libVersionCompat="$libVersion compat >= ${libVersion%%.*}"

PROVIDES="
	libaubio$secondaryArchSuffix = $portVersion
	cmd:aubiomfcc$secondaryArchSuffix
	cmd:aubionotes$secondaryArchSuffix
	cmd:aubioonset$secondaryArchSuffix
	cmd:aubiopitch$secondaryArchSuffix
	cmd:aubioquiet$secondaryArchSuffix
	cmd:aubiotrack$secondaryArchSuffix
	lib:libaubio$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libavcodec$secondaryArchSuffix
	lib:libavformat$secondaryArchSuffix
	lib:libavutil$secondaryArchSuffix
	lib:libswresample$secondaryArchSuffix
	lib:libsamplerate$secondaryArchSuffix
	lib:libsndfile$secondaryArchSuffix
	"

PROVIDES_devel="
	libaubio${secondaryArchSuffix}_devel = $portVersion
	devel:libaubio$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES_devel="
	libaubio$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libavcodec$secondaryArchSuffix
	devel:libavformat$secondaryArchSuffix
	devel:libavutil$secondaryArchSuffix
	devel:libswresample$secondaryArchSuffix
	devel:libsamplerate$secondaryArchSuffix
	devel:libsndfile$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:pkg_config$secondaryArchSuffix
	cmd:python
	"

defineDebugInfoPackage libaubio$secondaryArchSuffix \
	"$libDir"/libaubio.so.$libVersion \
	"$binDir"/aubiomfcc \
	"$binDir"/aubionotes \
	"$binDir"/aubioonset \
	"$binDir"/aubiopitch \
	"$binDir"/aubioquiet \
	"$binDir"/aubiotrack

BUILD()
{
	echo $includeDir
	runConfigure --omit-buildspec ./waf configure \
		--with-target-platform=$effectiveTargetMachineTriple
	./waf build --notests
}

INSTALL()
{
	./waf install --notests

	prepareInstalledDevelLibs libaubio
	fixPkgconfig

	# devel package
	packageEntries devel \
		$developDir
}
