SUMMARY="A software implementation of the OpenAL 3D audio API"
DESCRIPTION="OpenAL stands for (Open Audio Library), a cross-platform audio application \
programming interface written in C. It is an environmental 3D audio \
library that aims to provide a replacement for proprietary 3D audio systems \
such as EAX and A3D. Openal is designed for efficient rendering of \
multichannel 3D positional audio."
HOMEPAGE="https://www.openal-soft.org/"
COPYRIGHT="1999-2000 Loki Software
	2005-2011 OpenAL Soft team"
LICENSE="GNU LGPL v2.1"
REVISION="5"
SOURCE_URI="https://github.com/kcat/openal-soft/archive/refs/tags/openal-soft-1.13.tar.gz"
#SOURCE_URI="https://kcat.strangesoft.net/openal-releases/openal-soft-1.13.tar.bz2"
CHECKSUM_SHA256="6f39476853c1b21ea841401b7f15bc3ed6b6c738b0a840de076a2865eb7751f9"
SOURCE_DIR="openal-soft-openal-soft-1.13"
PATCHES="openal-$portVersion.patchset"

ARCHITECTURES="x86_gcc2"

PROVIDES="
	openal$secondaryArchSuffix = $portVersion compat >= 1
	lib:libopenal$secondaryArchSuffix = 1.13.0 compat >= 1
	"
REQUIRES="
	haiku$secondaryArchSuffix
	"

PROVIDES_devel="
	openal${secondaryArchSuffix}_devel = $portVersion compat >= 1
	cmd:openal_info$secondaryArchSuffix
	devel:libopenal$secondaryArchSuffix = 1.13.0 compat >= 0
	"
REQUIRES_devel="
	haiku$secondaryArchSuffix
	lib:libopenal$secondaryArchSuffix == $portVersion base
	"

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

BUILD()
{
	cd build
	cmake .. -DCMAKE_BUILD_TYPE=Release \
		-DCMAKE_INSTALL_PREFIX=$prefix -DBIN_DIR="$relativeBinDir" \
		-DLIB_SUFFIX="/${secondaryArchSuffix/_/}"
	make $jobArgs
}

INSTALL()
{
	cd build
	make install

	mkdir -p $includeDir
	mv $prefix/include/* $includeDir
	rmdir $prefix/include

	prepareInstalledDevelLib libopenal
	fixPkgconfig

	# devel package
	packageEntries devel \
			$developDir \
			$binDir
}
