SUMMARY="A library to read and write images"
DESCRIPTION="OpenImageIO is a library for reading and writing images, and a \
bunch of related classes, utilities, and applications. There is a particular \
emphasis on formats and functionality used in professional, large-scale \
animation and visual effects work for film.
OpenImageIO is used extensively in animation and VFX studios all over the \
world, and is also incorporated into several commercial products."
HOMEPAGE="http://github.com/OpenImageIO/"
COPYRIGHT="2008-2015 Larry Gritz et al."
LICENSE="BSD (3-clause)"
REVISION="1"
SOURCE_URI="https://github.com/OpenImageIO/oiio/archive/Release-$portVersion.tar.gz"
CHECKSUM_SHA256="e41e1d94ff2dc6029969b295a9eed83d6817807c741bde8a4f4947b74dc62222"
SOURCE_FILENAME="openimageio-$portVersion.tar.gz"
SOURCE_DIR="oiio-Release-$portVersion"
PATCHES="openimageio-1.5.15.patchset"

ARCHITECTURES="x86 x86_64"
SECONDARY_ARCHITECTURES="x86"
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"
fi

PROVIDES="
	openimageio$secondaryArchSuffix = $portVersion compat >= 1.5
	cmd:iconvert
	cmd:idiff
	cmd:igrep
	cmd:iinfo
	cmd:maketx
	cmd:oiiotool
	lib:libopenimageio$secondaryArchSuffix = 1.5.15 compat >= 1.5
	lib:libopenimageio_util$secondaryArchSuffix = 1.5.15 compat >= 1.5
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libhalf$secondaryArchSuffix
	lib:libilmimf$secondaryArchSuffix
	lib:libjpeg$secondaryArchSuffix
	lib:libpng16$secondaryArchSuffix
	lib:libtiff$secondaryArchSuffix
	lib:libwebp$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	lib:libboost_filesystem$secondaryArchSuffix
	lib:libboost_regex$secondaryArchSuffix
	lib:libboost_system$secondaryArchSuffix
	lib:libboost_thread$secondaryArchSuffix
	lib:libstdc++$secondaryArchSuffix
	lib:libgcc_s$secondaryArchSuffix
	"

PROVIDES_devel="
	openimageio${secondaryArchSuffix}_devel = $portVersion compat >= 1.5
	devel:libopenimageio$secondaryArchSuffix = 1.5.15 compat >= 1.5
	devel:libopenimageio_util$secondaryArchSuffix = 1.5.15 compat >= 1.5
	"
REQUIRES_devel="
	openimageio$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	boost${secondaryArchSuffix}_devel
	devel:libhalf$secondaryArchSuffix
	devel:libilmimf$secondaryArchSuffix
	devel:libjpeg$secondaryArchSuffix
	devel:libpng16$secondaryArchSuffix
	devel:libtiff$secondaryArchSuffix
	devel:libwebp$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:make
	cmd:cmake
	"

BUILD()
{
	make $jobArgs
}

INSTALL()
{
	mkdir -p $binDir $libDir $includeDir $docDir
	cp -R dist/haiku*/bin/* $binDir/
	cp -R dist/haiku*/lib/* $libDir/
	cp -R dist/haiku*/include/* $includeDir/
	cp -R dist/haiku*/doc/* $docDir/
	
	prepareInstalledDevelLibs libOpenImageIO libOpenImageIO_Util
	fixPkgconfig

	# devel package
	packageEntries devel \
		$developDir
}
