systemd: symlink the internal libraries so they are found in rpath (#47667)

This commit is contained in:
Harmen Stoppels 2024-11-19 15:28:49 +01:00 committed by GitHub
parent 5333925dd7
commit 5325cfe865
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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))