perl: add dependencies for bzip2 and zlib (#24743)

Perl keeps copies of the bzip2 and zlib source code in its own source
tree and by default uses them in favor of outside libraries.  Instead,
put these dependencies under control of spack and tell perl to use the
spack-built versions.
This commit is contained in:
Mark W. Krentel 2021-07-07 04:25:57 -05:00 committed by GitHub
parent 59eea2859a
commit 3c9a58bd0b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -11,12 +11,11 @@
# Author: Justin Too <justin@doubleotoo.com>
# Date: September 6, 2015
#
import re
import os
import re
from contextlib import contextmanager
from llnl.util.lang import match_predicate
from spack import *
@ -65,6 +64,8 @@ class Perl(Package): # Perl doesn't use Autotools, it should subclass Package
depends_on('gdbm')
depends_on('berkeley-db')
depends_on('bzip2+shared')
depends_on('zlib+shared')
# there has been a long fixed issue with 5.22.0 with regard to the ccflags
# definition. It is well documented here:
@ -270,12 +271,22 @@ def setup_dependent_package(self, module, dependent_spec):
mkdirp(module.perl_lib_dir)
def setup_build_environment(self, env):
spec = self.spec
# This is to avoid failures when using -mmacosx-version-min=11.1
# since not all Apple Clang compilers support that version range
# See https://eclecticlight.co/2020/07/21/big-sur-is-both-10-16-and-11-0-its-official/
if self.spec.satisfies('os=bigsur'):
if spec.satisfies('os=bigsur'):
env.set('SYSTEM_VERSION_COMPAT', 1)
# This is how we tell perl the locations of bzip and zlib.
env.set('BUILD_BZIP2', 0)
env.set('BZIP2_INCLUDE', spec['bzip2'].prefix.include)
env.set('BZIP2_LIB', spec['bzip2'].prefix.lib)
env.set('BUILD_ZLIB', 0)
env.set('ZLIB_INCLUDE', spec['zlib'].prefix.include)
env.set('ZLIB_LIB', spec['zlib'].prefix.lib)
@run_after('install')
def filter_config_dot_pm(self):
"""Run after install so that Config.pm records the compiler that Spack