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

R.setup             cran rspatial terra 1.7-83
revision            0
categories-append   gis
maintainers         {@barracuda156 gmail.com:vital.had} openmaintainer
license             GPL-3+
description         Spatial data analysis
long_description    {*}${description}
homepage            https://rspatial.org/terra
checksums           rmd160  39833550923817da79e251f274a9d2534a36c61d \
                    sha256  b32262be0b3a83cd7ad800c470b8128a6348d1fdcf3c8ba7583c0d3190b3c92b \
                    size    970353

set proj_v          proj9

depends_build-append \
                    path:bin/pkg-config:pkgconfig

depends_lib-append  path:lib/${proj_v}/lib/pkgconfig/proj.pc:${proj_v} \
                    port:gdal \
                    port:geos \
                    port:R-Rcpp \
                    port:sqlite3

compiler.cxx_standard 2017

# configure fails to do its job: https://github.com/r-spatial/sf/issues/2292
build.env-append    CPPFLAGS=-I${prefix}/lib/${proj_v}/include

build.args-append   --configure-args="--with-proj-include=${prefix}/lib/${proj_v}/include \
                        --with-proj-lib=${prefix}/lib/${proj_v}/lib \
                        --with-proj-share=${prefix}/lib/${proj_v}/share/proj"

depends_test-append port:R-deldir \
                    port:R-htmlwidgets \
                    port:R-leaflet \
                    port:R-ncdf4 \
                    port:R-sf \
                    port:R-tinytest \
                    port:R-XML

# For now, not enabled:
test.run            no
