aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mesonbuild/scripts/depfixer.py22
-rw-r--r--mesonbuild/scripts/meson_install.py4
2 files changed, 18 insertions, 8 deletions
diff --git a/mesonbuild/scripts/depfixer.py b/mesonbuild/scripts/depfixer.py
index 1d2cc60..132cc72 100644
--- a/mesonbuild/scripts/depfixer.py
+++ b/mesonbuild/scripts/depfixer.py
@@ -364,7 +364,7 @@ def get_darwin_rpaths_to_remove(fname):
result.append(rp)
return result
-def fix_darwin(fname, new_rpath):
+def fix_darwin(fname, new_rpath, final_path):
try:
rpaths = get_darwin_rpaths_to_remove(fname)
except subprocess.CalledProcessError:
@@ -372,30 +372,38 @@ def fix_darwin(fname, new_rpath):
# non-executable target. Just return.
return
try:
+ args = []
if rpaths:
- args = []
for rp in rpaths:
args += ['-delete_rpath', rp]
subprocess.check_call(['install_name_tool', fname] + args,
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL)
+ args = []
if new_rpath:
- subprocess.check_call(['install_name_tool', '-add_rpath', new_rpath, fname],
+ args += ['-add_rpath', new_rpath]
+ # Rewrite -install_name @rpath/libfoo.dylib to /path/to/libfoo.dylib
+ if fname.endswith('dylib'):
+ args += ['-id', final_path]
+ if args:
+ subprocess.check_call(['install_name_tool', fname] + args,
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL)
except Exception as e:
raise
sys.exit(0)
-def fix_rpath(fname, new_rpath, verbose=True):
+def fix_rpath(fname, new_rpath, final_path, verbose=True):
+ # Static libraries never have rpaths
+ if fname.endswith('.a'):
+ return
try:
fix_elf(fname, new_rpath, verbose)
- return 0
+ return
except SystemExit as e:
if isinstance(e.code, int) and e.code == 0:
pass
else:
raise
if shutil.which('install_name_tool'):
- fix_darwin(fname, new_rpath)
- return 0
+ fix_darwin(fname, new_rpath, final_path, install_name_mappings)
diff --git a/mesonbuild/scripts/meson_install.py b/mesonbuild/scripts/meson_install.py
index 3b3be11..00c6019 100644
--- a/mesonbuild/scripts/meson_install.py
+++ b/mesonbuild/scripts/meson_install.py
@@ -363,6 +363,7 @@ def install_targets(d):
fname = check_for_stampfile(t[0])
outdir = get_destdir_path(d, t[1])
outname = os.path.join(outdir, os.path.basename(fname))
+ final_path = os.path.join(d.prefix, outname)
aliases = t[2]
should_strip = t[3]
install_rpath = t[4]
@@ -414,7 +415,8 @@ def install_targets(d):
printed_symlink_error = True
if os.path.isfile(outname):
try:
- depfixer.fix_rpath(outname, install_rpath, False)
+ depfixer.fix_rpath(outname, install_rpath, final_path,
+ verbose=False)
except SystemExit as e:
if isinstance(e.code, int) and e.code == 0:
pass