New Formula: opencolorio

OpenColorIO (OCIO) is a complete color management solution geared
towards motion picture production with an emphasis on visual effects
and computer animation.  See:  http://opencolorio.org

OCIO is at version 1.0.6 and has been in development since 2003. It
is one of several open source projects actively sponsored by Sony
Imageworks.

OCIO is a new dep for OpenImageIO (OIIO), adding functionality.

OCIO has a built-in test suite that is passes.  There are stable
and head methods available.  It builds using the system OpenGL,
and little-cms2, along with pkg-config and cmake.  An Alias is
added for this formula to ocio.  It has python bindings enabled
with a user option, following the example of vtk.

OCIO head and stable build and run very well on Lion and SL using
all five compilers from XCode-4.3.2, 4.0.2, and CLT-4.3.2, thanks
to patches the devs merged upstream for us.

EDIT: code fix redacted args.
EDIT: shrink formula comments.
EDIT: test against XCode-4.3.1.
EDIT: remove the unnecessary which python-config
EDIT: change to version 1.0.6.  Remove rescue clause.  Tests work.
EDIT: tests pass against XCode-4.3.2.
EDIT: modify the caveats for accuracy using the dev's suggestions.
EDIT: remove the `\n` after the caveat url

Closes Homebrew/homebrew#10669.

Signed-off-by: Misty De Meo <mistydemeo@gmail.com>
This commit is contained in:
Nibbles 2bits 2012-02-28 14:06:24 -08:00 committed by Misty De Meo
parent ac87fc89c6
commit 15f9fd3f86
2 changed files with 95 additions and 0 deletions

1
Aliases/ocio Symbolic link
View file

@ -0,0 +1 @@
../Formula/opencolorio.rb

94
Formula/opencolorio.rb Normal file
View file

@ -0,0 +1,94 @@
require 'formula'
class Opencolorio < Formula
homepage 'http://opencolorio.org/'
url 'https://github.com/imageworks/OpenColorIO/tarball/v1.0.6'
sha1 '1d7a195b684fbd0687a661aa532c5cc447215420'
head 'https://github.com/imageworks/OpenColorIO.git'
depends_on 'cmake' => :build
depends_on 'pkg-config' => :build
depends_on 'little-cms2'
def options
[
['--with-tests', 'Verify the build with its unit tests (~1min)'],
['--with-python', 'Build ocio with python2.7 bindings'],
['--with-java', 'Build ocio with java bindings'],
['--with-docs', 'Build the documentation.']
]
end
def install
args = std_cmake_parameters.split
args << "-DOCIO_BUILD_JNIGLUE=ON" if ARGV.include? '--with-java'
args << "-DOCIO_BUILD_TESTS=ON" if ARGV.include? '--with-tests'
args << "-DOCIO_BUILD_DOCS=ON" if ARGV.include? '--with-docs'
args << "-DCMAKE_VERBOSE_MAKEFILE=OFF"
# CMake-2.8.7 + CLT + llvm + Lion => CMAKE_CXX_HAS_ISYSROOT "1"
# CMake-2.8.7 + CLT + clang + Lion => CMAKE_CXX_HAS_ISYSROOT ""
# CMake puts a malformed sysroot into CXX_FLAGS in flags.make with llvm.
# Syntax like this gets added:
# -isysroot /Some/Wrong/SDKs/path
# which causes c++ includes not found when compiling with llvm.
# https://github.com/imageworks/OpenColorIO/issues/224
# The current workaround is that the SDK directory structure is mirrored
# in the root directory, e.g.
# Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/include
# /usr/include
# So we just set the sysroot to /
args << "-DCMAKE_OSX_SYSROOT=/" if ENV.compiler == :llvm and MacOS.lion?
# Python note:
# OCIO's PyOpenColorIO.so doubles as a shared library. So it lives in lib, rather
# than the usual HOMEBREW_PREFIX/lib/python2.7/site-packages per developer choice.
if ARGV.include? '--with-python'
python_prefix = `python-config --prefix`.strip
if File.exist? "#{python_prefix}/Python"
# Python was compiled with --framework:
args << "-DPYTHON_LIBRARY='#{python_prefix}/Python'"
args << "-DPYTHON_INCLUDE_DIR='#{python_prefix}/Headers'"
else
python_version = `python-config --libs`.match('-lpython(\d+\.\d+)').captures.at(0)
python_lib = "#{python_prefix}/lib/libpython#{python_version}"
args << "-DPYTHON_INCLUDE_DIR='#{python_prefix}/include/python#{python_version}'"
if File.exists? "#{python_lib}.a"
args << "-DPYTHON_LIBRARY='#{python_lib}.a'"
else
args << "-DPYTHON_LIBRARY='#{python_lib}.dylib'"
end
end
else
args << "-DOCIO_BUILD_PYGLUE=OFF"
end
args << '..'
mkdir 'macbuild' do
system "cmake", *args
system "make"
system "make test" if ARGV.include? '--with-tests'
system "make install"
end
end
def caveats
<<-EOS.undent
OpenColorIO requires several environment variables to be set.
You can source the following script in your shell-startup to do that:
#{HOMEBREW_PREFIX}/share/ocio/setup_ocio.sh
Alternatively the documentation describes what env-variables need set:
http://opencolorio.org/installation.html#environment-variables
You will require a config for OCIO to be useful. Sample configuration files
and reference images can be found at:
http://opencolorio.org/downloads.html
EOS
end
end