SUMMARY="A high quality MPEG Audio Layer III (MP3) encoder"
DESCRIPTION="Following the great history of GNU naming, LAME originally stood \
for LAME Ain't an Mp3 Encoder. LAME is an educational tool to be used for \
learning about MP3 encoding. The goal of the LAME project is to use the open \
source model to improve the psycho acoustics, noise shaping and speed of MP3.
Many popular ripping and encoding programs include the LAME encoding engine.

LAME features:

- Many improvements in quality and speed over ISO reference software.
- MPEG1,2 and 2.5 layer III encoding.
- CBR (constant bitrate) and two types of variable bitrate, VBR and ABR.
- Encoding engine can be compiled as a shared library (Linux/UNIX), DLL, \
Directshow filter or ACM codec (Windows).
- Free format encoding and decoding.
- GPSYCHO: a GPL'd psycho acoustic and noise shaping model.
- Powerful and easy to use presets.
- Quality better than all other encoders at most bitrates.
- Fast! Encodes faster than real time on a PentiumII 266mhz at highest \
quality mode.
- MP3x: a GTK/X-Window MP3 frame analyzer for both .mp3 and unencoded audio \
files."
HOMEPAGE="http://lame.sourceforge.net/"
COPYRIGHT="1998-2012 Mike Cheng et al."
LICENSE="GNU LGPL v2"
REVISION="3"
SOURCE_URI="http://downloads.sourceforge.net/project/lame/lame/3.100/lame-$portVersion.tar.gz"
CHECKSUM_SHA256="ddfe36cab873794038ae2c1210557ad34857a4b6bdc515785d1da9e175b1da1e"

ARCHITECTURES="all"
SECONDARY_ARCHITECTURES="x86_gcc2 x86"

PROVIDES="
	lame$secondaryArchSuffix = $portVersion compat >= 1
	lib:libmp3lame$secondaryArchSuffix = 0.0.0 compat >= 0
	"
if [ -z "$secondaryArchSuffix" ]; then
	PROVIDES="$PROVIDES
		cmd:lame = $portVersion compat >= 1
		"
fi
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libiconv$secondaryArchSuffix
	lib:libncurses$secondaryArchSuffix
	"

PROVIDES_devel="
	lame${secondaryArchSuffix}_devel = $portVersion
	devel:libmp3lame${secondaryArchSuffix} = 0.0.0 compat >= 0
	"
REQUIRES_devel="
	lame${secondaryArchSuffix} == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libiconv$secondaryArchSuffix
	devel:libncurses$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:find
	cmd:gcc${secondaryArchSuffix}
	cmd:ld${secondaryArchSuffix}
	cmd:libtoolize$secondaryArchSuffix
	cmd:make
	cmd:nasm
	cmd:sed
	"

BUILD()
{
	runConfigure ./configure --enable-nasm
	make $jobArgs
}

INSTALL()
{
	make install
	if [ -n "$secondaryArchSuffix" ]; then
		rm $binDir/lame
	fi

	rm $libDir/libmp3lame.la

	# prepare devel/lib
	prepareInstalledDevelLibs libmp3lame
	fixPkgconfig

	# devel package
	packageEntries devel $developDir
}
