# -*- 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 paciorek bigGP 0.1.8
revision            1
categories-append   math parallel
maintainers         {@barracuda156 gmail.com:vital.had} openmaintainer
license             GPL-2+
description         Distributed Gaussian process calculations
long_description    {*}${description}
checksums           rmd160  2422b9e2158e776959b7dd16a8bc9fae9c9f1441 \
                    sha256  3f07ed5075764e08e4431d148cecdecc1063f4e78fbac330a5a6f8d9eed49a2b \
                    size    1054037

# We borrow these settings from R-Rmpi port:
if {[string match macports-clang-* ${configure.compiler}]} {
    set mpi_suffix  mp
    set mpi_port    openmpi-default
} elseif {[string match macports-gcc-* ${configure.compiler}]} {
    set gcc_v [
        string range ${configure.compiler} [
            string length macports-gcc-
        ] end
    ]
    set mpi_suffix  gcc${gcc_v}
    set mpi_port    openmpi-${mpi_suffix}
}

depends_lib-append  port:${mpi_port} \
                    port:R-Rmpi

compilers.setup     require_fortran

build.args-append   --configure-args="--with-mpi-include=${prefix}/include/openmpi-${mpi_suffix} \
                        --with-mpi-libpath=${prefix}/lib/openmpi-${mpi_suffix} \
                        --with-mpi-type=OPENMPI"

depends_test-append port:R-fields \
                    port:R-rlecuyer

# Need to find a way to ensure correct implementation is picked when running check.
test.run            no
