SUMMARY="A library for decoding MPEG-2 and MPEG-1 video"
DESCRIPTION="libmpeg2 is a library for decoding MPEG-2 and MPEG-1 video. Its \
main development goals are:

- Conformance: libmpeg2 is able to decode all MPEG streams that conform to \
certain restrictions: 'Constrained Parameters' for MPEG-1, and 'Main Profile' \
for MPEG-2.
- Speed: With typical video streams as found on DVD's, and doing only decoding \
with no display, you should be able to get less than 20 cycles per output \
pixel. In a real player program, the display routines will probably take as \
much time as the actual decoding!
- Portability: Most of the code is written in C, and when we use platform-\
specific optimizations (typically assembly routines, currently used for the \
motion compensation and the inverse cosine transform stages) we always have a \
generic C routine to fall back on.
- Reuseability: libmpeg2 doesn't include any project-specific code, but it \
should still include enough features to be used by very diverse projects."
HOMEPAGE="http://libmpeg2.sourceforge.net"
COPYRIGHT="2000-2003 Michel Lespinasse
	1999-2000 Aaron Holtzman"
LICENSE="GNU GPL v2"
REVISION="6"
SOURCE_URI="http://libmpeg2.sourceforge.net/files/libmpeg2-$portVersion.tar.gz"
CHECKSUM_SHA256="dee22e893cb5fc2b2b6ebd60b88478ab8556cb3b93f9a0d7ce8f3b61851871d4"
PATCHES="libmpeg2-${portVersion}.patch"

ARCHITECTURES="all"
SECONDARY_ARCHITECTURES="x86_gcc2 x86"

PROVIDES="
	libmpeg2${secondaryArchSuffix} = $portVersion compat >= 0.5
	lib:libmpeg2${secondaryArchSuffix} = 0.1.0 compat >= 0
	lib:libmpeg2convert${secondaryArchSuffix} = 0.0.0 compat >= 0
	"
if [ -z "$secondaryArchSuffix" ]; then
	PROVIDES="$PROVIDES
		cmd:mpeg2dec${secondaryArchSuffix} = $portVersion
		cmd:corrupt_mpeg2${secondaryArchSuffix} = $portVersion
		cmd:extract_mpeg2${secondaryArchSuffix} = $portVersion
		"
fi

REQUIRES="
	haiku${secondaryArchSuffix}
	"

PROVIDES_devel="
	libmpeg2${secondaryArchSuffix}_devel = $portVersion compat >= 0.5
	devel:libmpeg2${secondaryArchSuffix} = 0.1.0 compat >= 0
	devel:libmpeg2convert${secondaryArchSuffix} = 0.0.0 compat >= 0
	"
REQUIRES_devel="
	libmpeg2${secondaryArchSuffix} == $portVersion base
	"

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

BUILD()
{
	./bootstrap
	runConfigure ./configure --enable-shared --enable-static
	make $jobArgs
}

INSTALL()
{
	make install

	rm $libDir/libmpeg2.la $libDir/libmpeg2convert.la
	if [ -n "$secondaryArchSuffix" ]; then
		rm -rf $binDir
	fi

	# prepare develop/lib
	prepareInstalledDevelLibs libmpeg2 libmpeg2convert
	fixPkgconfig

	packageEntries devel \
		$developDir
}
