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

# GitHub version is old.
R.setup             cran r-spatial sf 1.0-17
revision            0
categories-append   math
maintainers         {@barracuda156 gmail.com:vital.had} openmaintainer
license             {GPL-2 MIT}
description         Simple features for R
long_description    {*}${description}
homepage            https://r-spatial.github.io/sf
checksums           rmd160  c71b0bc999c6bcc09a397542282d81cb91f5042e \
                    sha256  22c7c2d2e98a6142e4beff07e70c169238257312e6eb3591b129ed3c7d18b286 \
                    size    3802276

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-classInt \
                    port:R-DBI \
                    port:R-magrittr \
                    port:R-Rcpp \
                    port:R-s2 \
                    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 \
                        --with-sqlite3-lib=${prefix}/lib"

depends_test-append port:R-blob \
                    port:R-covr \
                    port:R-dplyr \
                    port:R-ggplot2 \
                    port:R-knitr \
                    port:R-lwgeom \
                    port:R-maps \
                    port:R-microbenchmark \
                    port:R-nanoarrow \
                    port:R-odbc \
                    port:R-pbapply \
                    port:R-pillar \
                    port:R-pool \
                    port:R-raster \
                    port:R-rlang \
                    port:R-rmarkdown \
                    port:R-RPostgres \
                    port:R-RPostgreSQL \
                    port:R-RSQLite \
                    port:R-sp \
                    port:R-stars \
                    port:R-terra \
                    port:R-testthat \
                    port:R-tibble \
                    port:R-tidyr \
                    port:R-tidyselect \
                    port:R-vctrs \
                    port:R-wk

# A number of dependencies are not in Macports yet.
test.run            no
