From 5325cfe8654ef6e7f02a7ed1e892a4f2870d07f0 Mon Sep 17 00:00:00 2001 From: Harmen Stoppels Date: Tue, 19 Nov 2024 15:28:49 +0100 Subject: [PATCH] systemd: symlink the internal libraries so they are found in rpath (#47667) --- var/spack/repos/builtin/packages/systemd/package.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/var/spack/repos/builtin/packages/systemd/package.py b/var/spack/repos/builtin/packages/systemd/package.py index 16f07dca8314c6..cbd6596c1cbd88 100644 --- a/var/spack/repos/builtin/packages/systemd/package.py +++ b/var/spack/repos/builtin/packages/systemd/package.py @@ -3,6 +3,7 @@ # # SPDX-License-Identifier: (Apache-2.0 OR MIT) +import glob import os from spack.package import * @@ -142,3 +143,13 @@ def install(self, spec, prefix): os.environ["DESTDIR"] = prefix with working_dir(self.build_directory): ninja("install") + + @run_after("install") + def symlink_internal_libs(self): + with working_dir(self.prefix): + # Create symlinks lib/lib*.so* -> lib/systemd/lib*.so* so that executables and + # libraries from systemd can find its own libraries in rpaths. + for lib_path in glob.glob("lib*/systemd/lib*.so*"): + lib_name = os.path.basename(lib_path) + lib_dir = os.path.dirname(os.path.dirname(lib_path)) + os.symlink(os.path.relpath(lib_path, lib_dir), os.path.join(lib_dir, lib_name))