SUMMARY="An API for audio analysis and feature extraction plugins"
DESCRIPTION="Vamp is an API for C and C++ plugins that process sampled audio \
data to produce descriptive output (measurements or semantic observations)."
HOMEPAGE="https://www.vamp-plugins.org/"
COPYRIGHT="2003-2010 Mark Borgerding
	2005-2006 Chris Cannam
	2006-2012 Queen Mary, University of London"
LICENSE="MIT"
REVISION="1"
SOURCE_URI="http://code.soundsoftware.ac.uk/attachments/download/2691/vamp-plugin-sdk-$portVersion.tar.gz"
CHECKSUM_SHA256="aeaf3762a44b148cebb10cde82f577317ffc9df2720e5445c3df85f3739ff75f"
SOURCE_DIR="vamp-plugin-sdk-$portVersion"
PATCHES="vamp_plugin_sdk-$portVersion.patchset"

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

commandBinDir=$binDir
commandSuffix=$secondaryArchSuffix
if [ "$targetArchitecture" = x86_gcc2 ]; then
	commandSuffix=
	commandBinDir=$prefix/bin
fi

libVersion="$portVersion"
libVersionCompat="$libVersion compat >= ${libVersion%%.*}"
libVersion_hostsdk="3.10.0"
libVersionCompat_hostsdk="$libVersion_hostsdk compat >= ${libVersion_hostsdk%%.*}"

PROVIDES="
	vamp_plugin_sdk$secondaryArchSuffix = $portVersion
	lib:libvamp_hostsdk$secondaryArchSuffix = $libVersionCompat_hostsdk
	lib:libvamp_sdk$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libsndfile$secondaryArchSuffix
	"

PROVIDES_devel="
	vamp_plugin_sdk${secondaryArchSuffix}_devel = $portVersion
	devel:libvamp_hostsdk$secondaryArchSuffix = $libVersionCompat_hostsdk
	devel:libvamp_sdk$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES_devel="
	vamp_plugin_sdk$secondaryArchSuffix == $portVersion base
	"

PROVIDES_tools="
	vamp_plugin_sdk${secondaryArchSuffix}_tools
	cmd:vamp_rdf_template_generator$commandSuffix
	cmd:vamp_simple_host$commandSuffix
	"
REQUIRES_tools="
	vamp_plugin_sdk$secondaryArchSuffix == $portVersion base
	haiku$secondaryArchSuffix
	lib:libsndfile$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libsndfile$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoconf
	cmd:automake
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:libtoolize$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

BUILD()
{
	autoreconf -fi
	runConfigure --omit-dirs binDir ./configure \
			--bindir=$commandBinDir
	make $jobArgs
}

INSTALL()
{
	make install

	rm $libDir/libvamp*.la

	prepareInstalledDevelLibs libvamp-sdk libvamp-hostsdk
	fixPkgconfig

	# devel package
	packageEntries devel \
		$developDir
	packageEntries tools \
		$commandBinDir
}

TEST()
{
	make test
}
