From 839dcc5aed2c51111269c29ca175136ff70084ee Mon Sep 17 00:00:00 2001 From: wangqr Date: Wed, 6 May 2020 13:14:06 -0400 Subject: [PATCH] Handle @loader_path in libboost on macOS See wangqr/Aegisub#39 --- tools/osx-fix-libs.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tools/osx-fix-libs.py b/tools/osx-fix-libs.py index 198395fea..e29c8180f 100755 --- a/tools/osx-fix-libs.py +++ b/tools/osx-fix-libs.py @@ -10,6 +10,7 @@ import subprocess is_bad_lib = re.compile(r'(/usr/local|/opt)').match is_sys_lib = re.compile(r'(/usr|/System)').match otool_libname_extract = re.compile(r'\s+(/.*?)[(\s:]').search +otool_loader_path_extract = re.compile(r'\s+@loader_path/(.*?)[(\s:]').search goodlist = [] badlist = [] link_map = {} @@ -28,9 +29,14 @@ def collectlibs(lib, masterlist, targetdir): for l in liblist: lr = otool_libname_extract(l) - if not lr: - continue - l = lr.group(1) + if lr: + l = lr.group(1) + else: + lr = otool_loader_path_extract(l) + if lr: + l = os.path.join(os.path.dirname(lib), lr.group(1)) + else: + continue if is_bad_lib(l) and l not in badlist: badlist.append(l) if ((not is_sys_lib(l)) or is_bad_lib(l)) and l not in masterlist: