Make macOS installed libraries more relocatable (#26608)

* relocate: call install_name_tool less

* zstd: fix race condition

Multiple times on my mac, trying to install in parallel led to failures
from multiple tasks trying to simultaneously create `$PREFIX/lib`.

* PackageMeta: simplify callback flush

* Relocate: use spack.platforms instead of platform

* Relocate: code improvements

* fix zstd

* Automatically fix rpaths for packages on macOS

* Only change library IDs when the path is already in the rpath

This restores the hardcoded library path for GCC.

* Delete nonexistent rpaths and add more testing

* Relocate: Allow @executable_path and @loader_path
This commit is contained in:
Seth R. Johnson
2021-10-18 13:34:16 -04:00
committed by GitHub
parent 3c013b5be6
commit c48b733773
7 changed files with 395 additions and 115 deletions

View File

@@ -37,10 +37,10 @@ class Zstd(MakefilePackage):
depends_on('lzma', when='+programs')
depends_on('lz4', when='+programs')
def _make(self, *args):
def _make(self, *args, **kwargs):
# PREFIX must be defined on macOS even when building the library, since
# it gets hardcoded into the library's install_path
make('VERBOSE=1', 'PREFIX=' + self.prefix, '-C', *args)
make('VERBOSE=1', 'PREFIX=' + self.prefix, '-C', *args, **kwargs)
def build(self, spec, prefix):
self._make('lib')
@@ -48,6 +48,6 @@ def build(self, spec, prefix):
self._make('programs')
def install(self, spec, prefix):
self._make('lib', 'install')
self._make('lib', 'install', parallel=False)
if spec.variants['programs'].value:
self._make('programs', 'install')