aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/backend
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2021-11-15 20:34:38 +0530
committerNirbheek Chauhan <nirbheek.chauhan@gmail.com>2021-12-22 12:12:11 +0530
commit351aee8ace6eec6b655da321a48a120b020b54c4 (patch)
tree0e6694edd06b70756d3d225a0cdc79dd58240a82 /mesonbuild/backend
parent06b1132f82eaaf805021b4b088701d9754e2af38 (diff)
downloadmeson-351aee8ace6eec6b655da321a48a120b020b54c4.zip
meson-351aee8ace6eec6b655da321a48a120b020b54c4.tar.gz
meson-351aee8ace6eec6b655da321a48a120b020b54c4.tar.bz2
Don't wipe out RPATHs specified by dependencies
Since we scan all dependencies for build-only RPATHs now (which are removed on install), we must take care not to add build-only RPATHs pointing to directories that dependencies explicitly add -Wl,-rpath link args for, otherwise the paths will get wiped on install. Caught by LinuxlikeTests::test_usage_pkgconfig_prefixes
Diffstat (limited to 'mesonbuild/backend')
-rw-r--r--mesonbuild/backend/backends.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py
index 177f24a..8e62d38 100644
--- a/mesonbuild/backend/backends.py
+++ b/mesonbuild/backend/backends.py
@@ -708,7 +708,6 @@ class Backend:
return False
def get_external_rpath_dirs(self, target: build.BuildTarget) -> T.Set[str]:
- dirs: T.Set[str] = set()
args: T.List[str] = []
for lang in LANGUAGES_USING_LDFLAGS:
try:
@@ -719,6 +718,11 @@ class Backend:
args.extend(e)
except Exception:
pass
+ return self.get_rpath_dirs_from_link_args(args)
+
+ @staticmethod
+ def get_rpath_dirs_from_link_args(args: T.List[str]) -> T.Set[str]:
+ dirs: T.Set[str] = set()
# Match rpath formats:
# -Wl,-rpath=
# -Wl,-rpath,
@@ -777,6 +781,8 @@ class Backend:
paths.add(os.path.join(self.build_to_src, rel_to_src))
else:
paths.add(libdir)
+ # Don't remove rpaths specified by the dependency
+ paths.difference_update(self.get_rpath_dirs_from_link_args(dep.link_args))
for i in chain(target.link_targets, target.link_whole_targets):
if isinstance(i, build.BuildTarget):
paths.update(self.rpaths_for_non_system_absolute_shared_libraries(i, exclude_system))