SUMMARY="An implementation of the smjpeg decoding library"
DESCRIPTION="smjpeg is short for the SDL Motion JPEG library, originally \
developed by Loki Software, It is used to playback motion JPEGs and runs \
on just about any platform. It comes with one sample decoder, smjpeg_decode \
(console, no UI)."
HOMEPAGE="http://www.icculus.org/smjpeg"
COPYRIGHT="1999-2004 Sam Lantinga, Joe Tennies."
LICENSE="GNU LGPL v2"
REVISION="3"
SOURCE_URI="ftp://ftp.gameaholic.com/pub/mirrors/ftp.lokigames.com/open-source/smjpeg/smjpeg-0.2.1.tar.gz
svn://svn.icculus.org/smjpeg/trunk/"
CHECKSUM_SHA256="d0fdbb346e78bde7c9d3dc10097a8d29cedb0d4d0a5959e6b11b78bae2094a32"

ARCHITECTURES="?all x86_gcc2 x86"
SECONDARY_ARCHITECTURES="x86_gcc2 x86"

PROVIDES="
	smjpeg$secondaryArchSuffix = $portVersion compat >= 0
	cmd:smjpeg_decode$secondaryArchSuffix = $portVersion compat >= 0
	cmd:smjpeg_encode$secondaryArchSuffix = $portVersion compat >= 0
	lib:libsmjpeg$secondaryArchSuffix = 0.2_0.0.2 compat >= 0.2_0
	lib:libsmjpeg_0.2$secondaryArchSuffix = 0.0.2 compat >= 0
	"
REQUIRES="
	haiku$secondaryArchSuffix
	libsdl$secondaryArchSuffix
	lib:libGL$secondaryArchSuffix
	"

PROVIDES_devel="
	smjpeg${secondaryArchSuffix}_devel = $portVersion
	devel:libsmjpeg$secondaryArchSuffix = 0.2_0.0.2 compat >= 0.2_0
	devel:libsmjpeg_0.2$secondaryArchSuffix = 0.0.2 compat >= 0
	"
REQUIRES_devel="
	smjpeg$secondaryArchSuffix == $portVersion base
	"

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

BUILD()
{
	rm -f aclocal.m4
	rm -f acinclude.m4
	libtoolize --force --copy --install
	aclocal
	automake --foreign --add-missing
	autoconf
	runConfigure ./configure --enable-shared
	make $jobArgs
}

INSTALL()
{
	make install

	prepareInstalledDevelLibs libsmjpeg
	fixPkgconfig

	# devel package
	packageEntries devel \
		$developDir
}
