SUMMARY="MPEG Audio Decoder library"
DESCRIPTION="MAD is a high-quality MPEG audio decoder. It currently supports \
MPEG-1 and the MPEG-2 extension to lower sampling frequencies, as well as the \
de facto MPEG 2.5 format. All three audio layers -- Layer I, Layer II, and \
Layer III (i.e. MP3) -- are fully implemented."
HOMEPAGE="http://mad.sourceforge.net/"
COPYRIGHT="2000-2004 Underbit Technologies, Inc."
LICENSE="GNU GPL v2"
REVISION="7"
SOURCE_URI="ftp://ftp.mars.org/pub/mpeg/libmad-0.15.1b.tar.gz"
CHECKSUM_SHA256="bbfac3ed6bfbc2823d3775ebb931087371e142bb0e9bb1bee51a76a6e0078690"
PATCHES="libmad-$portVersion.patchset"

ARCHITECTURES="all"
SECONDARY_ARCHITECTURES="x86_gcc2 x86"

PROVIDES="
	libmad$secondaryArchSuffix = $portVersion
	lib:libmad$secondaryArchSuffix = 0.2.1 compat >= 0
	"
REQUIRES="
	haiku$secondaryArchSuffix
	"

PROVIDES_devel="
	libmad${secondaryArchSuffix}_devel = $portVersion
	devel:libmad$secondaryArchSuffix = 0.2.1 compat >= 0
	"
REQUIRES_devel="
	libmad$secondaryArchSuffix == $portVersion
	"

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

BUILD()
{
	touch NEWS AUTHORS ChangeLog
	sed -i 's/AM_CONFIG_HEADER/AC_CONFIG_HEADERS/' configure.ac
	sed -i 's/$optimize -fforce-mem/$optimize/g' configure.ac
	autoreconf -vfi
	runConfigure ./configure
	make $jobArgs
}

INSTALL()
{
	make install

	rm $libDir/libmad.la

	prepareInstalledDevelLibs libmad
	fixPkgconfig

	#devel Package
	packageEntries devel \
			$developDir
}
