mirror of
https://github.com/servo/servo.git
synced 2025-08-07 22:45:34 +01:00
Auto merge of #11911 - ConnorGBrewster:app_packaging, r=larsbergstrom
Fix dylib relinking issue <!-- Please describe your changes on the following line: --> I had to run `install_name_tool` on some dylibs for their deps and not just on the servo binary itself. I have checked and Servo.app runs on machines without extra things installed (ex. harfbuzz). --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #11907 (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [X] These changes do not require tests because fixing mac packaging. <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11911) <!-- Reviewable:end -->
This commit is contained in:
commit
f6db3518ca
1 changed files with 25 additions and 18 deletions
|
@ -43,7 +43,10 @@ def otool(s):
|
||||||
|
|
||||||
|
|
||||||
def install_name_tool(old, new, binary):
|
def install_name_tool(old, new, binary):
|
||||||
subprocess.call(['install_name_tool', '-change', old, '@executable_path/' + new, binary])
|
try:
|
||||||
|
subprocess.check_call(['install_name_tool', '-change', old, '@executable_path/' + new, binary])
|
||||||
|
except subprocess.CalledProcessError as e:
|
||||||
|
print("install_name_tool exited with return value %d" % e.returncode)
|
||||||
|
|
||||||
|
|
||||||
@CommandProvider
|
@CommandProvider
|
||||||
|
@ -108,23 +111,27 @@ class PackageCommands(CommandBase):
|
||||||
shutil.copy2(dir_to_resources + 'package-prefs.json', dir_to_resources + 'prefs.json')
|
shutil.copy2(dir_to_resources + 'package-prefs.json', dir_to_resources + 'prefs.json')
|
||||||
delete(dir_to_resources + '/package-prefs.json')
|
delete(dir_to_resources + '/package-prefs.json')
|
||||||
|
|
||||||
print("Finding dylibs to be copied")
|
print("Finding dylibs and relinking")
|
||||||
need = set([dir_to_app + '/Contents/MacOS/servo'])
|
need_checked = set([dir_to_app + '/Contents/MacOS/servo'])
|
||||||
done = set()
|
checked = set()
|
||||||
|
while need_checked:
|
||||||
while need:
|
checking = set(need_checked)
|
||||||
needed = set(need)
|
need_checked = set()
|
||||||
need = set()
|
for f in checking:
|
||||||
for f in needed:
|
# No need to check these for their dylibs
|
||||||
need.update(otool(f))
|
if '/System/Library' in f or '/usr/lib' in f:
|
||||||
done.update(needed)
|
continue
|
||||||
need.difference_update(done)
|
need_relinked = set(otool(f))
|
||||||
|
new_path = dir_to_app + '/Contents/MacOS/' + f.split('/')[-1]
|
||||||
print("Copying dylibs")
|
if not os.path.exists(new_path):
|
||||||
for f in sorted(done):
|
shutil.copyfile(f, new_path)
|
||||||
if '/System/Library' not in f and '/usr/lib' not in f and 'servo' not in f:
|
for dylib in need_relinked:
|
||||||
shutil.copyfile(f, dir_to_app + '/Contents/MacOS/' + f.split('/')[-1])
|
if '/System/Library' in dylib or '/usr/lib' in dylib or 'servo' in dylib:
|
||||||
install_name_tool(f, f.split('/')[-1], dir_to_app + '/Contents/MacOS/servo')
|
continue
|
||||||
|
install_name_tool(dylib, dylib.split('/')[-1], new_path)
|
||||||
|
need_checked.update(need_relinked)
|
||||||
|
checked.update(checking)
|
||||||
|
need_checked.difference_update(checked)
|
||||||
|
|
||||||
print("Writing run-servo")
|
print("Writing run-servo")
|
||||||
bhtml_path = path.join('${0%/*}/../Resources', browserhtml_path.split('/')[-1], 'out', 'index.html')
|
bhtml_path = path.join('${0%/*}/../Resources', browserhtml_path.split('/')[-1], 'out', 'index.html')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue