aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMonson Shao <holymonson@gmail.com>2024-07-14 21:58:03 +0800
committerEli Schwartz <eschwartz93@gmail.com>2024-07-23 11:37:34 -0400
commit93f5ceb9eebfee229c15b31b935d8df6ad642a0b (patch)
treee6c8ef75b4b139b299c5c32dff7d39ff02b99c0e
parenta97de6b527c0109112909af8f29e8d262a87c247 (diff)
downloadmeson-93f5ceb9eebfee229c15b31b935d8df6ad642a0b.zip
meson-93f5ceb9eebfee229c15b31b935d8df6ad642a0b.tar.gz
meson-93f5ceb9eebfee229c15b31b935d8df6ad642a0b.tar.bz2
depfixer: deduplicate rpaths on darwin
Duplicated -delete_rpath arguments will cause macOS's install_name_tool failed.
-rw-r--r--mesonbuild/scripts/depfixer.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/mesonbuild/scripts/depfixer.py b/mesonbuild/scripts/depfixer.py
index f0166bd..641689f 100644
--- a/mesonbuild/scripts/depfixer.py
+++ b/mesonbuild/scripts/depfixer.py
@@ -379,11 +379,14 @@ def fix_elf(fname: str, rpath_dirs_to_remove: T.Set[bytes], new_rpath: T.Optiona
# note: e.get_rpath() and e.get_runpath() may be useful
e.fix_rpath(fname, rpath_dirs_to_remove, new_rpath)
-def get_darwin_rpaths(fname: str) -> T.List[str]:
+def get_darwin_rpaths(fname: str) -> OrderedSet[str]:
p, out, _ = Popen_safe(['otool', '-l', fname], stderr=subprocess.DEVNULL)
if p.returncode != 0:
raise subprocess.CalledProcessError(p.returncode, p.args, out)
- result = []
+ # Need to deduplicate rpaths, as macOS's install_name_tool
+ # is *very* allergic to duplicate -delete_rpath arguments
+ # when calling depfixer on installation.
+ result = OrderedSet()
current_cmd = 'FOOBAR'
for line in out.split('\n'):
line = line.strip()
@@ -394,7 +397,7 @@ def get_darwin_rpaths(fname: str) -> T.List[str]:
current_cmd = value
if key == 'path' and current_cmd == 'LC_RPATH':
rp = value.split('(', 1)[0].strip()
- result.append(rp)
+ result.add(rp)
return result
def fix_darwin(fname: str, rpath_dirs_to_remove: T.Set[bytes], new_rpath: str, final_path: str, install_name_mappings: T.Dict[str, str]) -> None: