Skip to content
This repository has been archived by the owner on Jul 4, 2023. It is now read-only.

Commit

Permalink
openimageio: Update to 1.0.3
Browse files Browse the repository at this point in the history
Updates openimageio to version 1.0.3.
Fix compilation against glew.
Fix compilation against qt.
Fix building of iv.
Add all deps to maximize the filetypes oiio can open.
Add a dep on a new formula, field3d.
Add a dep on a new formula, opencolorio.
Build iv & the python bindings.
Run the official testsuite if the user options it.

This compiles without error using llvm-2335.9, clang-2.0.139,
and gcc-4.2.1.5666 from XCode-4.0.2 on 64bit Snow Leopard.
It compiles without error using llvm-2336.9 and clang-3.1.318
on Lion 10.7.3 using XCode-4.3.1.

As of 1.0.3 all tests pass make test.

EDIT: add an include for zlib.h on Lion.
EDIT: switches tarball to 0.10.4, compiles on Lion, same xfails
      in the testsuite (that only exists as a master on github).
EDIT: change the oiio-images url to a fixed commit tarball not
      the master trunk tarball.
EDIT: add def initialize to oiio-images subformula to trigger
      Homebrew's cache naming scheme, gets us oiioimages-1.0.0.tgz
EDIT: Change version to 0.10.5.  Remove patch for boost-mt naming
      because it works now.  Still needs zlib patch, been reported.
      Both previous test fails are fixed.  There is a new one.
EDIT: Inline the d variable.
EDIT: Remove HR, shorten option.
EDIT: Move inline patch to a DATA block.
EDIT: Change to version 0.10.6.
EDIT: Change to version 1.0.0.  Add devel block.
EDIT: Remove patch merged upstream.
EDIT: Fix python bindings to mimic vtk.rb.
EDIT: Add a dep on new formula OpenColorIO (ocio).
EDIT: Add a dep on webp.
EDIT: Remove illogical `which python-config` test.
EDIT: Add a fixed commit from branch RB-1.0 as the devel block url.
EDIT: Remove hard coded path to openjpeg.  Determine it instead.
EDIT: Upgrade to 1.0.2.  Shorten some comments.
EDIT: Remove code to find OpenJpeg.  It just works now.
EDIT: Add head url.  Remove Doxygen dep.  It already makes a pdf.
EDIT: Remove python option.  Just let it build that (10sec extra).
EDIT: Upgrade stable to 1.0.3, devel to 1.0.3a (bugfxes).
EDIT: Add back the oiio alias I clobbered.
  • Loading branch information
Nibbles 2bits committed Apr 19, 2012
1 parent 8392df5 commit 4558db1
Show file tree
Hide file tree
Showing 2 changed files with 140 additions and 19 deletions.
1 change: 1 addition & 0 deletions Library/Aliases/oiio
158 changes: 139 additions & 19 deletions Library/Formula/openimageio.rb
Original file line number Diff line number Diff line change
@@ -1,35 +1,155 @@
require 'formula'

class J2kp4files < Formula
url 'http://pkgs.fedoraproject.org/repo/pkgs/openjpeg/j2kp4files_v1_5.zip/27780ed3254e6eb763ebd718a8ccc340/j2kp4files_v1_5.zip'
md5 '27780ed3254e6eb763ebd718a8ccc340'
end

class Tiffpic < Formula
url 'ftp://ftp.remotesensing.org/pub/libtiff/pics-3.8.0.tar.gz'
sha1 'f50e14335fd98f73c6a235d3ff4d83cf4767ab37'
end

class Bmpsuite < Formula
url 'http://entropymine.com/jason/bmpsuite/bmpsuite.zip'
sha1 '2e43ec4d8e6f628f71a554c327433914000db7ba'
version '1.0.0'
end

class Tgautils < Formula
url 'http://makseq.com/materials/lib/Code/FileFormats/BitMap/TARGA/TGAUTILS.ZIP'
sha1 '0902c51e7b00ae70a460250f60d6adc41c8095df'
version '1.0.0'
end

class OpenexrImages < Formula
url 'http://download.savannah.nongnu.org/releases/openexr/openexr-images-1.5.0.tar.gz'
sha1 '22bb1a3d37841a88647045353f732ceac652fd3f'
end

class OiioImages < Formula
url 'https://github.com/OpenImageIO/oiio-images/tarball/9bf43561f5'
sha1 '8f12a86098120fd10ceb294a0d3aa1c95a0d3f80'
version '1.0.0'
def initialize; super "oiioimages"; end
end


class Openimageio < Formula
url 'https://github.com/OpenImageIO/oiio/tarball/Release-0.9.0'
md5 'b9dc646c57c2137d7a9fe8bbb91e0ae7'
homepage 'http://openimageio.org'
url 'https://github.com/OpenImageIO/oiio/tarball/Release-1.0.3'
sha1 '69919017a9fbc716d593eb508d04ea46626e96ed'

head 'https://github.com/OpenImageIO/oiio.git'

devel do
# This is the RB-1.0 development branch as of 18 APR 2012.
# The version number is artificial. Use it to name the cache tarball.
# Increment the letter when pointing to a more recent commit.
url 'https://github.com/OpenImageIO/oiio/tarball/dffc74eb53'
sha1 '8a7ce8ef82a0c53c4d0398d9e8c2e7c2861b5cf4'
version '1.0.3a'
end

depends_on 'cmake' => :build
depends_on 'pkg-config' => :build
depends_on 'opencolorio'
depends_on 'ilmbase'
depends_on 'openexr'
depends_on 'boost'
depends_on 'libtiff'
depends_on 'jpeg'
depends_on 'openjpeg'
depends_on 'cfitsio'
depends_on 'hdf5'
depends_on 'field3d'
depends_on 'webp'
depends_on 'glew'
depends_on 'qt'

# build plugins
depends_on 'libtiff' => :optional
depends_on 'jpeg' => :optional
depends_on 'jasper' => :optional
def options
[['--with-tests', 'Dowload 95MB of test images and verify Oiio (~2 min).']]
end

# Qt linking, to build iv, is not currently working.
# Would need qt and glew as deps for this.
def install
# Oiio is designed to have its testsuite images extracted one directory
# above the source. That's not a safe place for HB. Do the opposite,
# and move the entire source down into a subdirectory if --with-tests.
if ARGV.include? '--with-tests' then
(buildpath+'localpub').install Dir['*']
chdir 'localpub'
end

depends_on 'tbb' => :optional
ENV.append 'MY_CMAKE_FLAGS', "-Wno-dev" # stops a warning.
args = ["USE_TBB=1", "EMBEDPLUGINS=1"]

def install
# Allow compilation against boost 1.46.0
# See https://github.com/OpenImageIO/oiio/issues/37
inreplace "src/libOpenImageIO/imageioplugin.cpp",
"#include <boost/filesystem.hpp>",
"#define BOOST_FILESYSTEM_VERSION 2\n#include <boost/filesystem.hpp>"

# Add include path for libpng explicitly
system "cmake src/ #{std_cmake_parameters} -DUSE_QT:BOOL=OFF -DEMBEDPLUGINS:BOOL=ON -DCMAKE_CXX_FLAGS=-I/usr/X11/include"
system "make install"

python_prefix = `python-config --prefix`.strip
# Python is actually a library. The libpythonX.Y.dylib points to this lib, too.
if File.exist? "#{python_prefix}/Python"
# Python was compiled with --framework:
ENV.append 'MY_CMAKE_FLAGS', "-DPYTHON_LIBRARY='#{python_prefix}/Python'"
ENV.append 'MY_CMAKE_FLAGS', "-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}"
ENV.append 'MY_CMAKE_FLAGS', "-DPYTHON_INCLUDE_DIR='#{python_prefix}/include/python#{python_version}'"
if File.exists? "#{python_lib}.a"
ENV.append 'MY_CMAKE_FLAGS', "-DPYTHON_LIBRARY='#{python_lib}.a'"
else
ENV.append 'MY_CMAKE_FLAGS', "-DPYTHON_LIBRARY='#{python_lib}.dylib'"
end
end


# Download standardized test images if the user throws --with-tests.
# 90% of the images are in tarballs, so they are cached normally.
# The webp and fits images are loose. Curl them each install.
if ARGV.include? '--with-tests' then
d = buildpath
mkdir d+'webp-images' do
curl "http://www.gstatic.com/webp/gallery/[1-5].webp", "-O"
end
mkdir d+'fits-images'
mkdir d+'fits-images/pg93' do
curl "http://www.cv.nrao.edu/fits/data/tests/pg93/tst000[1-3].fits", "-O"
curl "http://www.cv.nrao.edu/fits/data/tests/pg93/tst000[5-9].fits", "-O"
curl "http://www.cv.nrao.edu/fits/data/tests/pg93/tst0013.fits", "-O"
end
mkdir d+'fits-images/ftt4b' do
curl "http://www.cv.nrao.edu/fits/data/tests/ftt4b/file00[1-3].fits", "-O"
curl "http://www.cv.nrao.edu/fits/data/tests/ftt4b/file0{09,12}.fits", "-O"
end
J2kp4files.new.brew { (d+'j2kp4files_v1_5').install Dir['J2KP4files/*'] }
Tiffpic.new.brew { (d+'libtiffpic').install Dir['*'] }
Bmpsuite.new.brew { (d+'bmpsuite').install Dir['*'] }
Tgautils.new.brew { (d+'TGAUTILS').install Dir['*'] }
OpenexrImages.new.brew { (d+'openexr-images-1.5.0').install Dir['*'] }
OiioImages.new.brew { (d+'oiio-images').install Dir['*'] }
end


# make is a shell wrapper for cmake crafted by the devs (who have Lion).
system "make", *args
system "make test" if ARGV.include? '--with-tests'
# There is no working make install in 1.0.2, devel or HEAD.
Dir.chdir 'dist/macosx' do
(lib + which_python ).install 'lib/python/site-packages'
prefix.install %w[ bin include ]
lib.install Dir[ 'lib/lib*' ]
doc.install 'share/doc/openimageio/openimageio.pdf'
prefix.install Dir['share/doc/openimageio/*']
end
end

def caveats; <<-EOS.undent
If OpenImageIO is brewed using non-homebrew Python, then you need to amend
your PYTHONPATH like so:
export PYTHONPATH=#{HOMEBREW_PREFIX}/lib/#{which_python}/site-packages:$PYTHONPATH
EOS
end

def which_python
"python" + `python -c 'import sys;print(sys.version[:3])'`.strip
end
end

0 comments on commit 4558db1

Please sign in to comment.