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

name                proj
version             5.2.0
set datumgrid_version   1.8
categories          gis
platforms           darwin
license             MIT
maintainers         nomaintainer

description         PROJ - Cartographic Projections Library
long_description    PROJ is a library for converting data between \
                    cartographic projections.
homepage            http://trac.osgeo.org/proj/

master_sites        http://download.osgeo.org/proj/
distfiles-append    ${name}-datumgrid-${datumgrid_version}.zip
checksums           ${name}-${version}.tar.gz \
                    rmd160  d99eccff181bb002dd0e398a69fb26cbf57fc4d6 \
                    sha256  ef919499ffbc62a4aae2659a55e2b25ff09cccbbe230656ba71c6224056c7e60 \
                    size    1398188 \
                    proj-datumgrid-${datumgrid_version}.zip \
                    rmd160  f84c374f85c1314c7e357fd50683b67767cea358 \
                    sha256  b9838ae7e5f27ee732fb0bfed618f85b36e8bb56d7afb287d506338e9f33861e \
                    size    6601640

extract.only        ${name}-${version}.tar.gz

post-extract {
    set datumgrid ${distpath}/${name}-datumgrid-${datumgrid_version}.zip
    system "unzip '$datumgrid' -d '${worksrcpath}/nad'"
}

pre-destroot {
    file copy ${worksrcpath}/src/projects.h ${destroot}${prefix}/include
}

compiler.cxx_standard   2011

configure.pre_args  --prefix=${prefix}/lib/proj5
configure.args      --mandir=${prefix}/share/man

post-destroot {
    xinstall -m 644 ${worksrcpath}/src/projects.h ${destroot}${prefix}/include/
}

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