86 lines
2.8 KiB
Ruby
86 lines
2.8 KiB
Ruby
class Openimageio < Formula
|
|
desc "Library for reading, processing and writing images"
|
|
homepage "https://openimageio.org/"
|
|
url "https://github.com/OpenImageIO/oiio/archive/Release-2.1.17.0.tar.gz"
|
|
version "2.1.17"
|
|
sha256 "6f20536226f1da4fbf0d522815de47eef60a443f9b67a15705b96c34cc8921a7"
|
|
head "https://github.com/OpenImageIO/oiio.git"
|
|
|
|
bottle do
|
|
sha256 "8d14eddacdafeb822d0b8cbfaf9c74fb82742834017ca1ad8f8eff61792426d3" => :catalina
|
|
sha256 "f64239c6986e07b4a16eb1e38da4228fedf460c83b5d90a147368589768f7612" => :mojave
|
|
sha256 "689597d81d0bed355b92881316ff69cfb49320360f3e6627c235e4e74330c90d" => :high_sierra
|
|
end
|
|
|
|
depends_on "cmake" => :build
|
|
depends_on "pkg-config" => :build
|
|
depends_on "boost"
|
|
depends_on "boost-python3"
|
|
depends_on "ffmpeg"
|
|
depends_on "freetype"
|
|
depends_on "giflib"
|
|
depends_on "ilmbase"
|
|
depends_on "jpeg"
|
|
depends_on "libheif"
|
|
depends_on "libpng"
|
|
depends_on "libraw"
|
|
depends_on "libtiff"
|
|
depends_on "opencolorio"
|
|
depends_on "openexr"
|
|
depends_on "python@3.8"
|
|
depends_on "webp"
|
|
|
|
def install
|
|
args = std_cmake_args + %w[
|
|
-DCCACHE_FOUND=
|
|
-DEMBEDPLUGINS=ON
|
|
-DUSE_FIELD3D=OFF
|
|
-DUSE_JPEGTURBO=OFF
|
|
-DUSE_NUKE=OFF
|
|
-DUSE_OPENCV=OFF
|
|
-DUSE_OPENGL=OFF
|
|
-DUSE_OPENJPEG=OFF
|
|
-DUSE_PTEX=OFF
|
|
-DUSE_QT=OFF
|
|
]
|
|
|
|
# CMake picks up the system's python dylib, even if we have a brewed one.
|
|
py3ver = Language::Python.major_minor_version Formula["python@3.8"].opt_bin/"python3"
|
|
py3prefix = Formula["python@3.8"].opt_frameworks/"Python.framework/Versions/#{py3ver}"
|
|
|
|
ENV["PYTHONPATH"] = lib/"python#{py3ver}/site-packages"
|
|
|
|
args << "-DPYTHON_EXECUTABLE=#{py3prefix}/bin/python3"
|
|
args << "-DPYTHON_LIBRARY=#{py3prefix}/lib/libpython#{py3ver}.dylib"
|
|
args << "-DPYTHON_INCLUDE_DIR=#{py3prefix}/include/python#{py3ver}"
|
|
|
|
# CMake picks up boost-python instead of boost-python3
|
|
args << "-DBOOST_ROOT=#{Formula["boost"].opt_prefix}"
|
|
boost_lib = Formula["boost-python3"].opt_lib
|
|
py3ver_without_dots = py3ver.to_s.delete(".")
|
|
args << "-DBoost_PYTHON_LIBRARIES=#{boost_lib}/libboost_python#{py3ver_without_dots}-mt.dylib"
|
|
|
|
# This is strange, but must be set to make the hack above work
|
|
args << "-DBoost_PYTHON_LIBRARY_DEBUG=''"
|
|
args << "-DBoost_PYTHON_LIBRARY_RELEASE=''"
|
|
|
|
mkdir "build" do
|
|
system "cmake", "..", *args
|
|
system "make", "install"
|
|
end
|
|
end
|
|
|
|
test do
|
|
test_image = test_fixtures("test.jpg")
|
|
assert_match "#{test_image} : 1 x 1, 3 channel, uint8 jpeg",
|
|
shell_output("#{bin}/oiiotool --info #{test_image} 2>&1")
|
|
|
|
output = <<~EOS
|
|
from __future__ import print_function
|
|
import OpenImageIO
|
|
print(OpenImageIO.VERSION_STRING)
|
|
EOS
|
|
assert_match version.to_s, pipe_output(Formula["python@3.8"].opt_bin/"python3", output, 0)
|
|
end
|
|
end
|