# -*- 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

name                            openexr2
github.setup                    AcademySoftwareFoundation openexr 2.5.10 v
subport ${name} {
    revision                    0
}
subport ilmbase {
    revision                    0
}
subport openexr_viewers {
    revision                    0
}

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

description                     OpenEXR Graphics Library
long_description                OpenEXR is a high dynamic-range (HDR) image file format developed \
                                by Industrial Light & Magic for use in computer imaging applications.
homepage                        https://www.openexr.com

checksums                       rmd160  c82a4fe2caf1ebce188c174a79a857365ff01cf1 \
                                sha256  c081fd982a1ba960f0faf41f152ffa035e1fbb071283ce10424116874fc8ce48 \
                                size    27539266
github.tarball_from             archive

subport ${name} {
    cmake.source_dir            ${worksrcpath}/OpenEXR
    cmake.install_prefix        ${prefix}/libexec/${name}
}

subport ilmbase {
    cmake.source_dir            ${worksrcpath}/IlmBase
    cmake.install_prefix        ${prefix}/libexec/${name}
}

subport openexr_viewers {
    cmake.source_dir            ${worksrcpath}/OpenEXR_Viewers

    cmake.module_path-append    ${prefix}/libexec/openexr2/lib/cmake
}

compiler.cxx_standard           2014

subport ${name} {
    depends_lib-append          port:ilmbase \
                                port:zlib

    # which upgrading, do not find old header files and libraries
    # see #51470 for MacPorts report
    # see https://github.com/openexr/openexr/issues/130 for upstream report
    #patchfiles-append           patch-search_order.diff
    configure.ldflags-delete    -L${prefix}/lib
}

subport openexr_viewers {
    depends_lib-append          port:openexr2 \
                                path:lib/libfltk.dylib:fltk
}

test.run                        yes
test.cmd                        ctest

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