# -*- 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

R.setup             cran hyu Rmpi 0.7-2.1
revision            0
categories-append   parallel
maintainers         {@barracuda156 gmail.com:vital.had} openmaintainer
license             {GPL-2 GPL-3}
description         Interface (wrapper) to MPI
long_description    {*}${description}
homepage            http://fisher.stats.uwo.ca/faculty/yu/Rmpi
checksums           rmd160  3070b8223647a7c0e47f834dd10566ddd0d0138f \
                    sha256  a06039a28970724085e4efb15e0320daa9eb633e5b91706c7e3d7499484eedbb \
                    size    106368

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}

build.args-append   --configure-args="--with-Rmpi-include=${prefix}/include/mpich-${mpi_suffix} \
                        --with-Rmpi-libpath=${prefix}/lib/mpich-${mpi_suffix} \
                        --with-Rmpi-type=MPICH2"

# Configure script is a painful mess and fails to do its job.
# There seems to be no easy way to force right settings into the test env.
# But no point anyway, since there is no test-suite provided.
test.run            no
