Files
2026-06-20 21:22:40 -04:00

229 lines
7.7 KiB
Tcl

# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
PortSystem 1.0
PortGroup github 1.0
PortGroup cmake 1.1
PortGroup ffmpeg 1.0
PortGroup active_variants 1.1
name openimageio
categories graphics
license BSD
maintainers {mcalhoun @MarcusCalhoun-Lopez} openmaintainer
description a library for reading and writing images
long_description OpenImageIO is a library for reading and writing images, and a bunch of \
related classes, utilities, and applications.
# Keep this condition the same in the opencolorio, openimageio, and osl ports.
set port_latest [expr {${os.platform} ne "darwin" || ${os.major} >= 20}]
if {${port_latest}} {
github.setup AcademySoftwareFoundation OpenImageIO 3.1.12.1 v
revision 2
checksums rmd160 53e7b27aff76d04581d3381067231d4cbef8c56b \
sha256 1083e8cd219f02d1d9baeeeb79edcc253cabdf318f57da40895acb2eef557cf9 \
size 54775625
} else {
github.setup AcademySoftwareFoundation OpenImageIO 2.1.20.0 v
revision 18
checksums rmd160 7f241baddcc6e731a29fb37090e4582953560f38 \
sha256 0ad46bda55d6357a3c474b8c8ccbb41d9732313247cffaf4a65fc50e6aad9e78 \
size 29116032
livecheck.type none
}
github.tarball_from archive
if {${port_latest}} {
depends_lib-append port:imath \
port:libxml2 \
port:openexr \
port:openvdb \
port:onetbb \
port:OpenJPH \
port:tcp_wrappers \
path:lib/libssl.dylib:openssl
ffmpeg.version 8
set port_libfmt libfmt12
cmake.prefix_path-prepend \
${prefix}/lib/${port_libfmt}/cmake
depends_lib-append port:${port_libfmt}
} else {
PortGroup boost 1.0
patchfiles-append patch-FindOpenJpeg.cmake.diff
patchfiles-append patch-libraw-0.21.0.diff
patchfiles-append patch-2.1.20-cmake-disable-wall-werror.diff
depends_lib-append port:field3d \
port:openexr2 \
port:squish \
port:tbb
configure.pkg_config_path-prepend \
${prefix}/libexec/openexr2/lib/pkgconfig
# https://trac.macports.org/ticket/69842
configure.args-append -DUSE_OPENVDB=OFF
#configure.args-append -DUSE_TBB=OFF
configure.args-append -DTBB_ROOT=${prefix}/libexec/tbb
#configure.args-append -DUSE_FFMPEG=OFF
depends_lib-append path:lib/libavcodec.dylib:ffmpeg
# NOTE: Ensure we prepend 'libfmt9', to include it before 'openexr2'
set port_libfmt libfmt9
cmake.prefix_path-prepend \
${prefix}/lib/${port_libfmt}/cmake
configure.args-append -DFMT_INCLUDE_DIR=${prefix}/include/${port_libfmt}
depends_lib-append port:${port_libfmt}
}
# error: multiple overloads of 'address' instantiate to the same signature 'const_pointer (const_reference) const noexcept'
# http://lists.llvm.org/pipermail/llvm-bugs/2013-November/031552.html
# Seen on OSX 10.9 and older.
compiler.blacklist-append {clang < 700}
# OpenVDB header files use C++17 features
compiler.cxx_standard 2017
configure.args-append -DCMAKE_CXX_STANDARD=17
compiler.thread_local_storage yes
# Use OpenGL framework instead of mesa
configure.pre_args-delete -DCMAKE_FIND_FRAMEWORK=LAST
configure.cxxflags-append \
-Wno-deprecated-declarations \
-Wno-unknown-warning-option
if {[string match *clang* ${configure.compiler}]} {
# This is a clang-specific flag:
configure.cxxflags-append \
-Wno-error=unknown-warning-option
}
# Don't treat clang warnings as errors
configure.args-append -DSTOP_ON_WARNINGS=OFF
# avoid
# ccache: error: Failed to create directory ${prefix}/var/macports/build/.ccache/tmp: Operation not permitted
configure.args-append -DUSE_CCACHE=OFF
# do not "Try to download and build any missing dependencies"
configure.args-append -DBUILD_MISSING_DEPS=OFF \
-DBUILD_MISSING_FMT=OFF
depends_build-append port:robin-map
depends_lib-append port:zlib \
port:bzip2 \
port:libpng \
port:tiff
# optional components
if {${os.platform} eq "darwin" && ${os.major} < 11} {
configure.args-append \
-DUSE_QT=OFF
# configure.args-append -DUSE_OPENGL=OFF
} else {
PortGroup qt6 1.0
}
if {[string match *gcc* ${configure.compiler}] \
&& ${configure.build_arch} in [list i386 ppc]} {
configure.ldflags-append \
-latomic
}
configure.args-append -DUSE_PYTHON=OFF
set pythons_suffixes {310 311 312 313 314}
set pythons_ports {}
foreach s ${pythons_suffixes} {
lappend pythons_ports python${s}
}
foreach s ${pythons_suffixes} {
set p python${s}
set v [string index ${s} 0].[string range ${s} 1 end]
set i [lsearch -exact ${pythons_ports} ${p}]
set c [lreplace ${pythons_ports} ${i} ${i}]
variant ${p} description "Build the Python ${v} bindings" conflicts {*}${c} "
depends_build-append port:pybind11
depends_lib-append port:${p} \
port:py${s}-numpy
configure.args-delete -DUSE_PYTHON=OFF
configure.args-append -DPYTHON_VERSION=${v} \
-DPYTHON_EXECUTABLE=${prefix}/bin/python${v} \
-DPYTHON_SITE_DIR=${frameworks_dir}/Python.framework/Versions/${v}/lib/python${v}
"
}
set set_python_default yes
foreach s ${pythons_suffixes} {
if {[variant_isset python${s}]} {
set set_python_default no
}
}
# this default version should stay synchronized with python_get_default_version
# in the python PortGroup
if {${set_python_default}} {
default_variants +python314
}
#configure.args-append -DUSE_JPEGTURBO=OFF
depends_lib-append path:include/turbojpeg.h:libjpeg-turbo \
#configure.args-append -DUSE_OPENJPEG=OFF
depends_lib-append port:openjpeg
configure.args-append -DOpenJpeg_ROOT=${prefix}
#configure.args-append -DUSE_OCIO=OFF
depends_lib-append port:opencolorio
set opencv_ver 4
if {${os.platform} eq "darwin" && ${os.major} < 11} {
# opencv4 does not build on 10.6 and earlier.
configure.args-append -DUSE_OPENCV=OFF
} else {
depends_lib-append path:lib/opencv${opencv_ver}/libopencv_core.dylib:opencv${opencv_ver}
configure.args-append -DOpenCV_INCLUDE_DIR=${prefix}/include/opencv${opencv_ver} \
-DOpenCV_ROOT=${prefix}/lib/opencv${opencv_ver}
}
#configure.args-append -DUSE_FREETYPE=OFF
depends_lib-append port:freetype
configure.args-append -DUSE_GIF=OFF
# depends_lib-append port:giflib
#configure.args-append -DUSE_HEIF=OFF
depends_lib-append port:libheif
#configure.args-append -DUSE_PTEX=OFF
depends_lib-append port:ptex
#configure.args-append -DUSE_LIBRAW=OFF
depends_lib-append port:libraw
# not in MacPorts
configure.args-append -DUSE_NUKE=OFF
#configure.args-append -DUSE_DICOM=OFF
depends_lib-append port:dcmtk
configure.args-append -DUSE_WEBP=OFF
# depends_lib-append port:webp
github.livecheck.regex {([0-9.]+)}