# -*- 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.7 v
revision                        0
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
checksums           rmd160  53e15e67416a54c90125ca439559bdf44dfbd512 \
                    sha256  3744624362dbe6d13985fc73cd67d1ccaa8d0dea97318d27a6dfd5804cdefef5 \
                    size    25726127
github.tarball_from             archive

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

# NOTE: legacysupport needed for 'sys/fcntl.h'
legacysupport.newest_darwin_requires_legacy 12
platform darwin {
    # Also need macports-libcxx for 10.7/10.8
    if { (${os.major} >= 11) && (${os.major} <= 12) } {
        legacysupport.use_mp_libcxx         yes
    }
}

patchfiles-append               patch-re-enable-dispatch-on-10.6-powerpc.diff

depends_build-append            path:bin/pkg-config:pkgconfig
depends_lib-append              port:imath \
                                port:libdeflate \
                                port:openjph

compiler.cxx_standard           2014

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.]+)}
