diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py index 769ee6cbd..c9cf6fd6f 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 cb87faf5c..7979fe65f 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.')