contrib/osx: add native arm64 (Apple Silicon) build support#10745
Open
ssotomayor wants to merge 1 commit into
Open
contrib/osx: add native arm64 (Apple Silicon) build support#10745ssotomayor wants to merge 1 commit into
ssotomayor wants to merge 1 commit into
Conversation
Adds an arm64 macOS build, cross-compiled on the existing x86_64 build
host, selected via a new ELECTRUM_MACOS_ARCH env var. Default remains
x86_64, and that path is unchanged (byte-identical output) when the var
is unset.
- make_osx.sh: ELECTRUM_MACOS_ARCH={x86_64,arm64}. In arm64 mode the
native deps (libsecp256k1, zbar, libusb) and C extensions are compiled
universal2 (-arch x86_64 -arch arm64), so PyInstaller can still import
them on the x86_64 host during its Analysis step; the app bundle is
then thinned to arm64. A post-build check verifies every Mach-O in the
bundle is thin arm64.
- make_universal_qt.py (new): PyQt6-Qt6 ships no universal2 wheel, only
thin per-arch ones. This downloads both hash-pinned thin wheels (from
the hashes already pinned in requirements-binaries-mac.txt) and
lipo-merges each Mach-O into universal2 in the venv, so PyInstaller has
an arm64 slice to thin. The merge cannot affect shipped bytes: every
shipped Qt file is either a verbatim slice of a hash-pinned wheel or a
fat container that is thinned back to the wheel's exact bytes.
- pyinstaller.spec: target_arch follows ELECTRUM_MACOS_ARCH.
- apply_sigs.sh: detect the arch per file via 'lipo -archs' instead of
hardcoding x86_64, so the detached-signature flow works for arm64
Mach-O files.
- sign_osx.sh / make_osx.sh: the arm64 artifact is named
electrum-<version>-arm64.dmg.
We ship separate thin per-arch binaries rather than a universal2 bundle:
this keeps the existing x86_64 release untouched and keeps the
extract_sigs/apply_sigs detached-signature flow on the simple
single-signature (thin) path.
Ref spesmilo#7557.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Native Apple Silicon (arm64) macOS build
Ref #7557. Adds an arm64 macOS build, cross-compiled on the existing x86_64 host. The x86_64 path is unchanged (byte-identical) when
ELECTRUM_MACOS_ARCHis unset.Approach
ELECTRUM_MACOS_ARCHenv var (x86_64default,arm64opt-in). In arm64 mode, native deps + C extensions build universal2 (so PyInstaller can import them on the x86_64 host);pyinstaller.specthen sets PyInstaller'starget_arch(--target-architecture) to thin the bundle down to arm64.PyQt6-Qt6has no universal2 wheel, somake_universal_qt.pylipo-merges the two hash-pinned thin wheels in the venv..dmgs (not universal2), keeping the x86_64 release and theextract_sigs/apply_sigsflow untouched.apply_sigs.sh: detect arch per file (lipo -archs) instead of hardcodingx86_64.Verified (x86_64 host, Xcode CLT 13.2, Big Sur, python.org 3.12.10)
.app(95be818c…, emptydiff).sign_osx.sh→compare_dmg IS_NOTARIZED=false→DMGs match. success.Note: Homebrew no longer supports macOS 11 (Tier 3) and fails to build several required tools from source on Big Sur, so I installed
autoconf/automake/libtool/gettext/pkgconfig/coreutilsvia MacPorts.