# -*- 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             github r-spatial lwgeom 304022fee6bc91e0641dabedfa631971b41a463f
version             0.2-15
revision            0
categories-append   math gis
maintainers         {@barracuda156 gmail.com:vital.had} openmaintainer
license             GPL-2
description         Bindings to selected liblwgeom functions for simple features
long_description    {*}${description}
checksums           rmd160  0bb84b64644f6ec978f4072c14ed04708fb6a4bd \
                    sha256  7d11ead7e3290a00b62523ae980f2fd82e3c0fca83b4b85c5a29edd19fc96d80 \
                    size    467655
github.tarball_from archive

set proj_v          proj9

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

# 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-covr \
                    port:R-geosphere \
                    port:R-sp \
                    port:R-testthat

# Disable for now, need to find a less ugly way to pass args to testing than hard-patching configure.
test.run            no
