# $Id: Portfile 55891 2009-08-20 21:20:35Z mww@macports.org $

PortSystem 1.0

name			openmpi
version			1.3.3
categories		science parallel net
platforms		darwin
maintainers		mww
description		A High Performance Message Passing Library
long_description	Open MPI is a project combining technologies and resources \
			from several other projects (FT-MPI, LA-MPI, LAM/MPI, and \
			PACX-MPI) in order to build the best MPI library available. A \
			completely new MPI-2 compliant implementation, Open MPI offers \
			advantages for system and software vendors, application developers \
			and computer science researchers.

homepage		http://www.open-mpi.org/
set subdir		ompi/v1.3/downloads/
master_sites		http://www.open-mpi.org/software/${subdir} \
			http://www.open-mpi.de/software/${subdir} \
			http://icl.cs.utk.edu/open-mpi/${subdir} \
			freebsd
checksums           md5     f6cdc9c195daa8571b2e509e952d6755 \
                    sha1    f668feb22ff0a4c4d9b438e4e69a97b08aa73234 \
                    rmd160  209972fdbf52787ea0482d9b89fad2c1f59e6e87
use_bzip2		yes

pre-extract { file mkdir ${workpath}/build }

configure.dir	${workpath}/build
configure.cmd	${worksrcpath}/configure
configure.args	--disable-f77 --disable-f90 \
		--with-xgrid \
		--sysconfdir=${prefix}/etc/${name} \
		--includedir=${prefix}/include/${name} \
		--bindir=${prefix}/lib/${name}/bin \
		--mandir=${prefix}/share/man

build.dir	${configure.dir}

destroot.dir	${build.dir}
set wrappers	{mpicc mpicxx mpic++}
post-destroot {
	foreach bin {mpirun mpiexec} {
		system "cd ${destroot}${prefix}/bin \
			&& ln -sf ${prefix}/lib/${name}/bin/orterun open${bin}"
	}
	foreach bin ${wrappers} {
		system "cd ${destroot}${prefix}/bin \
			&& ln -sf ${prefix}/lib/${name}/bin/opal_wrapper open${bin}"
		system "cd ${destroot}${prefix}/share/${name} \
		&& ln -sf ${prefix}/share/${name}/${bin}-wrapper-data.txt \
			open${bin}-wrapper-data.txt"
	}
}

variant threads description {enable threads for MPI applications} {
	configure.args-append --enable-mpi-threads
}

variant progressthreads description {enable threads asynchronous communication progress} {
	configure.args-append --enable-progress-threads
}

variant gcc42 description {build mpif77 and mpif90 using gcc42} conflicts gcc43 g95 {
	configure.args-delete --disable-f77 --disable-f90
	configure.args-append --enable-f77 --enable-f90
	configure.f77	      ${prefix}/bin/gfortran-mp-4.2
	configure.fc	      ${prefix}/bin/gfortran-mp-4.2
	depends_lib-append    port:gcc42
	lappend wrappers mpif77 mpif90
}

variant gcc43 description {build mpif77 and mpif90 using gcc43} conflicts gcc42 g95 {
	configure.args-delete --disable-f77 --disable-f90
	configure.args-append --enable-f77 --enable-f90
	configure.f77	      ${prefix}/bin/gfortran-mp-4.3
	configure.fc	      ${prefix}/bin/gfortran-mp-4.3
	depends_lib-append    port:gcc43
	lappend wrappers mpif77 mpif90
}

variant g95 description {build mpif77 and mpif90 using g95} conflicts gcc42 gcc43 {
	configure.args-delete --disable-f77 --disable-f90
	configure.args-append --enable-f77 --enable-f90
	configure.f77	      ${prefix}/bin/g95
	configure.fc	      ${prefix}/bin/g95
	depends_lib-append    port:g95
	lappend wrappers mpif77 mpif90
}

# dependents like netcdf need some form of fortran
if {![variant_isset gcc42] && ![variant_isset gcc43] && ![variant_isset g95]} {
    default_variants +gcc43
}

livecheck.check	regex
livecheck.url	http://www.open-mpi.org/software/
livecheck.regex	openmpi-(\[0-9\.\]+).tar.bz2

universal_variant no
