SUMMARY="An MPEG-4 and MPEG-2 AAC encoder"
DESCRIPTION="FAAC is an MPEG-4 and MPEG-2 AAC encoder."
HOMEPAGE="https://www.audiocoding.com/"
COPYRIGHT="2003 Krzysztof Nikiel"
LICENSE="FAAC
	GNU GPL v2"
REVISION="3"
SOURCE_URI="http://downloads.sourceforge.net/faac/faac-$portVersion.tar.gz"
CHECKSUM_SHA256="cef2897843baf366983ad29f471cd1c4dcc95762b86d283a925514bcc5cf5a3f"
PATCHES="faac-1.29.3.patchset"

ARCHITECTURES="all"
SECONDARY_ARCHITECTURES="x86_gcc2 x86"

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

PROVIDES_devel="
    faac${secondaryArchSuffix}_devel = $portVersion
    devel:libfaac$secondaryArchSuffix = $portVersion
    devel:libfaac_drm$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

	# prepare develop/lib
	prepareInstalledDevelLibs libfaac libfaac_drm
	fixPkgconfig

	packageEntries devel \
		$developDir
}
