# -*- 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
# $Id: Portfile 104189 2013-03-20 13:08:23Z stromnov@macports.org $

PortSystem          1.0
PortGroup           xcodeversion 1.0
PortGroup           muniversal 1.0

name                tiff
version             4.0.3
revision            1
categories          graphics
platforms           darwin
license             BSD

maintainers         nomaintainer

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            http://www.remotesensing.org/libtiff
master_sites        http://download.osgeo.org/libtiff/ \
                    ftp://ftp.remotesensing.org/pub/libtiff/ \
                    http://dl.maptools.org/dl/libtiff/ \
                    freebsd

checksums           rmd160  eacd725fb3c299682c1c2e508049d98acd170f31 \
                    sha256  ea1aebe282319537fb2d4d7805f478dd4e0e05c33d0928baba76a7c963684872

depends_lib         port:jpeg \
                    port:xz \
                    port:zlib

test.run            yes
test.target         check

configure.args      --disable-jbig \
                    --with-docdir=${prefix}/share/doc/${name} \
                    --with-jpeg-include-dir=${prefix}/include \
                    --with-jpeg-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

configure.ldflags-append \
                    -headerpad_max_install_names

use_parallel_build  yes

platform macosx {
    # Tiger does not have 64-bit OpenGL.
    if {${os.major} > 8 || (![variant_isset universal] && ![string match *64* $build_arch])
        || ([variant_isset universal] && ![string match *64* $universal_archs])} {
        configure.args-append   --with-apple-opengl-framework
    }
}

minimum_xcodeversions {9 3.1}

# tools/tiffgt.c incorrectly uses HAVE_APPLE_OPENGL_FRAMEWORK rather than HAVE_OPENGL_GL_H
configure.cppflags-append \
                    -DHAVE_APPLE_OPENGL_FRAMEWORK

variant jbig description {Enable JBIG support} {
    depends_lib-append      port:jbigkit
    configure.args-delete   --disable-jbig
    configure.args-append   --enable-jbig
}

livecheck.type  regex
livecheck.url   http://www.remotesensing.org/libtiff/
livecheck.regex {v(\d+(?:\.\d+)*)</a>}
