# -*- 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 r-spatial stars 0.6-7
revision            0
categories-append   math
platforms           {darwin any}
maintainers         {@barracuda156 gmail.com:vital.had} openmaintainer
license             Apache
description         Spatiotemporal arrays, raster and vector data cubes
long_description    {*}${description}
homepage            https://r-spatial.github.io/stars
checksums           rmd160  aa8f79466ae9852ed8d8c023550c7d192dfb8796 \
                    sha256  238acbd32d38fca4bf4b66cdcdeb7596e7163c27739a62a0fdebb593a3928e1f \
                    size    4033515
supported_archs     noarch

depends_lib-append  port:R-abind \
                    port:R-classInt \
                    port:R-rlang \
                    port:R-sf \
                    port:R-units

# Notice that several tests imply that GDAL has been built with NetCDF support,
# which is not the case in MacPorts by default. Related tests will fail.
# https://github.com/r-spatial/stars/issues/692
# https://github.com/r-spatial/stars/issues/693
# mdim test fails regardless, remove it for now.
post-extract {
    delete ${worksrcpath}/tests/mdim.R
}

# Some optional test deps are omitted.
depends_test-append port:R-Cairo \
                    port:R-clue \
                    port:R-covr \
                    port:R-cubble \
                    port:R-cubelyr \
                    port:R-digest \
                    port:R-dplyr \
                    port:R-exactextractr \
                    port:R-FNN \
                    port:R-future.apply \
                    port:R-ggforce \
                    port:R-ggplot2 \
                    port:R-ggthemes \
                    port:R-gstat \
                    port:R-httr \
                    port:R-jsonlite \
                    port:R-knitr \
                    port:R-lwgeom \
                    port:R-maps \
                    port:R-mapdata \
                    port:R-ncdfgeom \
                    port:R-ncmeta \
                    port:R-pbapply \
                    port:R-PCICt \
                    port:R-plm \
                    port:R-randomForest \
                    port:R-raster \
                    port:R-rmarkdown \
                    port:R-RNetCDF \
                    port:R-sp \
                    port:R-spacetime \
                    port:R-spatstat \
                    port:R-spatstat.geom \
                    port:R-terra \
                    port:R-testthat \
                    port:R-tibble \
                    port:R-tidyr \
                    port:R-tsibble \
                    port:R-viridis \
                    port:R-xts \
                    port:R-zoo

test.run            yes
# Vignettes do not run due to a broken R BATCH:
# https://trac.macports.org/ticket/67059
test.args-append    --ignore-vignettes

# GDAL is used via R-sf, it is not a direct dependency,
# but how it is installed matters.
notes "
Some funtionality needs GDAL to be installed with +netcdf variant.
"
