# -*- coding: utf-8; mode: tcl; tab-width: 4; truncate-lines: t; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:et:sw=4:ts=4:sts=4
# $Id: Portfile 79615 2011-06-20 15:47:21Z eborisch@macports.org $

PortSystem          1.0
name                mpich2
version             1.4
license             BSD
categories          science parallel net
platforms           darwin
maintainers         eborisch \
                    openmaintainer
description         Message Passing Interface (MPI) Library
long_description \
    MPICH2 is an implementation of the Message-Passing Interface (MPI). The \
    goals of MPICH2 are to provide an MPI implementation for important \
    platforms, including clusters, SMPs, and massively parallel processors. \
    It also provides a vehicle for MPI implementation research and for \
    developing new and better parallel programming environments.


homepage            http://www.mcs.anl.gov/research/projects/mpich2/
master_sites        ${homepage}downloads/tarballs/${version}/

checksums           md5     cf7f8c12161b0af3f111e33c6d15f5c6 \
                    sha1    011028456e268b013c55a00dfe51f4bc905c1c48 \
                    rmd160  ecd60567d80ad08ecd06e8fe8cfaeb626941f768

# Puts all entries in <prefix>/share into appropriate mpich2 subdirs
destroot.args       PACKAGE=mpich2
patchfiles          patch-src-util-createshlib.in

# the default include-dir conflicts with openmpi!
configure.args      --with-thread-package=posix \
                    --enable-timer-type=mach_absolute_time \
                    --enable-cxx \
                    --mandir=${prefix}/share/man \
                    --docdir=${prefix}/share/doc/${name} \
                    --htmldir=${prefix}/share/doc/${name} \
                    --includedir=${prefix}/include/${name} \
                    --disable-f77 --disable-fc \
                    --with-mpe \
                    --with-device=ch3:nemesis \
                    "F90FLAGS='' F90=''" \
                    --with-pm=hydra \
                    --enable-shared \
                    --enable-base-cache

universal_variant   no

use_parallel_build  no

variant gcc45 description {Enable Fortran 77 and Fortran 90 bindings using gfortran from gcc45} conflicts gcc42 gcc43 gcc44 llvm {
    depends_lib-append      port:gcc45
    configure.compiler      macports-gcc-4.5
}

variant gcc44 description {Enable Fortran 77 and Fortran 90 bindings using gfortran from gcc44} conflicts gcc42 gcc43 gcc45 llvm {
    depends_lib-append      port:gcc44
    configure.compiler      macports-gcc-4.4
}

variant gcc43 description {Enable Fortran 77 and Fortran 90 bindings using gfortran from gcc43} conflicts gcc42 gcc44 gcc45 llvm {
    depends_lib-append      port:gcc43
    configure.compiler      macports-gcc-4.3
}

variant gcc42 description {Enable Fortran 77 and Fortran 90 bindings using gfortran from gcc42} conflicts gcc43 gcc44 gcc45 llvm {
    depends_lib-append      port:gcc42
    configure.compiler      macports-gcc-4.2
}

if {[ variant_isset gcc42 ] || 
    [ variant_isset gcc43 ] || 
    [ variant_isset gcc44 ] || 
    [ variant_isset gcc45 ]} {
    configure.args-append   --enable-f77 --enable-fc
    configure.args-delete   --disable-f77 --disable-fc 
}

variant llvm description {Use llvm-gcc} conflicts gcc42 gcc43 gcc44 gcc45 {
    configure.compiler      llvm-gcc-4.2
}

variant gforker description {Use gforker process manager instead of the default hydra} {
    configure.args-append   --with-pm=gforker
    configure.args-delete   --with-pm=hydra
}

platform darwin {
    configure.args-append   --enable-sharedlibs=osx-gcc
}

variant default_mpi description {Install as defalt MPI -- conflict with OpenMPI} {
    configure.args-delete   --includedir=${prefix}/include/${name}
}

livecheck.type      regex
livecheck.regex     ${name}-(\[0-9.p\]+)${extract.suffix}

