don't add duplicate rpath
This commit is contained in:
@@ -25,9 +25,22 @@ for binary, dependencies in dependency_map.items():
|
||||
|
||||
is_framework = '.framework' in binary
|
||||
if binary == app_binary:
|
||||
print('\tAdding rpath: @loader_path/../Frameworks')
|
||||
if not dry_run:
|
||||
print('\t' + subprocess.check_output(['install_name_tool', '-add_rpath', '@loader_path/../Frameworks', binary], text=True))
|
||||
# check if a new rpath is needed
|
||||
new_rpath = '@loader_path/../Frameworks'
|
||||
|
||||
has_rpath = False
|
||||
lines = reversed(subprocess.check_output(["otool", "-l", binary], text=True).splitlines())
|
||||
for line in lines:
|
||||
if line.strip().startswith('path '):
|
||||
existing_rpath = line.strip()[len('path '):line.strip().find('(') - 1]
|
||||
if existing_rpath == new_rpath:
|
||||
has_rpath = True
|
||||
else:
|
||||
break
|
||||
if not has_rpath:
|
||||
print('\tAdding rpath: ' + new_rpath)
|
||||
if not dry_run:
|
||||
print('\t' + subprocess.check_output(['install_name_tool', '-add_rpath', new_rpath, binary], text=True))
|
||||
for dependency in dependencies:
|
||||
end_index = dependency.index('(')
|
||||
dep = dependency[0:end_index].strip()
|
||||
|
Reference in New Issue
Block a user