summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
authorGeorge Hartzell <hartzell@alerce.com>2017-05-29 14:59:30 -0700
committerAdam J. Stewart <ajstewart426@gmail.com>2017-05-29 16:59:30 -0500
commite3eaba80b1b48788e0c80e581650c33a3f729836 (patch)
tree9d62114f1efcea1a2463bafcd40d66db7e48906f /var
parente31f80988c50f0d4db863ee0cfe5b3f23fdf5e73 (diff)
downloadspack-e3eaba80b1b48788e0c80e581650c33a3f729836.tar.gz
spack-e3eaba80b1b48788e0c80e581650c33a3f729836.tar.bz2
spack-e3eaba80b1b48788e0c80e581650c33a3f729836.tar.xz
spack-e3eaba80b1b48788e0c80e581650c33a3f729836.zip
Ensure Config.pm has correct setting for cc (#4345)
* Ensure Config.pm has correct setting for cc Run a filter after install so that Config.pm records the compiler that Spack built the package with. If this isn't done, $Config{cc} will be set to Spack's cc wrapper script. * Also patch compilers Config_heavy.pl This patch sets ld=gcc, which appears to work. I'm not sure if there's a good way to get at the ld that Spack uses. * Clean up quoting * Fix pattern for Config.pm Does not start at beginning of line...
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/perl/package.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/perl/package.py b/var/spack/repos/builtin/packages/perl/package.py
index 10895f6089..ef1c11289f 100644
--- a/var/spack/repos/builtin/packages/perl/package.py
+++ b/var/spack/repos/builtin/packages/perl/package.py
@@ -31,6 +31,7 @@
# Date: September 6, 2015
#
from spack import *
+import os
class Perl(Package): # Perl doesn't use Autotools, it should subclass Package
@@ -160,3 +161,33 @@ class Perl(Package): # Perl doesn't use Autotools, it should subclass Package
# if it does not exist already.
if dependent_spec.package.is_extension:
mkdirp(module.perl_lib_dir)
+
+ @run_after('install')
+ def filter_config_dot_pm(self):
+ """Run after install so that Config.pm records the compiler that Spack
+ built the package with. If this isn't done, $Config{cc} will
+ be set to Spack's cc wrapper script.
+ """
+
+ kwargs = {'ignore_absent': True, 'backup': False, 'string': False}
+
+ # Find the actual path to the installed Config.pm file.
+ perl = Executable(join_path(prefix.bin, 'perl'))
+ config_dot_pm = perl('-MModule::Loaded', '-MConfig', '-e',
+ 'print is_loaded(Config)', output=str)
+
+ match = 'cc *=>.*'
+ substitute = "cc => '{cc}',".format(cc=self.compiler.cc)
+ filter_file(match, substitute, config_dot_pm, **kwargs)
+
+ # And the path Config_heavy.pl
+ d = os.path.dirname(config_dot_pm)
+ config_heavy = join_path(d, 'Config_heavy.pl')
+
+ match = '^cc=.*'
+ substitute = "cc='{cc}'".format(cc=self.compiler.cc)
+ filter_file(match, substitute, config_heavy, **kwargs)
+
+ match = '^ld=.*'
+ substitute = "ld='{ld}'".format(ld=self.compiler.cc)
+ filter_file(match, substitute, config_heavy, **kwargs)