Strip foreign-architecture code from the macOS bundle (#10063)#10064
Conversation
) The macOS app is built for a single architecture (matching the build machine, via ${ARCH}), but relocatable-python pulls the python.org universal2 installer, so the entire Python.framework ships both arm64 and x86_64 slices. PostgreSQL-sourced dylibs may be universal too. The foreign slice is dead weight that bloats the bundle and DMG. Add a _strip_architecture step, run after _complete_bundle and before code-signing (lipo invalidates signatures, so the existing sign passes re-sign the thinned binaries). It removes the universal2 stragglers (python*-intel64 launcher, config-*-darwin/python.o) and lipo-thins every fat Mach-O in the bundle to the build arch, preserving file modes and warning on anything lacking the target slice. Already single-arch inputs (Electron and its helpers) are skipped.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
WalkthroughThis PR adds ChangesmacOS architecture stripping
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
Reduces the size of the macOS pgAdmin4 app bundle by stripping unused (foreign) CPU architecture slices from universal/fat Mach-O binaries (notably the universal2 Python.framework pulled in via relocatable-python) before code-signing.
Changes:
- Adds
_strip_architecture()to thin fat Mach-O files in the bundle to the build machine’s target architecture and remove universal2 installer stragglers. - Wires the new strip step into the macOS build pipeline before SBOM generation and code-signing.
- Documents the change in the v9.16 release notes (Housekeeping).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| pkg/mac/build.sh | Invokes _strip_architecture after bundle completion and before SBOM/signing. |
| pkg/mac/build-functions.sh | Implements architecture stripping/thinning and removes universal2 Python installer leftovers. |
| docs/en_US/release_notes_9_16.rst | Adds a release note entry for Issue #10063 under Housekeeping. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
The macOS app is built for a single architecture (matching the build machine, via
${ARCH}), butrelocatable-pythonpulls the python.org universal2 installer, so the entirePython.frameworkships botharm64andx86_64slices. PostgreSQL-sourced dylibs (libpq, libssl, ...) may be universal too. The foreign slice is dead weight that bloats the bundle and DMG.Fixes #10063.
Changes
_strip_architecture()inpkg/mac/build-functions.sh, called frombuild.shafter_complete_bundleand before code-signing (lipo invalidates signatures, so the existing_codesign_*passes re-sign the thinned binaries — no extra re-sign needed).python*-intel64launcher and the strayconfig-*-darwin/python.obuild object.lipo -thins every fat Mach-O in the bundle to the build arch, preserving file modes (the+xbit the signing pass relies on) and warning rather than failing on any binary that lacks the target slice.release_notes_9_16.rst.Notes
lipocan only keep a slice that already exists — this strips the build machine's foreign slice from an otherwise-correct build; it does not let anarm64build produce anx86_64bundle or vice versa.Summary by CodeRabbit