summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2022-06-16 21:03:20 +0200
committerFlorian Bruhin <me@the-compiler.org>2022-06-16 21:03:20 +0200
commit660e776a15c02f5577d7aca075bb0e3f8b142831 (patch)
tree5dd72c7ce42ccc42faa5b8b83568330402b5a5e3
parent611a6d5cb2f15182e14c2249d1b5cedc44385878 (diff)
downloadqutebrowser-660e776a15c02f5577d7aca075bb0e3f8b142831.tar.gz
qutebrowser-660e776a15c02f5577d7aca075bb0e3f8b142831.zip
build-release: Sign macOS .app properly
Based on https://github.com/pyinstaller/pyinstaller/issues/6612 Might help with #6771.
-rwxr-xr-xscripts/dev/build_release.py48
1 files changed, 43 insertions, 5 deletions
diff --git a/scripts/dev/build_release.py b/scripts/dev/build_release.py
index 0529645a5..f7efd7f28 100755
--- a/scripts/dev/build_release.py
+++ b/scripts/dev/build_release.py
@@ -239,15 +239,17 @@ def verify_windows_exe(exe_path: pathlib.Path) -> None:
def patch_mac_app() -> None:
- """Patch .adpp to save some space."""
+ """Patch .app to save some space and make it signable."""
dist_path = pathlib.Path('dist')
app_path = dist_path / 'qutebrowser.app'
+ contents_path = app_path / 'Contents'
+ macos_path = contents_path / 'MacOS'
+ resources_path = contents_path / 'Resources'
+ pyqt_path = macos_path / 'PyQt5'
+
# Replace some duplicate files by symlinks
- framework_path = (
- app_path / 'Contents' / 'MacOS' / 'PyQt5' / 'Qt5' / 'lib' /
- 'QtWebEngineCore.framework'
- )
+ framework_path = pyqt_path / 'Qt5' / 'lib' / 'QtWebEngineCore.framework'
core_lib = framework_path / 'Versions' / '5' / 'QtWebEngineCore'
core_lib.unlink()
@@ -263,6 +265,40 @@ def patch_mac_app() -> None:
file_path.unlink()
file_path.symlink_to(target)
+ # Move stuff around to make things signable on macOS
+ # See https://github.com/pyinstaller/pyinstaller/issues/6612
+ pyqt_path_dest = resources_path / pyqt_path.name
+ shutil.move(pyqt_path, pyqt_path_dest)
+ pyqt_path_target = pathlib.Path("..") / pyqt_path_dest.relative_to(contents_path)
+ pyqt_path.symlink_to(pyqt_path_target)
+
+ for path in macos_path.glob("Qt*"):
+ link_path = resources_path / path.name
+ target_path = pathlib.Path("..") / path.relative_to(contents_path)
+ link_path.symlink_to(target_path)
+
+
+def sign_mac_app() -> None:
+ """Re-sign and verify the Mac .app."""
+ app_path = pathlib.Path('dist') / 'qutebrowser.app'
+ subprocess.run([
+ 'codesign',
+ '-s', '-',
+ '--force',
+ '--timestamp',
+ '--deep',
+ '--verbose',
+ app_path,
+ ], check=True)
+ subprocess.run([
+ 'codesign',
+ '--verify',
+ '--strict',
+ '--deep',
+ '--verbose',
+ app_path,
+ ], check=True)
+
def _mac_bin_path(base: pathlib.Path) -> pathlib.Path:
"""Get the macOS qutebrowser binary path."""
@@ -294,6 +330,8 @@ def build_mac(
call_tox('pyinstaller-64', '-r', debug=debug)
utils.print_title("Patching .app")
patch_mac_app()
+ utils.print_title("Re-signing .app")
+ sign_mac_app()
dist_path = pathlib.Path("dist")