SUMMARY="Implementation of the codec specified in the JPEG-2000 Part-1 standard."
DESCRIPTION="
The JasPer Project is an open-source initiative to provide a free \
software-based reference implementation of the codec specified in the \
JPEG-2000 Part-1 standard. More details about this software can be found in \
the JasPer Software Reference Manual.
"
HOMEPAGE="http://www.ece.uvic.ca/~mdadams/jasper/"
SRC_URI="http://www.ece.uvic.ca/~mdadams/jasper/software/jasper-1.900.1.zip"
CHECKSUM_SHA256="6b905a9c2aca2e275544212666eefc4eb44d95d0a57e4305457b407fe63f9494"
REVISION="1"

LICENSE="JasPer v2"
COPYRIGHT="1999-2007 Michael D. Adams"

ARCHITECTURES="x86_gcc2 x86 ?x86_64"
SECONDARY_ARCHITECTURES="x86_gcc2 x86"

PROVIDES="
	jasper$secondaryArchSuffix = $portVersion compat >= 1.0.0
	lib:libjasper$secondaryArchSuffix = $portVersion compat >= 1.0.0
	"

REQUIRES="
	haiku$secondaryArchSuffix >= $haikuVersion
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel >= $haikuVersion
	"

BUILD_PREREQUIRES="
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:make
	cmd:mkdepend
	cmd:libtoolize
	cmd:aclocal
	cmd:autoconf
	cmd:automake
	cmd:chmod
	"



BUILD()
{
	libtoolize --force --copy --install
	aclocal -I acaux
	autoconf
	automake
	chmod 777 configure
	runConfigure ./configure --enable-shared
	make
}

INSTALL()
{
	make install
	
	prepareInstalledDevelLibs libjasper

	# devel package
	packageEntries devel \
		$developDir

	# tools package
	if [ -z "$secondaryArchSuffix" ]; then
		packageEntries tools \
			$binDir \
			$documentationDir
	fi

	# Remove stuff we don't need in the secondary architecture base package.
	if [ -n "$secondaryArchSuffix" ]; then
		rm -rf $binDir
		rm -rf $documentationDir
	fi
}

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

PROVIDES_devel="
	jasper${secondaryArchSuffix}_devel = $portVersion
	devel:libjasper$secondaryArchSuffix = $portVersion
	"

REQUIRES_devel="
	jasper$secondaryArchSuffix == $portVersion base
	"

# ----- tools package -------------------------------------------------------

if [ -z "$secondaryArchSuffix" ]; then
	SUMMARY_tools="The jasper tools"
	PROVIDES_tools="
		jasper_tools$secondaryArchSuffix = $portVersion
		cmd:imgcmp$secondaryArchSuffix = $portVersion
		cmd:imginfo$secondaryArchSuffix = $portVersion
		cmd:jasper$secondaryArchSuffix = $portVersion
		cmd:tmrdemo$secondaryArchSuffix = $portVersion
		"
	REQUIRES_tools="
		jasper$secondaryArchSuffix == $portVersion base
		"
fi
