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

name                exact-image
version             1.2.1
revision            1
checksums           rmd160  6173ca9b71b4088f38eee05ff4a254888e97532e \
                    sha256  7843cf35db40f3a2caed3d0b11256e226ef16169244ca2dc1c89af86ac8a148a \
                    size    320849

categories          graphics
license             GPL-2
maintainers         {ryandesign @ryandesign} openmaintainer

description         a fast, modern and generic image processing library

long_description    ExactImage is ${description}.

homepage            http://exactcode.com/opensource/exactimage/
master_sites        http://dl.exactcode.de/oss/exact-image/
use_bzip2           yes

patchfiles-append   patch-compiler.diff
patchfiles-append   patch-no_fast.diff
patchfiles-append   patch-cflags-cxxflags.diff
patchfiles-append   patch-static-library-ar.diff
patchfiles-append   patch-save-config.log.diff
patchfiles-append   patch-codecs-jpeg2000.diff

depends_build       path:bin/pkg-config:pkgconfig

depends_lib         port:antigraingeometry \
                    port:expat \
                    port:jasper2 \
                    port:libheif \
                    port:libpng \
                    port:lcms \
                    port:openexr \
                    port:tiff

configure.args      --with-expat \
                    --with-freetype \
                    --with-jasper \
                    --with-lcms \
                    --with-libjpeg \
                    --with-libheif \
                    --with-libpng \
                    --with-libtiff \
                    --with-openexr \
                    --without-bardecode \
                    --without-evas \
                    --without-libgif \
                    --without-libjxl \
                    --without-lua \
                    --without-perl \
                    --without-php \
                    --without-python \
                    --without-ruby \
                    --without-swig \
                    --without-x11

configure.universal_args-delete --disable-dependency-tracking

# see https://lists.macports.org/pipermail/macports-dev/2018-November/thread.html#39694
configure.post_args-append " && printenv >> config.make"

# Search MacPorts includes after project includes, not before. The build system
# appends to CPPFLAGS rather than prepending; this is easier than fixing the
# build system.
configure.cppflags-replace -I${prefix}/include -isystem${prefix}/include

# Find jasper2
configure.cppflags-prepend -isystem${prefix}/libexec/jasper2/include
configure.ldflags-prepend   -L${prefix}/libexec/jasper2/lib

# OpenEXR requires C++11
compiler.cxx_standard       2011
configure.cxxflags-append   -std=gnu++11

# Disable silent rules.
build.args          Q=

post-destroot {
    set docdir ${prefix}/share/doc/${subport}
    xinstall -d ${destroot}${docdir}
    xinstall -m 0644 -W ${worksrcpath} \
        LICENSE \
        README \
        TODO \
        ${destroot}${docdir}
}

livecheck.type      regex
livecheck.url       [lindex ${master_sites} 0]
livecheck.regex     ${name}-(\[0-9.\]+)${extract.suffix}
