# -*- 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 duckdb duckdb 0.10.1
revision            0
categories-append   databases
maintainers         nomaintainer
license             MIT
description         DBI package for the DuckDB database management system
long_description    {*}${description}
homepage            https://github.com/duckdb/duckdb-r
checksums           rmd160  159a0ae3ac18f72a7b648996d129121f18b8f37a \
                    sha256  e3b1bfd4c31d9f8d624fb954681cd24351c19713093af21361b6b599e56e48ec \
                    size    4147117

depends_lib-append  port:R-DBI

compiler.cxx_standard 2017

# https://github.com/duckdb/duckdb/issues/7009
if {[string match macports-gcc* ${configure.compiler}] && (${configure.build_arch} in [list i386 ppc])} {
    patchfiles-append \
                    patch-libatomic.diff
}

variant tests description "Enable testing" {
    depends_test-append \
                    port:R-adbcdrivermanager \
                    port:R-arrow \
                    port:R-bit64 \
                    port:R-callr \
                    port:R-DBItest \
                    port:R-dbplyr \
                    port:R-dplyr \
                    port:R-rlang \
                    port:R-testthat \
                    port:R-tibble \
                    port:R-vctrs \
                    port:R-withr

    # FIXME: some functionality for Big-endian platforms is missing, see:
    # https://github.com/duckdblabs/duckplyr/issues/51
    # Upstream not interested to fix it: https://github.com/duckdb/duckdb/issues/9714
    test.run        yes
}
