# -*- 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           xcodeversion 1.0
PortGroup           muniversal 1.0

name                tiff
version             4.7.1
revision            0

checksums           rmd160  36c031017d1ebbc0b314f875e1df38e918367870 \
                    sha256  f698d94f3103da8ca7438d84e0344e453fe0ba3b7486e04c5bf7a9a3fabe9b69 \
                    size    4000609

categories          graphics
maintainers         {ryandesign @ryandesign} openmaintainer
license             BSD

description         Library and tools for dealing with Tag Image File Format
long_description    \
    This software provides support for the Tag Image File       \
    Format (TIFF), a widely used format for storing image       \
    data.  Included in this software distribution is a          \
    library, libtiff, for reading and writing TIFF, a small     \
    collection of tools for doing simple manipulations of       \
    TIFF images on UNIX systems, documentation on the library   \
    and tools.  A small assortment of TIFF-related software     \
    for UNIX that has been contributed by others is also        \
    included.  The library is capable of dealing with images    \
    that are written to follow the 5.0 or 6.0 TIFF spec.        \
    There is also considerable support for some of the more     \
    esoteric portions of the 6.0 TIFF spec.

homepage            https://libtiff.gitlab.io/libtiff/
master_sites        https://download.osgeo.org/libtiff/ \
                    freebsd

depends_lib-append  port:lerc \
                    port:libdeflate \
                    path:include/turbojpeg.h:libjpeg-turbo \
                    port:xz \
                    port:zlib \
                    port:zstd

test.run            yes
test.target         check

compiler.c_standard 1999

configure.args      --disable-jbig \
                    --disable-webp \
                    --with-x=no \
                    --with-docdir=${prefix}/share/doc/${name} \
                    --with-jpeg-include-dir=${prefix}/include \
                    --with-jpeg-lib-dir=${prefix}/lib \
                    --with-lerc-include-dir=${prefix}/include \
                    --with-lerc-lib-dir=${prefix}/lib \
                    --with-libdeflate-include-dir=${prefix}/include \
                    --with-libdeflate-lib-dir=${prefix}/lib \
                    --with-lzma-include-dir=${prefix}/include \
                    --with-lzma-lib-dir=${prefix}/lib \
                    --with-zlib-include-dir=${prefix}/include \
                    --with-zlib-lib-dir=${prefix}/lib \
                    --with-zstd-include-dir=${prefix}/include \
                    --with-zstd-lib-dir=${prefix}/lib

use_parallel_build  yes

minimum_xcodeversions {9 3.1}

set merger_dont_diff ${prefix}/include/tiffconf.h

variant jbig description {Enable JBIG support} {
    depends_lib-append      port:jbigkit
    configure.args-replace  --disable-jbig --enable-jbig
    configure.args-append   --with-jbig-include-dir=${prefix}/include \
                            --with-jbig-lib-dir=${prefix}/lib
}

livecheck.type  regex
livecheck.url   [lindex ${master_sites} 0]
livecheck.regex "${name}-(\\d+(?:\\.\\d+)*)${extract.suffix}"
