SUMMARY="A color management framework for visual effects and animation"
DESCRIPTION="
OpenColorIO (OCIO) is a complete color management solution geared towards \
motion picture production with an emphasis on visual effects and computer \
animation. OCIO provides a straightforward and consistent user experience \
across all supporting applications while allowing for sophisticated back-end \
configuration options suitable for high-end production usage. OCIO is \
compatible with the Academy Color Encoding Specification (ACES) and is \
LUT-format agnostic, supporting many popular formats."
HOMEPAGE="http://opencoloio.org/"
COPYRIGHT="
	2003-2010 Sony Pictures Imageworks Inc., et al.
	"
LICENSE="BSD (3-clause)"
SOURCE_URI="https://github.com/imageworks/OpenColorIO/archive/v$portVersion.tar.gz"
SOURCE_FILENAME="opencolorio-$portVersion.tar.gz"
CHECKSUM_SHA256="27c81e691c15753cd2b560c2ca4bd5679a60c2350eedd43c99d44ca25d65ea7f"
REVISION="1"
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

PATCHES="opencolorio-$portVersion.patchset"

PROVIDES="
	opencolorio$secondaryArchSuffix = $portVersion compat >= 1
	cmd:ociobakelut
	cmd:ociocheck
	lib:libopencolorio$secondaryArchSuffix = 1.0.9 compat >= 1
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:liblcms2$secondaryArchSuffix
	lib:libtinyxml$secondaryArchSuffix
	lib:libstdc++$secondaryArchSuffix
	lib:libgcc_s$secondaryArchSuffix
	"
BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	boost${secondaryArchSuffix}_devel
	devel:liblcms2$secondaryArchSuffix
	devel:libtinyxml$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:make
	cmd:cmake
	cmd:pkg_config$secondaryArchSuffix
	cmd:patch
	"
	
SOURCE_DIR="OpenColorIO-$portVersion"

BUILD()
{
	cmake . \
		-DOCIO_BUILD_NUKE=OFF \
		-DOCIO_BUILD_STATIC=OFF \
		-DOCIO_BUILD_SHARED=ON \
		-DUSE_EXTERNAL_LCMS=ON \
		-DUSE_EXTERNAL_TINYXML=ON \
		-DCMAKE_INSTALL_PREFIX:PATH=$prefix
	make $jobArgs
}

INSTALL()
{
	make install
	
	mkdir -p $developDir $dataDir
	mv $prefix/include $includeDir
	mv $prefix/share/* $dataDir

	prepareInstalledDevelLibs libOpenColorIO
	fixPkgconfig

	# devel package
	packageEntries devel \
		$developDir
}

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

PROVIDES_devel="
	opencolorio${secondaryArchSuffix}_devel = $portVersion compat >= 1
	devel:libopencolorio$secondaryArchSuffix = 1.0.9 compat >= 1
	"
REQUIRES_devel="
	opencolorio$secondaryArchSuffix == $portVersion base
	"
