SUMMARY="Fraunhofer AAC codec library"
DESCRIPTION="The Fraunhofer FDK AAC Codec Library for Android (\"FDK AAC \
Codec\") is software that implements the MPEG Advanced Audio Coding (\"AAC\") \
encoding and decoding scheme for digital audio."
HOMEPAGE="https://sourceforge.net/projects/opencore-amr"
COPYRIGHT="1995-2021 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V."
LICENSE="Fraunhofer FDK AAC Codec"
REVISION="2"
SOURCE_URI="https://downloads.sourceforge.net/opencore-amr/fdk-aac/fdk-aac-$portVersion.tar.gz"
CHECKSUM_SHA256="c9e8630cf9d433f3cead74906a1520d2223f89bcd3fa9254861017440b8eb22f"
SOURCE_DIR="fdk-aac-$portVersion"
PATCHES="fdk_aac-$portVersion.patchset"

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

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

PROVIDES="
	fdk_aac$secondaryArchSuffix = $portVersion
	lib:libfdk_aac$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES="
	haiku$secondaryArchSuffix
	"
REPLACES="
	libfdk_aac$secondaryArchSuffix
	"

PROVIDES_devel="
	fdk_aac${secondaryArchSuffix}_devel = $portVersion
	devel:libfdk_aac$secondaryArchSuffix = $libVersion
	"
REQUIRES_devel="
	fdk_aac$secondaryArchSuffix == $portVersion base
	haiku${secondaryArchSuffix}_devel
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	"
BUILD_PREREQUIRES="
	cmd:autoconf
	cmd:awk
	cmd:g++$secondaryArchSuffix
	cmd:gcc$secondaryArchSuffix
	cmd:make
	"

defineDebugInfoPackage fdk_aac$secondaryArchSuffix \
	"$libDir"/libfdk-aac.so.$libVersion

BUILD()
{
	runConfigure ./configure --enable-shared
	make $jobArgs
}

INSTALL()
{
	make install

	install -d -m 755 "$docDir"
	install -t "$docDir" -m 644 ChangeLog \
		documentation/*.pdf

	rm -f "$libDir"/*.la

	fixPkgconfig
	prepareInstalledDevelLib libfdk-aac
	packageEntries devel \
		"$developDir" \
		"$docDir"/ChangeLog \
		"$docDir"/*.pdf
}
