|
23 | 23 | import sys |
24 | 24 |
|
25 | 25 |
|
26 | | -UNSIGN_TOOL = "/usr/bin/codesign" |
27 | | - |
28 | | - |
29 | 26 | def ensure_current_version_link(framework_path, short_version): |
30 | 27 | '''Make sure the framework has Versions/Current''' |
31 | 28 | versions_current_path = os.path.join(framework_path, "Versions/Current") |
@@ -128,10 +125,15 @@ def fix_other_things(framework_path, short_version): |
128 | 125 |
|
129 | 126 | def fix_broken_signatures(files_relocatablized): |
130 | 127 | """ |
131 | | - Unsign the binaries and libraries that were relocatablized to avoid |
132 | | - them having corrupted signatures. |
| 128 | + Re-sign the binaries and libraries that were relocatablized with ad-hoc |
| 129 | + signatures to avoid them having invalid signatures and to allow them to |
| 130 | + run on Apple Silicon |
133 | 131 | """ |
| 132 | + CODESIGN_CMD = ["/usr/bin/codesign", |
| 133 | + "-s", "-", "--deep", "--force", |
| 134 | + "--preserve-metadata=identifier,entitlements,flags,runtime"] |
134 | 135 | for pathname in files_relocatablized: |
135 | | - print("Removing signature from %s because it is no longer valid." |
| 136 | + print("Re-signing %s with ad-hoc signature..." |
136 | 137 | % pathname) |
137 | | - subprocess.check_call([UNSIGN_TOOL, "--remove-signature", pathname]) |
| 138 | + cmd = CODESIGN_CMD + [pathname] |
| 139 | + subprocess.check_call(cmd) |
0 commit comments