Add variant to build shared Perl lib (#4416)

* Add variant to build shared Perl lib

Add a variant that enables Perl's "useshrplib" feature, which builds a
shared perl library.

This addresses problems like so:

```
/usr/bin/ld: /blah/blah/spack/opt/spack/linux-centos7-x86_64/gcc-4.8.5/perl-5.24.1-y43dp3p5w66v7qh5xkwgufxohyuodyew/lib/5.24.1/x86_64-linux/CORE/libperl.a(op.o): relocation R_X86_64_32S against `PL_opargs' can not be used when making a shared object; recompile with -fPIC
/blah/blah/spack/opt/spack/linux-centos7-x86_64/gcc-4.8.5/perl-5.24.1-y43dp3p5w66v7qh5xkwgufxohyuodyew/lib/5.24.1/x86_64-linux/CORE/libperl.a: could not read symbols: Bad value
```

It should also address the Intel compiler issue discussed in #3081
while respecting Perl's configuration machinery.

* Rename shared variant and default to True

* Use correct variant to add configure arg

* Restore bits that set ccflags for intel compilers

After some experimentation we've established that setting
the flag to build a shared perl library is tightly tied to
the use of -fPIC.

This commit restores the code that sets ccflags for
intel compilers.

* Flake8 cleanup
This commit is contained in:
George Hartzell 2017-06-02 08:44:01 -07:00 committed by Adam J. Stewart
parent 623e7cb7b6
commit 23474be4b0

View File

@ -69,6 +69,9 @@ class Perl(Package): # Perl doesn't use Autotools, it should subclass Package
variant('cpanm', default=True,
description='Optionally install cpanm with the core packages.')
variant('shared', default=True,
description='Build a shared libperl.so library')
resource(
name="cpanm",
url="http://search.cpan.org/CPAN/authors/id/M/MI/MIYAGAWA/App-cpanminus-1.7042.tar.gz",
@ -87,14 +90,18 @@ def configure_args(self):
'-des',
'-Dprefix={0}'.format(prefix),
'-Dlocincpth=' + self.spec['gdbm'].prefix.include,
'-Dloclibpth=' + self.spec['gdbm'].prefix.lib
'-Dloclibpth=' + self.spec['gdbm'].prefix.lib,
]
# Discussion of -fPIC for Intel at:
# https://github.com/LLNL/spack/pull/3081
# https://github.com/LLNL/spack/pull/3081 and
# https://github.com/LLNL/spack/pull/4416
if spec.satisfies('%intel'):
config_args.append('-Accflags={0}'.format(self.compiler.pic_flag))
if '+shared' in spec:
config_args.append('-Duseshrplib')
return config_args
def configure(self, spec, prefix):