mirror of
https://github.com/kiwix/kiwix-tools.git
synced 2025-09-26 13:50:33 -04:00
fix rpath on kiwix binaries
This commit is contained in:
parent
8feb6d7a98
commit
11283444a7
@ -19,14 +19,20 @@ if not os.path.exists(component):
|
||||
print(u"Unable to access component at: %s" % component)
|
||||
exit(1)
|
||||
|
||||
if not component.endswith('.dylib'):
|
||||
print(u"%s is not a dylib component" % component)
|
||||
exit(1)
|
||||
# we'll also allow binaries to be fixed.
|
||||
#
|
||||
# if not component.endswith('.dylib'):
|
||||
# print(u"%s is not a dylib component" % component)
|
||||
# exit(1)
|
||||
|
||||
print("Fixing %s..." % component)
|
||||
|
||||
basename = os.path.basename(component)
|
||||
name, ext = basename.rsplit('.', 1)
|
||||
try:
|
||||
name, ext = basename.rsplit('.', 1)
|
||||
except ValueError:
|
||||
name = basename
|
||||
ext = ''
|
||||
libname = u'lib%s%s.0.dylib' % (name[0].upper(), name[1:])
|
||||
|
||||
# run otool to get a list of deps.
|
||||
@ -38,7 +44,8 @@ for line in otool_out.split('\n'):
|
||||
or 'libSystem' in line
|
||||
or 'libstdc++' in line
|
||||
or ':' in line
|
||||
or not len(line)):
|
||||
or not len(line)
|
||||
or 'aria2c' in basename):
|
||||
continue
|
||||
path, junk = line.strip().split(' (', 1)
|
||||
# erroneous_links.append(path)
|
||||
@ -54,7 +61,9 @@ for line in otool_out.split('\n'):
|
||||
# is it a library link?
|
||||
match = re.match(r'lib([a-z\_\-\d]+)([\.?\d]*)\.dylib', _basename)
|
||||
if match:
|
||||
print("match: %s" % match.groups()[0])
|
||||
newpath = u'@executable_path/../Frameworks/lib%s.dylib' % match.groups()[0]
|
||||
print('install_name_tool -change %s %s %s' % (path, newpath, component))
|
||||
os.system('install_name_tool -change %s %s %s' % (path, newpath, component))
|
||||
continue
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user