# -*- 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                       cmake           1.1
PortGroup                       github          1.0
PortGroup                       legacysupport   1.1

github.setup                    AcademySoftwareFoundation openexr 3.4.10 v
github.tarball_from             releases
revision                        0

checksums                       rmd160  17d4cc31c53ea035cbbc853efc52f1ace6fb7cd4 \
                                sha256  2e054a8f5030c25d1585cbfa537feaaf86d69388b75c00d96c3a91f676e88cbe \
                                size    25750984

categories                      graphics
license                         BSD
maintainers                     {mcalhoun @MarcusCalhoun-Lopez} {mascguy @mascguy} openmaintainer

description                     OpenEXR Graphics Library
long_description                OpenEXR is the professional-grade high dynamic range image \
                                storage format of the motion picture industry.
homepage                        https://www.openexr.com

# Python only used for tests
set py_ver                      3.14
set py_ver_nodot                [string map {. {}} ${py_ver}]

# std::filesystem
legacysupport.newest_darwin_requires_legacy 18
legacysupport.use_mp_libcxx     yes

if { (!(${universal_possible} && [variant_isset universal]) && ${configure.build_arch} eq "ppc")
     ||
     ((${universal_possible} && [variant_isset universal]) && "ppc" in ${configure.universal_archs}) } {
    # see description in patch file; bug in GCC, fixed in current branches, but not backported yet:
    # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110044
    patchfiles-append           patch-ensure_pack.diff
}

depends_build-append            port:pkgconfig
depends_lib-append              port:imath \
                                port:libdeflate \
                                port:OpenJPH

compiler.cxx_standard           2017

configure.args-append           -DBUILD_TESTING=OFF \
                                -DOPENEXR_BUILD_PYTHON=OFF

variant tests description {Enable test support} {
    depends_build-append        port:python${py_ver_nodot}

    configure.args-replace      -DBUILD_TESTING=OFF \
                                -DBUILD_TESTING=ON

    test.run                    yes
    test.target                 test
}

# only allow numbers, to avoid pre-release versions
github.livecheck.regex          {([0-9.]+)}
