# -*- 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 USDAForestService gdalraster 1.11.0 v
revision            0
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  d4e5c4bb981f33e2cb67b57a703964c0cbd50483 \
                    sha256  121f653e46c04a60f906efb50222a7b9df976fed3e0f0ce40ee0b51b9b4b148f \
                    size    15814031
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
