homebrew-core/Formula/openimageio.rb

95 lines
3.1 KiB
Ruby

class Openimageio < Formula
desc "Library for reading, processing and writing images"
homepage "https://openimageio.org/"
url "https://github.com/OpenImageIO/oiio/archive/v2.4.7.1.tar.gz"
sha256 "fd298f71e44c6776863db4b37c4a1388dba0d2eb37378afea95ab07a7cd6ecd4"
license "BSD-3-Clause"
head "https://github.com/OpenImageIO/oiio.git", branch: "master"
livecheck do
url :stable
strategy :github_latest
regex(%r{href=.*?/tag/(?:Release[._-])?v?(\d+(?:\.\d+)+)["' >]}i)
end
bottle do
sha256 cellar: :any, arm64_ventura: "abb7788503d45d6a3ed60f34c9412ca74a23e656514c8aec254b0f506184be5c"
sha256 cellar: :any, arm64_monterey: "5f9958d20263e42df8fd566c7cb5be96a3d69015665a5bf5ad8a18849f78138f"
sha256 cellar: :any, arm64_big_sur: "654b187c02ddcd8865c24ad26c820864695690df732abab7fd0560afd9aeb453"
sha256 cellar: :any, ventura: "28b1e84a84505f01c6cd8aec9416320b69cb044255e378a197340a449dd678dd"
sha256 cellar: :any, monterey: "9ef0a0e36a812902d8789dd1d2f975950ecaf4205da5357bfc35e143dfb475fd"
sha256 cellar: :any, big_sur: "42b681b535b3d65ccc2c12028881f6065444250f2a5aac11ab0f74c5029b26b9"
sha256 cellar: :any_skip_relocation, x86_64_linux: "08b1fa694a4257d5b828e5f46453194bd4d476a847b4b086252d3c8edcb65860"
end
depends_on "cmake" => :build
depends_on "pkg-config" => :build
depends_on "boost"
depends_on "boost-python3"
depends_on "ffmpeg"
depends_on "fmt"
depends_on "freetype"
depends_on "giflib"
depends_on "imath"
depends_on "jpeg-turbo"
depends_on "libheif"
depends_on "libpng"
depends_on "libraw"
depends_on "libtiff"
depends_on "opencolorio"
depends_on "openexr"
depends_on "pugixml"
depends_on "pybind11"
depends_on "python@3.11"
depends_on "webp"
# https://github.com/OpenImageIO/oiio/blob/master/INSTALL.md
fails_with :gcc do
version "5"
cause "Requires GCC 6.1 or later"
end
def python3
"python3.11"
end
def install
py3ver = Language::Python.major_minor_version python3
ENV["PYTHONPATH"] = prefix/Language::Python.site_packages(python3)
args = %W[
-DPython_EXECUTABLE=#{which(python3)}
-DPYTHON_VERSION=#{py3ver}
-DBUILD_MISSING_FMT=OFF
-DCCACHE_FOUND=
-DEMBEDPLUGINS=ON
-DOIIO_BUILD_TESTS=OFF
-DUSE_EXTERNAL_PUGIXML=ON
-DUSE_JPEGTURBO=ON
-DUSE_NUKE=OFF
-DUSE_OPENCV=OFF
-DUSE_OPENGL=OFF
-DUSE_OPENJPEG=OFF
-DUSE_PTEX=OFF
-DUSE_QT=OFF
]
system "cmake", "-S", ".", "-B", "build", *args, *std_cmake_args
system "cmake", "--build", "build"
system "cmake", "--install", "build"
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.major_minor_patch.to_s, pipe_output(python3, output, 0)
end
end