summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--var/spack/repos/builtin/packages/perl/package.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/var/spack/repos/builtin/packages/perl/package.py b/var/spack/repos/builtin/packages/perl/package.py
index ddd732c5dd..72c6c375e3 100644
--- a/var/spack/repos/builtin/packages/perl/package.py
+++ b/var/spack/repos/builtin/packages/perl/package.py
@@ -15,6 +15,7 @@ import os
import re
from contextlib import contextmanager
+from llnl.util import tty
from llnl.util.lang import match_predicate
from spack import *
@@ -299,8 +300,21 @@ class Perl(Package): # Perl doesn't use Autotools, it should subclass Package
# 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/
+ # It seems that this is only necessary for older versions of the
+ # command line tools rather than the xcode/clang version.
if spec.satisfies('os=bigsur'):
- env.set('SYSTEM_VERSION_COMPAT', 1)
+ pkgutil = Executable('pkgutil')
+ output = pkgutil('--pkg-info=com.apple.pkg.CLTools_Executables',
+ output=str, error=str, fail_on_error=False)
+ match = re.search(r'version:\s*([0-9.]+)', output)
+ if not match:
+ tty.warn('Failed to detect macOS command line tools version: '
+ + output)
+ else:
+ if Version(match.group(1)) < Version('12'):
+ tty.warn("Setting SYSTEM_VERSION_COMPAT=1 due to older "
+ "command line tools version")
+ env.set('SYSTEM_VERSION_COMPAT', 1)
# This is how we tell perl the locations of bzip and zlib.
env.set('BUILD_BZIP2', 0)