# -*- 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-dbi odbc 1.4.2 v
revision            1
categories-append   databases
maintainers         {@barracuda156 gmail.com:vital.had} openmaintainer
license             MIT
description         DBI-compatible interface to ODBC databases
long_description    {*}${description}
homepage            https://r-dbi.github.io/odbc
checksums           rmd160  ebdb37ae81f2a315ffb6fbb2a3f9aa55bf6c4011 \
                    sha256  dc458e6c40eeda7dfabc783c5b637327c098fde07152d9b5879142dba63fc255 \
                    size    810782

patchfiles          patch-configure.diff

variant libiodbc description "Use libiodbc" {
    depends_lib-append \
                    port:libiodbc
    post-patch {
        reinplace "s|@ODBC@|libiodbc|g" ${worksrcpath}/configure
    }
}

variant unixODBC description "Use unixODBC" {
    depends_lib-append \
                    port:unixODBC
    post-patch {
        reinplace "s|@ODBC@|unixODBC|g" ${worksrcpath}/configure
    }
}

if {![variant_isset libiodbc] && ![variant_isset unixODBC]} {
    default_variants    +libiodbc
}

depends_build-append \
                    port:pkgconfig
depends_lib-append  port:R-bit64 \
                    port:R-blob \
                    port:R-DBI \
                    port:R-hms \
                    port:R-lifecycle \
                    port:R-Rcpp \
                    port:R-rlang

depends_test-append port:R-covr \
                    port:R-DBItest \
                    port:R-knitr \
                    port:R-magrittr \
                    port:R-rmarkdown \
                    port:R-RSQLite \
                    port:R-testthat \
                    port:R-tibble \
                    port:R-withr

test.run            yes
