summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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)