homebrew-core/Formula/openimageio.rb

88 lines
2.9 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.3.19.0.tar.gz"
sha256 "602c146aebee775f123459a6c6be753054144b8d82777de26965f2cc3e88113a"
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_monterey: "74def36d2f11cb0a1051b7db10877c6324b83ed80d224de342616a9548833344"
sha256 cellar: :any, arm64_big_sur: "e8ebb9eadd2b507209bfa72656aacce8953426965d0a32259a7aa0fd73edaf8c"
sha256 cellar: :any, monterey: "91bee54ac1673ad686d8c10378ecd314c683b351fc7246591a77dc2262f55b06"
sha256 cellar: :any, big_sur: "84e5f617bfb35d3b3ea62234fa83a64be0042a2547c763694caa4dafed58ff31"
sha256 cellar: :any, catalina: "3499494ff4e4826e07f514aaff8e5f61fa55764dc561dc340e5bdf0af843b37e"
sha256 cellar: :any_skip_relocation, x86_64_linux: "e2cb1314425bad8bd3a2672d57109d405f1b62633db68d44819cbf787c77ddaf"
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.10"
depends_on "webp"
fails_with gcc: "5" # ffmpeg is compiled with GCC
def install
python3 = which("python3.10")
py3ver = Language::Python.major_minor_version python3
ENV["PYTHONPATH"] = prefix/Language::Python.site_packages(python3)
args = %W[
-DPython_EXECUTABLE=#{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
python = Formula["python@3.10"].opt_bin/"python3.10"
assert_match version.major_minor_patch.to_s, pipe_output(python, output, 0)
end
end