summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGlenn P Johnson <glenn-johnson@uiowa.edu>2019-09-24 21:01:12 -0500
committerPeter Scheibel <scheibel1@llnl.gov>2019-09-26 13:38:13 -0700
commit08a6577861883aefa41fd813904dc9f34c3b4dec (patch)
tree3824c35a5c9e77b0111f1e302eb1e0cfa1c9ace2 /lib
parent5201d2615eff0a7ff948b5783a0d859eb53a9423 (diff)
downloadspack-08a6577861883aefa41fd813904dc9f34c3b4dec.tar.gz
spack-08a6577861883aefa41fd813904dc9f34c3b4dec.tar.bz2
spack-08a6577861883aefa41fd813904dc9f34c3b4dec.tar.xz
spack-08a6577861883aefa41fd813904dc9f34c3b4dec.zip
Fix perl build when using Build.PL
This fixes #12852 where perl builds that use Build.PL will fail when the shebang of the Build script produced from the configure step is too long.
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/build_systems/perl.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/spack/spack/build_systems/perl.py b/lib/spack/spack/build_systems/perl.py
index bdd1e7fda3..28f1fc5608 100644
--- a/lib/spack/spack/build_systems/perl.py
+++ b/lib/spack/spack/build_systems/perl.py
@@ -10,6 +10,7 @@ import os
from spack.directives import depends_on, extends
from spack.package import PackageBase, run_after
from spack.util.executable import Executable
+from llnl.util.filesystem import filter_file
class PerlPackage(PackageBase):
@@ -80,6 +81,17 @@ class PerlPackage(PackageBase):
inspect.getmodule(self).perl(*options)
+ # It is possible that the shebang in the Build script that is created from
+ # Build.PL may be too long causing the build to fail. Patching the shebang
+ # does not happen until after install so set '/usr/bin/env perl' here in
+ # the Build script.
+ @run_after('configure')
+ def fix_shebang(self):
+ if self.build_method == 'Build.PL':
+ pattern = '#!{0}'.format(self.spec['perl'].command.path)
+ repl = '#!/usr/bin/env perl'
+ filter_file(pattern, repl, 'Build', backup=False)
+
def build(self, spec, prefix):
"""Builds a Perl package."""
self.build_executable()