From aa079dbdf1df4a9f78d60600d25514a7642a54be Mon Sep 17 00:00:00 2001
From: "Adam J. Stewart" <ajstewart426@gmail.com>
Date: Tue, 11 Oct 2016 04:16:01 -0500
Subject: [PATCH] Add variant to MPICH to enable ROMIO support (#1944)

---
 .../repos/builtin/packages/mpich/package.py   | 64 +++++++++----------
 1 file changed, 32 insertions(+), 32 deletions(-)

diff --git a/var/spack/repos/builtin/packages/mpich/package.py b/var/spack/repos/builtin/packages/mpich/package.py
index a36ab4206e..8d1b23c5be 100644
--- a/var/spack/repos/builtin/packages/mpich/package.py
+++ b/var/spack/repos/builtin/packages/mpich/package.py
@@ -27,9 +27,10 @@
 
 class Mpich(Package):
     """MPICH is a high performance and widely portable implementation of
-       the Message Passing Interface (MPI) standard."""
+    the Message Passing Interface (MPI) standard."""
+
     homepage = "http://www.mpich.org"
-    url = "http://www.mpich.org/static/downloads/3.0.4/mpich-3.0.4.tar.gz"
+    url      = "http://www.mpich.org/static/downloads/3.0.4/mpich-3.0.4.tar.gz"
     list_url = "http://www.mpich.org/static/downloads/"
     list_depth = 2
 
@@ -41,10 +42,10 @@ class Mpich(Package):
     version('3.1',   '5643dd176499bfb7d25079aaff25f2ec')
     version('3.0.4', '9c5d5d4fe1e17dd12153f40bc5b6dbc0')
 
-    variant('verbs', default=False,
-            description='Build support for OpenFabrics verbs.')
-    variant('pmi', default=True, description='Build with PMI support')
-    variant('hydra', default=True, description='Build the hydra process manager')
+    variant('hydra', default=True,  description='Build the hydra process manager')
+    variant('pmi',   default=True,  description='Build with PMI support')
+    variant('romio', default=True,  description='Enable ROMIO MPI I/O implementation')
+    variant('verbs', default=False, description='Build support for OpenFabrics verbs.')
 
     provides('mpi@:3.0', when='@3:')
     provides('mpi@:1.3', when='@1:')
@@ -72,16 +73,14 @@ def setup_dependent_package(self, module, dep_spec):
         ]
 
     def install(self, spec, prefix):
-        config_args = ["--prefix=" + prefix,
-                       "--with-pmi=" + ("yes" if '+pmi' in spec else 'no'),
-                       "--with-pm=" + ('hydra' if '+hydra' in spec else 'no'),
-                       "--enable-shared"]
-
-        # Variants
-        if '+verbs' in spec:
-            config_args.append("--with-ibverbs")
-        else:
-            config_args.append("--without-ibverbs")
+        config_args = [
+            '--prefix={0}'.format(prefix),
+            '--enable-shared',
+            '--with-pm={0}'.format('hydra' if '+hydra' in spec else 'no'),
+            '--with-pmi={0}'.format('yes' if '+pmi' in spec else 'no'),
+            '--{0}-romio'.format('enable' if '+romio' in spec else 'disable'),
+            '--{0}-ibverbs'.format('with' if '+verbs' in spec else 'without')
+        ]
 
         # TODO: Spack should make it so that you can't actually find
         # these compilers if they're "disabled" for the current
@@ -96,32 +95,33 @@ def install(self, spec, prefix):
             config_args.append("--disable-fortran")
 
         configure(*config_args)
+
         make()
-        make("install")
+        make('check')
+        make('install')
 
-        self.filter_compilers()
+        self.filter_compilers(prefix)
 
-    def filter_compilers(self):
+    def filter_compilers(self, prefix):
         """Run after install to make the MPI compilers use the
-           compilers that Spack built the package with.
-
-           If this isn't done, they'll have CC, CXX, F77, and FC set
-           to Spack's generic cc, c++, f77, and f90.  We want them to
-           be bound to whatever compiler they were built with.
-        """
-        bin = self.prefix.bin
-        mpicc = join_path(bin, 'mpicc')
-        mpicxx = join_path(bin, 'mpicxx')
-        mpif77 = join_path(bin, 'mpif77')
-        mpif90 = join_path(bin, 'mpif90')
+        compilers that Spack built the package with.
+
+        If this isn't done, they'll have CC, CXX, F77, and FC set
+        to Spack's generic cc, c++, f77, and f90.  We want them to
+        be bound to whatever compiler they were built with."""
+
+        mpicc  = join_path(prefix.bin, 'mpicc')
+        mpicxx = join_path(prefix.bin, 'mpicxx')
+        mpif77 = join_path(prefix.bin, 'mpif77')
+        mpif90 = join_path(prefix.bin, 'mpif90')
 
         # Substitute Spack compile wrappers for the real
         # underlying compiler
         kwargs = {'ignore_absent': True, 'backup': False, 'string': True}
-        filter_file(env['CC'], self.compiler.cc,  mpicc,  **kwargs)
+        filter_file(env['CC'],  self.compiler.cc,  mpicc,  **kwargs)
         filter_file(env['CXX'], self.compiler.cxx, mpicxx, **kwargs)
         filter_file(env['F77'], self.compiler.f77, mpif77, **kwargs)
-        filter_file(env['FC'], self.compiler.fc,  mpif90, **kwargs)
+        filter_file(env['FC'],  self.compiler.fc,  mpif90, **kwargs)
 
         # Remove this linking flag if present
         # (it turns RPATH into RUNPATH)
-- 
GitLab