# -*- 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.5.0 v
revision            0
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  9ebabf3c5be4b79a8f7a9360a86ad2faf9a8df30 \
                    sha256  f65c66d053bc0bc16c7f6a0aa3d8df81ab4335e1a81ce2c3cd09b929445f8182 \
                    size    830830
github.tarball_from archive

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 \
                    path:bin/pkg-config:pkgconfig

depends_lib-append  port:R-bit64 \
                    port:R-blob \
                    port:R-cli \
                    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
