SUMMARY="A library for decoding mpeg-2 and mpeg-1 video"
DESCRIPTION="
A library for decoding mpeg-2 and mpeg-1 video.
"
HOMEPAGE="http://libmpeg2.sourceforge.net" 
LICENSE="GNU GPL v2"
COPYRIGHT="
	2000-2003 Michel Lespinasse
	1999-2000 Aaron Holtzman
	"
SOURCE_URI="http://libmpeg2.sourceforge.net/files/libmpeg2-$portVersion.tar.gz"
CHECKSUM_SHA256="dee22e893cb5fc2b2b6ebd60b88478ab8556cb3b93f9a0d7ce8f3b61851871d4"
REVISION="3"
ARCHITECTURES="x86_gcc2 x86 x86_64"
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}
	"

BUILD_REQUIRES="
	"

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

PATCHES="libmpeg2-${portVersion}.patch"

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

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

	# prepare develop/lib
	prepareInstalledDevelLibs libmpeg2 libmpeg2convert
	fixPkgconfig

	packageEntries devel \
		$developDir
} 

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

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
	"
