diff options
author | Eli Schwartz <eschwartz@archlinux.org> | 2021-11-28 11:32:10 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-28 18:32:10 +0200 |
commit | 99d809b59d30d17d3ad8826209f56b7f2a0370d3 (patch) | |
tree | 5e8d0f87208991fb67bfb300b78a7ed4bbb2b605 | |
parent | 1e19757899fe4388766d71244a2143016ca939ec (diff) | |
download | meson-99d809b59d30d17d3ad8826209f56b7f2a0370d3.zip meson-99d809b59d30d17d3ad8826209f56b7f2a0370d3.tar.gz meson-99d809b59d30d17d3ad8826209f56b7f2a0370d3.tar.bz2 |
fix BSD ldconfig handling (#9631)
For libraries installed to libdir, it's not expected to have rpath
hooked up. But for non-default libdirs, the path might not get searched
by default. `ldconfig -m <libdir>` is convenient here, as it will
programmatically add a new directory to search for shared libraries, so
the resulting installed programs work out of the box.
Include the dragonfly BSD platform name, which doesn't match the 'bsd'
catch-all pattern.
-rw-r--r-- | mesonbuild/backend/backends.py | 4 | ||||
-rw-r--r-- | mesonbuild/minstall.py | 18 |
2 files changed, 16 insertions, 6 deletions
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py index 769ee6c..c9cf6fd 100644 --- a/mesonbuild/backend/backends.py +++ b/mesonbuild/backend/backends.py @@ -107,7 +107,7 @@ class CleanTrees: self.trees = trees class InstallData: - def __init__(self, source_dir: str, build_dir: str, prefix: str, + def __init__(self, source_dir: str, build_dir: str, prefix: str, libdir: str, strip_bin: T.List[str], install_umask: T.Union[str, int], mesonintrospect: T.List[str], version: str): # TODO: in python 3.8 or with typing_Extensions install_umask could be: @@ -115,6 +115,7 @@ class InstallData: self.source_dir = source_dir self.build_dir = build_dir self.prefix = prefix + self.libdir = libdir self.strip_bin = strip_bin self.install_umask = install_umask self.targets: T.List[TargetInstallData] = [] @@ -1485,6 +1486,7 @@ class Backend: d = InstallData(self.environment.get_source_dir(), self.environment.get_build_dir(), self.environment.get_prefix(), + self.environment.get_libdir(), strip_bin, umask, self.environment.get_build_command() + ['introspect'], diff --git a/mesonbuild/minstall.py b/mesonbuild/minstall.py index cb87faf..7979fe6 100644 --- a/mesonbuild/minstall.py +++ b/mesonbuild/minstall.py @@ -244,7 +244,7 @@ def restore_selinux_contexts() -> None: 'Standard output:', out, 'Standard error:', err, sep='\n') -def apply_ldconfig(dm: DirMaker) -> None: +def apply_ldconfig(dm: DirMaker, libdir: str) -> None: ''' Apply ldconfig to update the ld.so.cache. ''' @@ -252,7 +252,14 @@ def apply_ldconfig(dm: DirMaker) -> None: # If we don't have ldconfig, failure is ignored quietly. return - if 'bsd' in platform.system().lower(): + platlower = platform.system().lower() + if platlower == 'dragonfly' or 'bsd' in platlower: + if libdir in dm.all_dirs: + proc, out, err = Popen_safe(['ldconfig', '-m', libdir]) + if proc.returncode != 0: + print('Failed to apply ldconfig ...', + 'Standard output:', out, + 'Standard error:', err, sep='\n') return # Try to update ld cache, it could fail if we don't have permission. @@ -372,9 +379,9 @@ class Installer: if not self.dry_run and not destdir: restore_selinux_contexts() - def apply_ldconfig(self, dm: DirMaker, destdir: str) -> None: + def apply_ldconfig(self, dm: DirMaker, destdir: str, libdir: str) -> None: if not self.dry_run and not destdir: - apply_ldconfig(dm) + apply_ldconfig(dm, libdir) def Popen_safe(self, *args: T.Any, **kwargs: T.Any) -> T.Tuple[int, str, str]: if not self.dry_run: @@ -536,6 +543,7 @@ class Installer: os.environ['DESTDIR'] = destdir destdir = destdir or '' fullprefix = destdir_join(destdir, d.prefix) + libdir = os.path.join(d.prefix, d.libdir) if d.install_umask != 'preserve': assert isinstance(d.install_umask, int) @@ -551,7 +559,7 @@ class Installer: self.install_emptydir(d, dm, destdir, fullprefix) self.install_data(d, dm, destdir, fullprefix) self.restore_selinux_contexts(destdir) - self.apply_ldconfig(dm, destdir) + self.apply_ldconfig(dm, destdir, libdir) self.run_install_script(d, destdir, fullprefix) if not self.did_install_something: self.log('Nothing to install.') |