2012-02-16 16:26:16 +00:00
|
|
|
require 'formula'
|
|
|
|
|
2013-01-11 22:10:36 +00:00
|
|
|
# This should really be named Mpich now, but homebrew cannot currently handle
|
|
|
|
# formula renames, see homebrew issue #14374.
|
2012-02-16 16:26:16 +00:00
|
|
|
class Mpich2 < Formula
|
2012-11-21 03:21:11 +00:00
|
|
|
homepage 'http://www.mpich.org/'
|
2013-01-11 22:10:36 +00:00
|
|
|
url 'http://www.mpich.org/static/tarballs/3.0.2/mpich-3.0.2.tar.gz'
|
|
|
|
sha1 '510f5a05bb5c8214caa86562e054c455cb5287d1'
|
2012-10-21 20:15:36 +00:00
|
|
|
|
2013-01-11 22:10:36 +00:00
|
|
|
head 'git://git.mpich.org/mpich.git'
|
2012-05-17 23:10:37 +00:00
|
|
|
|
|
|
|
# the HEAD version requires the autotools to be installed
|
2012-10-10 18:35:48 +00:00
|
|
|
# (autoconf>=2.67, automake>=1.12.3, libtool>=2.4)
|
2012-10-21 20:15:36 +00:00
|
|
|
if build.head?
|
2012-05-17 23:10:37 +00:00
|
|
|
depends_on 'automake' => :build
|
|
|
|
depends_on 'libtool' => :build
|
|
|
|
end
|
2012-02-16 16:26:16 +00:00
|
|
|
|
2012-10-21 20:15:36 +00:00
|
|
|
option 'disable-fortran', "Do not attempt to build Fortran bindings"
|
2012-11-29 00:05:59 +00:00
|
|
|
option 'enable-shared', "Build shared libraries"
|
|
|
|
|
|
|
|
# fails with clang from Xcode 4.5.1 on 10.7 and 10.8 (see #15533)
|
2013-01-11 22:10:36 +00:00
|
|
|
# linker bug appears to have been fixed by Xcode 4.6
|
2012-11-29 00:05:59 +00:00
|
|
|
fails_with :clang do
|
|
|
|
build 421
|
|
|
|
cause <<-EOS.undent
|
|
|
|
Clang generates code that causes the linker to segfault when building
|
2013-01-11 22:10:36 +00:00
|
|
|
MPICH with shared libraries. Specific message:
|
2012-11-29 00:05:59 +00:00
|
|
|
|
|
|
|
collect2: ld terminated with signal 11 [Segmentation fault: 11]
|
|
|
|
EOS
|
|
|
|
end if build.include? 'enable-shared'
|
2012-05-17 18:29:38 +00:00
|
|
|
|
2012-02-16 16:26:16 +00:00
|
|
|
def install
|
2012-10-21 20:15:36 +00:00
|
|
|
if build.head?
|
2012-05-17 23:10:37 +00:00
|
|
|
# ensure that the consistent set of autotools built by homebrew is used to
|
2013-01-11 22:10:36 +00:00
|
|
|
# build MPICH, otherwise very bizarre build errors can occur
|
|
|
|
ENV['MPICH_AUTOTOOLS_DIR'] = (HOMEBREW_PREFIX+'bin')
|
2012-05-17 23:10:37 +00:00
|
|
|
system "./autogen.sh"
|
|
|
|
end
|
|
|
|
|
2012-05-17 18:29:38 +00:00
|
|
|
args = [
|
2012-10-19 08:10:00 +00:00
|
|
|
"--disable-dependency-tracking",
|
|
|
|
"--disable-silent-rules",
|
2012-05-17 18:29:38 +00:00
|
|
|
"--prefix=#{prefix}",
|
2012-10-19 08:10:00 +00:00
|
|
|
"--mandir=#{man}"
|
2012-05-17 18:29:38 +00:00
|
|
|
]
|
2012-10-21 20:15:36 +00:00
|
|
|
if build.include? 'disable-fortran'
|
2012-05-17 18:29:38 +00:00
|
|
|
args << "--disable-f77" << "--disable-fc"
|
|
|
|
else
|
|
|
|
ENV.fortran
|
|
|
|
end
|
|
|
|
|
2013-01-11 22:10:36 +00:00
|
|
|
# MPICH configure defaults to "--disable-shared"
|
2012-11-29 00:05:59 +00:00
|
|
|
if build.include? 'enable-shared'
|
|
|
|
args << "--enable-shared"
|
|
|
|
end
|
|
|
|
|
2012-05-17 18:29:38 +00:00
|
|
|
system "./configure", *args
|
2012-02-16 16:26:16 +00:00
|
|
|
system "make"
|
|
|
|
system "make install"
|
|
|
|
end
|
|
|
|
|
|
|
|
def caveats; <<-EOS.undent
|
2012-05-17 23:09:52 +00:00
|
|
|
Please be aware that installing this formula along with the `openmpi`
|
2012-02-16 16:26:16 +00:00
|
|
|
formula will cause neither MPI installation to work correctly as
|
|
|
|
both packages install their own versions of mpicc/mpicxx and mpirun.
|
|
|
|
EOS
|
|
|
|
end
|
2012-05-17 23:05:49 +00:00
|
|
|
|
|
|
|
def test
|
|
|
|
# a better test would be to build and run a small MPI program
|
|
|
|
system "#{bin}/mpicc", "-show"
|
|
|
|
end
|
2012-02-16 16:26:16 +00:00
|
|
|
end
|