# -*- 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           compilers 1.0
PortGroup           R 1.0

# GitHub version lags behind.
R.setup             cran snoweye pbdMPI 0.5-2
revision            0
categories-append   parallel
maintainers         {@barracuda156 gmail.com:vital.had} openmaintainer
license             MPL-2
description         Interface to MPI
long_description    {*}${description}
homepage            https://github.com/snoweye/pbdMPI
checksums           rmd160  4e672b2544e8a7409da46b5a78bdf5f411bc8646 \
                    sha256  213da272b6c9d8075b8c5cb703777c724b16c1b13f82d04a7e57a91935646b77 \
                    size    421132

if {[string match macports-clang-* ${configure.compiler}]} {
    set mpi_suffix  mp
    set mpi_port    mpich-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    mpich-${mpi_suffix}
}

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

# At the moment there is no MPICH4 type. However, it does build against MPICH4.
build.args-append   --configure-args="--with-mpi=${prefix} \
                        --with-mpi-include=${prefix}/include/mpich-${mpi_suffix} \
                        --with-mpi-libpath=${prefix}/lib/mpich-${mpi_suffix} \
                        --with-mpi-type=MPICH3"

test.run            no
