SUMMARY="An MPEG-4 and MPEG-2 AAC encoder"
DESCRIPTION="FAAC is an MPEG-4 and MPEG-2 AAC encoder."
HOMEPAGE="https://sourceforge.net/projects/faac/"
COPYRIGHT="2003 Krzysztof Nikiel"
LICENSE="FAAC
	GNU GPL v2"
REVISION="2"
SOURCE_URI="https://github.com/knik0/faac/archive/${portVersion/./_}.tar.gz"
CHECKSUM_SHA256="adc387ce588cca16d98c03b6ec1e58f0ffd9fc6eadb00e254157d6b16203b2d2"
SOURCE_DIR="faac-${portVersion/./_}"

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

PROVIDES="
	faac${secondaryArchSuffix} = $portVersion
	cmd:faac$secondaryArchSuffix
	lib:libfaac$secondaryArchSuffix
	"
REQUIRES="
	haiku$secondaryArchSuffix
	"

PROVIDES_devel="
    faac${secondaryArchSuffix}_devel = $portVersion
    devel:libfaac$secondaryArchSuffix = $portVersion
    "
REQUIRES_devel="
    faac$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoconf
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:libtool
	cmd:make
	"

PATCH()
{
	if [ $effectiveTargetArchitecture = "x86_gcc2" ]; then
		sed -i 's/-lstdc++/-lstdc++.r4/' configure.ac frontend/Makefile.am
	fi
}

BUILD()
{
	autoreconf -fi
	runConfigure ./configure
	make $jobArgs
}

INSTALL()
{
	make install-strip

	rm $libDir/libfaac*.la

	prepareInstalledDevelLibs libfaac
	fixPkgconfig

	packageEntries devel \
		$developDir
}
