DESCRIPTION="
IlmBase provides base libraries for OpenEXR. It contains five \
modules. Half encapsulates 16-bit floating-point format. IlmThread \
is thread abstraction library which currently supports pthreads and \
Windows threads. Imath implements 2D and 3D vectors, 3x3 and 4x4 \
matrices, quaternions and other useful math functions. Iex is an \
exception-handling library. There is also IexMath module.
"
SUMMARY="OpenEXR ILM Base libraries"
HOMEPAGE="http://www.openexr.com"
LICENSE="BSD (3-clause)"
COPYRIGHT="2002-2011 Industrial Light & Magic"
SRC_URI="http://download.savannah.nongnu.org/releases/openexr/ilmbase-2.1.0.tar.gz"
CHECKSUM_SHA256="1e841ad89c5761940b07a125e6909ad22fe9fe0f99eadef45e0cca4efc6819b4"
REVISION="1"

ARCHITECTURES="x86 ?x86_64"
if [ $effectiveTargetArchitecture != x86_gcc2 ]; then
	# x86_gcc2 is fine as primary target architecture as long as we're building
	# for a different secondary architecture.
	ARCHITECTURES="$ARCHITECTURES x86_gcc2"
else
	ARCHITECTURES="$ARCHITECTURES !x86_gcc2"
fi
SECONDARY_ARCHITECTURES="x86 ?x86_64"

PATCHES="ilmbase-2.1.0.patch"

PROVIDES="
	ilmbase$secondaryArchSuffix = $portVersion
	lib:libilmbase$secondaryArchSuffix = $portVersion
	lib:libHalf$secondaryArchSuffix = $portVersion
	lib:libIex_2_1$secondaryArchSuffix = $portVersion
	lib:libIexMath_2_1$secondaryArchSuffix = $portVersion
	lib:libIlmThread_2_1$secondaryArchSuffix = $portVersion
	lib:libImath_2_1$secondaryArchSuffix = $portVersion
	"

REQUIRES="
	haiku$secondaryArchSuffix >= $haikuVersion
	"
BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel >= $haikuVersion
	"
BUILD_PREREQUIRES="
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:make
	cmd:which
	cmd:autoconf
	cmd:aclocal
	cmd:libtoolize
	"
	
BUILD()
{
	./bootstrap
	runConfigure ./configure
	make
}

INSTALL()
{
	make install
	
	# prepare development lib links
	prepareInstalledDevelLibs libHalf libIex libIexMath libIlmThread \
		libImath libIex-2_1 libIexMath-2_1 libIlmThread-2_1 libImath-2_1
	
	fixPkgconfig
	
	# devel package
	packageEntries devel $developDir
}

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

PROVIDES_devel="
	ilmbase${secondaryArchSuffix}_devel = $portVersion
	devel:libilmbase$secondaryArchSuffix = $portVersion
	devel:libHalf$secondaryArchSuffix = $portVersion
	devel:libIex_2_1$secondaryArchSuffix = $portVersion
	devel:libIexMath_2_1$secondaryArchSuffix = $portVersion
	devel:libIlmThread_2_1$secondaryArchSuffix = $portVersion
	devel:libImath_2_1$secondaryArchSuffix = $portVersion
	devel:libIex$secondaryArchSuffix = $portVersion
	devel:libIexMath$secondaryArchSuffix = $portVersion
	devel:libIlmThread$secondaryArchSuffix = $portVersion
	devel:libImath$secondaryArchSuffix = $portVersion
	"
REQUIRES_devel="
	ilmbase$secondaryArchSuffix == $portVersion base
	"
