From 9c7e82a3489241dd7e54b59fa9ace8d28bc1dfd4 Mon Sep 17 00:00:00 2001 From: Veselin Dobrev Date: Tue, 13 Feb 2018 02:22:25 -0800 Subject: [PATCH] Fix for building METIS 4.0.3 with '~shared'. (#7202) --- var/spack/repos/builtin/packages/metis/package.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/var/spack/repos/builtin/packages/metis/package.py b/var/spack/repos/builtin/packages/metis/package.py index 30f457da6b..9c4016625d 100644 --- a/var/spack/repos/builtin/packages/metis/package.py +++ b/var/spack/repos/builtin/packages/metis/package.py @@ -100,7 +100,9 @@ def patch(self): @when('@:4') def install(self, spec, prefix): # Process library spec and options - options = ['COPTIONS={0}'.format(self.compiler.pic_flag)] + options = [] + if '+shared' in spec: + options.append('COPTIONS={0}'.format(self.compiler.pic_flag)) if spec.variants['build_type'].value == 'Debug': options.append('OPTFLAGS=-g -O0') make(*options) @@ -144,8 +146,8 @@ def install(self, spec, prefix): # Set up and run tests on installation ccompile('-I%s' % prefix.include, '-L%s' % prefix.lib, - self.compiler.cc_rpath_arg + - '%s' % (prefix.lib if '+shared' in spec else ''), + (self.compiler.cc_rpath_arg + prefix.lib + if '+shared' in spec else ''), join_path('Programs', 'io.o'), join_path('Test', 'mtest.c'), '-o', '%s/mtest' % prefix.bin, '-lmetis', '-lm')