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

# Revert to GitHub once updated there.
R.setup             cran USDAForestService gdalraster 1.11.1 v
revision            2
categories-append   gis
maintainers         nomaintainer
license             MIT
description         Bindings to the Geospatial Data Abstraction Library Raster API
long_description    {*}${description}
homepage            https://usdaforestservice.github.io/gdalraster
checksums           rmd160  806238d3bf20cfd6babc9b5c3a62d4f0fb12e8ff \
                    sha256  37ec1c17741d128683a5ee573c67efff7e1faeaacb15b142228e605f5a44c26d \
                    size    1898531
# github.tarball_from archive

set proj_v          proj9

depends_build-append \
                    port:pkgconfig
depends_lib-append  port:gdal \
                    port:libxml2 \
                    path:lib/${proj_v}/lib/pkgconfig/proj.pc:${proj_v} \
                    port:R-bit64 \
                    port:R-Rcpp \
                    port:R-RcppInt64 \
                    port:R-xml2 \
                    port:sqlite3

# https://github.com/USDAForestService/gdalraster/issues/259
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-data=${prefix}/lib/${proj_v}/share/proj"

depends_test-append port:R-gt \
                    port:R-knitr \
                    port:R-rmarkdown \
                    port:R-scales \
                    port:R-testthat

# Rather install it first and run tests from within R session.
test.run            no
