SUMMARY="Cross platform audio library"
DESCRIPTION="Cubeb is a cross-platform library, written in C/C++, that was \
created and has been maintained by the Firefox Media Team.
The functionality of the library is not limited to audio input and output. \
In addition, it is possible to enumerate all audio devices in the system, as \
well as to register notifications such as device unplugs. It is also possible \
to switch between devices at a lower level with a minimal transition gap."
HOMEPAGE="https://github.com/mozilla/cubeb/"
COPYRIGHT="Mozilla Foundation"
LICENSE="ISC"
REVISION="1"
gitRevision="860bf2b31531e4ef49478a433ff22ffb4303b805"
SOURCE_URI="https://github.com/mozilla/cubeb/archive/$gitRevision.tar.gz"
CHECKSUM_SHA256="104e875c7073953a8dc7a8db8ed221f243c18a7572ee05b052cf0bf8888e150c"
SOURCE_DIR="cubeb-$gitRevision"
PATCHES="cubeb-$portVersion.patchset"

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

PROVIDES="
	cubeb$secondaryArchSuffix = $portVersion
	cmd:cubeb_test$secondaryArchSuffix = $portVersion
	lib:libcubeb$secondaryArchSuffix = $portVersion compat >= 0
	"
REQUIRES="
	haiku$secondaryArchSuffix
	"

PROVIDES_devel="
	cubeb${secondaryArchSuffix}_devel = $portVersion
	devel:libcubeb$secondaryArchSuffix = $portVersion compat >= 0
	"
REQUIRES_devel="
	haiku$secondaryArchSuffix
	lib:libcubeb$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	"
BUILD_PREREQUIRES="
	cmd:cmake
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:make
	"

BUILD()
{
	mkdir -p build
	cd build
	cmake .. $cmakeDirArgs \
		-DCMAKE_BUILD_TYPE=Release \
		-DCMAKE_INSTALL_BINDIR=$binDir \
		-DBUILD_SHARED_LIBS=ON \
		-DBUILD_TESTS=OFF

	make $jobArgs
}

INSTALL()
{
	cd build
	make install

	prepareInstalledDevelLib libcubeb

	# devel package
	packageEntries devel \
		$developDir \
		$libDir/cmake
}
