SUMMARY="An MPEG-4 and MPEG-2 AAC encoder"
DESCRIPTION="
FAAC is an MPEG-4 and MPEG-2 AAC encoder.
"
HOMEPAGE="http://www.audiocoding.com/"
SOURCE_URI="http://downloads.sourceforge.net/faac/faac-1.28.tar.bz2"
CHECKSUM_SHA256="aac475e59d38ae9e29bff760e26bf72b507ccec037a6837cc33e3ac1db3ef352"
REVISION="2"

LICENSE="FAAC
	GNU GPL v2"
COPYRIGHT="2003 Krzysztof Nikiel"

ARCHITECTURES="x86_gcc2 ?x86 x86_64"
SECONDARY_ARCHITECTURES="x86_gcc2 ?x86"

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

REQUIRES="
	haiku$secondaryArchSuffix
	"

BUILD_REQUIRES="
	"

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

SOURCE_DIR="faac-${portVersion}"

PATCHES="faac-${portVersion}.patchset"

PATCH()
{
	sed -i 's/AM_CONFIG_HEADER/AC_CONFIG_HEADERS/g' configure.in

	if [ "$targetArchitecture" = x86_gcc2 ]; then
		sed -i 's/-lstdc++/-lstdc++.r4/' configure.in frontend/Makefile.am
	fi
}

BUILD()
{
	libtoolize --force --copy --install
	aclocal
	autoconf

	runConfigure ./configure
	make $jobArgs
}

INSTALL()
{
	make install-strip

	# prepare develop/lib
	prepareInstalledDevelLibs libfaac
	fixPkgconfig

	packageEntries devel \
		$developDir
}

# ----- devel package -------------------------------------------------------

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