# -*- 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-lib webfakes 1.3.1 v
revision            0
categories-append   devel
maintainers         nomaintainer
license             MIT
description         Fake web-apps for HTTP testing
long_description    {*}${description}
checksums           rmd160  d4725eb629afbfac4a4f1e4a0e3a561d20fe4dde \
                    sha256  311394247725c075607100a217ba1ea32cb88b544827365368ac0407b83ff593 \
                    size    413391
github.tarball_from archive

# If R will support universal builds, then in a case of ppc+x86, endian define should be dropped.
patchfiles-append   patch-endian.diff
post-patch {
    if {${configure.build_arch} in [list ppc ppc64]} {
        reinplace "s,@ENDIAN_FLAG@,-DARCH_IS_BIG_ENDIAN=1," ${worksrcpath}/src/Makevars
    } else {
        reinplace "s,@ENDIAN_FLAG@,-DARCH_IS_BIG_ENDIAN=0," ${worksrcpath}/src/Makevars
    }
}

# See: https://trac.macports.org/ticket/68308
# Tests pass after this patch. Review this later again.
patchfiles-append   patch-timers.diff

depends_test-append port:R-brotli \
                    port:R-callr \
                    port:R-covr \
                    port:R-curl \
                    port:R-digest \
                    port:R-glue \
                    port:R-httpuv \
                    port:R-httr \
                    port:R-jsonlite \
                    port:R-processx \
                    port:R-testthat \
                    port:R-withr \
                    port:R-xml2 \
                    port:R-zip

test.run            yes
