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

set realname        proj
name                ${realname}8
version             8.2.1
revision            1
categories-append   gis
platforms           darwin
license             MIT

maintainers         {stromnov @stromnov} openmaintainer

description         PROJ is a generic coordinate transformation software

long_description    PROJ is a generic coordinate transformation software \
                    that transforms geospatial coordinates from one \
                    coordinate reference system (CRS) to another. This \
                    includes cartographic projections as well as \
                    geodetic transformations.

homepage            https://proj4.org/
master_sites        http://download.osgeo.org/proj/

distname            ${realname}-${version}

checksums           rmd160  7456023fdeb03f7d1c182fe67f617960ea3efede \
                    sha256  76ed3d0c3a348a6693dfae535e5658bbfd47f71cb7ff7eb96d9f12f7e068b1cf \
                    size    5882136

compiler.cxx_standard 2011

# error: return type 'const nn<[...]>' must match previous return type
# 'nn<[...]>' when lambda expression has unspecified explicit return type
compiler.blacklist-append {clang < 602}

depends_build-append \
                    port:pkgconfig

depends_lib-append  port:sqlite3 \
                    port:curl

configure.pre_args  --prefix=${prefix}/lib/proj8
configure.args      --mandir=${prefix}/lib/proj8/share/man \
                    --disable-tiff

variant tiff description {Enable TIFF I/O} {
    depends_lib-append      port:tiff
    configure.args-replace  --disable-tiff --enable-tiff
}

variant lto description {Enable Link Time Optimization} {
    configure.args-append   --enable-lto
}

variant native description {Optimize for speed} {
    configure.optflags      -O3 -pipe -march=native -DGDAL_COMPILATION
}

default_variants    +tiff

test.run            yes
test.target         check-local

livecheck.type      regex
livecheck.url       ${master_sites}
livecheck.regex     "${realname}-(8(?:\\.\\d+)*)${extract.suffix}"
