From 734fb459a45896ee41881ca906643bd362be3e37 Mon Sep 17 00:00:00 2001
From: Joseph Ciurej <ciurej1@llnl.gov>
Date: Wed, 25 May 2016 12:27:52 -0700
Subject: [PATCH] Fixing a small bug with metis@4+shared installs on the Mac
 platform.

---
 .../repos/builtin/packages/metis/package.py   | 20 ++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/var/spack/repos/builtin/packages/metis/package.py b/var/spack/repos/builtin/packages/metis/package.py
index 5ccc04bd5e..c4f2afaff2 100644
--- a/var/spack/repos/builtin/packages/metis/package.py
+++ b/var/spack/repos/builtin/packages/metis/package.py
@@ -94,17 +94,19 @@ def install(self, spec, prefix):
             install(sharefile, prefix.share)
 
         if '+shared' in spec:
+            shared_flags = ['-fPIC', '-shared']
             if sys.platform == 'darwin':
-                lib_dsuffix = 'dylib'
-                load_flag = '-Wl,-all_load'
-                no_load_flag = ''
+                shared_suffix = 'dylib'
+                shared_flags.extend(['-Wl,-all_load', 'libmetis.a'])
             else:
-                lib_dsuffix = 'so'
-                load_flag = '-Wl,-whole-archive'
-                no_load_flag = '-Wl,-no-whole-archive'
+                shared_suffix = 'so'
+                shared_flags.extend(['-Wl,-whole-archive', 'libmetis.a',
+                                     '-Wl,-no-whole-archive'])
 
-            ccompile('-fPIC', '-shared', load_flag, 'libmetis.a', no_load_flag,
-                     '-o', '%s/libmetis.%s' % (prefix.lib, lib_dsuffix))
+            shared_out = '%s/libmetis.%s' % (prefix.lib, shared_suffix)
+            shared_flags.extend(['-o', shared_out])
+
+            ccompile(*shared_flags)
 
         # Set up and run tests on installation
         ccompile('-I%s' % prefix.include, '-L%s' % prefix.lib,
@@ -128,7 +130,7 @@ def install(self, spec, prefix):
         os.system('%s %s 10' % (test_bin('partdmesh'), graph))
         os.system('%s %s' % (test_bin('mesh2dual'), graph))
 
-        # TODO: The following code should replace the testing code in the
+        # FIXME: The following code should replace the testing code in the
         # block above since it causes installs to fail when one or more of the
         # Metis tests fail, but it currently doesn't work because the 'mtest',
         # 'onmetis', and 'partnmesh' tests return error codes that trigger
-- 
GitLab