SUMMARY="Portable cross-platform audio I/O library"
DESCRIPTION="PortAudio is a free, cross-platform, audio I/O library."
HOMEPAGE="http://www.portaudio.com"
COPYRIGHT="1999-2021 Ross Bencina and Phil Burk"
LICENSE="MIT"
REVISION="1"
SOURCE_URI="http://files.portaudio.com/archives/pa_stable_v190700_20210406.tgz"
CHECKSUM_SHA256="47efbf42c77c19a05d22e627d42873e991ec0c1357219c0d74ce6a2948cb2def"
SOURCE_DIR="portaudio"
PATCHES="portaudio-$portVersion.patchset"

# disabled: no audio output backend for Haiku, yet
ARCHITECTURES="?all"
SECONDARY_ARCHITECTURES="?x86"

PROVIDES="
	portaudio$secondaryArchSuffix = $portVersion
	lib:libportaudio$secondaryArchSuffix = 2.0.0 compat >= 2
	lib:libportaudiocpp$secondaryArchSuffix = 0.0.12 compat >= 0
	"
REQUIRES="
	haiku${secondaryArchSuffix}
	"

PROVIDES_devel="
	portaudio${secondaryArchSuffix}_devel = $portVersion
	devel:libportaudio$secondaryArchSuffix = 2.0.0 compat >= 2
	devel:libportaudiocpp$secondaryArchSuffix = 0.0.12 compat >= 0
	"
REQUIRES_devel="
	lib:libportaudio$secondaryArchSuffix == 2.0.0
	lib:libportaudiocpp$secondaryArchSuffix == 0.0.12
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	"

BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoconf
	cmd:gcc${secondaryArchSuffix}
	cmd:git
	cmd:ld${secondaryArchSuffix}
	cmd:libtoolize$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

BUILD()
{
	autoreconf -fi
	git checkout -- depcomp # deleted by autoreconf, but still needed...
	runConfigure ./configure --enable-cxx --enable-shared
	make
}

INSTALL()
{
	mkdir -p $libDir

	make install

	prepareInstalledDevelLibs \
		libportaudio libportaudiocpp

	fixPkgconfig

	packageEntries devel \
		$developDir
}
