SUMMARY="FAAD2 is an open source MPEG-4 and MPEG-2 AAC decoder"
DESCRIPTION="FAAD2 is an open source MPEG-4 and MPEG-2 AAC decoder"

HOMEPAGE="http://www.audiocoding.com/"
SRC_URI="http://downloads.sourceforge.net/faac/faad2-2.7.tar.gz"
REVISION="1"
LICENSE="GNU GPL v2"
COPYRIGHT="2003-2005 M. Bakker, Nero AG."

CHECKSUM_SHA256="ee26ed1e177c0cd8fa8458a481b14a0b24ca0b51468c8b4c8b676fd3ceccd330"

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

PATCHES="faad2-2.7.patch"

PROVIDES="
	faad2$secondaryArchSuffix = $portVersion compat >= 2.0
	lib:libfaad$secondaryArchSuffix  = 2.0.0 compat >= 2
	cmd:faad$secondaryArchSuffix = $portVersion
	"

REQUIRES="
	haiku${secondaryArchSuffix} >= $haikuVersion
"

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


PATCH()
{
	sed -i 's/(LTCOMPILE) -c/(LTCOMPILE) -nostart/' libfaad/Makefile.in
	sed -i 's/iquote/I/' libfaad/Makefile.am
}

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

	runConfigure ./configure
	make $jobArgs
}

INSTALL()
{
	make install
	prepareInstalledDevelLibs libfaad libmp4ff

	# devel package
	packageEntries devel \
		$developDir

}

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

PROVIDES_devel="
	faad2${secondaryArchSuffix}_devel = $portVersion compat >= 2.0
	devel:libfaad$secondaryArchSuffix = 2.0.0 compat >= 2
	devel:libmp4ff$secondaryArchSuffix = $portVersion
	"
REQUIRES_devel="
	faad2$secondaryArchSuffix == $portVersion base
	"
