Commit 43be523
authored
Create a universal binary for macos. (#12)
* Build universal2 macOS binaries with PyInstaller
Replace separate macos-amd64 (macos-13) and macos-aarch64 builds with
a single universal2 build on macos-latest. The fat binary works natively
on both Intel and Apple Silicon Macs.
Upload the archive under both legacy names (macos-aarch64, macos-amd64)
for backwards compatibility.
Add verification step using lipo and arch -x86_64 to confirm both
architectures work.
* Install universal2 Python from python.org for macOS build
The setup-python action installs arm64-only Python on macOS ARM
runners, causing PyInstaller to fail with "not a fat binary" errors
when building universal2 binaries.
Install the official python.org universal2 framework build instead,
so all native extensions (bitarray, cryptography, etc.) are compiled
as fat binaries.
* Fix macOS Python setup: add python/pip symlinks
The python.org installer only provides python3/pip3 binaries.
Create symlinks so bare 'python' and 'pip' commands work.
Also fix comment about why we use python.org instead of setup-python.
* Force universal2 native extensions via ARCHFLAGS + no-binary
Pip downloads arm64-only wheels on ARM runners regardless of whether
Python itself is universal2. Use --no-binary :all: with ARCHFLAGS to
compile native extensions (bitarray, cffi, pyyaml, tibs) as fat
binaries for the universal2 PyInstaller build.
* Revert to setup-python for macOS
The python.org manual install is unnecessary — setup-python already
installs universal2 Python. The ARCHFLAGS + --no-binary fix handles
the actual problem (pip's wheel selection).
* Add hidden import for bitstring.bitstore_bitarray
bitstring 4.4.0 dynamically imports bitstore_bitarray, which
PyInstaller doesn't detect. Add --hidden-import for esptool and
espefuse builds.
* Use --collect-submodules bitstring instead of individual hidden imports
bitstring 4.4.0 has many dynamically imported submodules. Collect them
all rather than chasing individual ones.
* Only force-rebuild specific packages as universal2, not all
--no-binary :all: breaks cryptography (needs Rust toolchain).
Instead, install normally first, then force-reinstall only the
packages that don't publish universal2 wheels (bitarray, cffi,
pyyaml, tibs) from source with ARCHFLAGS.
* Add x86_64-apple-darwin Rust target for tibs cross-compilation
tibs uses maturin/Rust and needs the x86_64 target to build a
universal2 fat binary on an ARM runner.
* Fix cross-build: install Rust via rustup, collect bitstring submodules
tibs 0.5.7 requires Rust edition 2024, but the ubuntu 22.04 apt
package only provides Cargo 1.75.0. Install Rust via rustup to get
a recent enough version.
Also add --collect-submodules bitstring for the same PyInstaller
hidden import issue as the main build.
* Fix cross-build: remove comment inside line continuation
A shell comment inside a backslash-continued apt-get command broke
the line continuation, causing 'build-essential: command not found'.
* Add comment explaining --collect-submodules bitstring1 parent d45c7fd commit 43be523
2 files changed
Lines changed: 63 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
79 | | - | |
80 | 79 | | |
81 | 80 | | |
82 | 81 | | |
| |||
97 | 96 | | |
98 | 97 | | |
99 | 98 | | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
100 | 102 | | |
101 | 103 | | |
102 | 104 | | |
103 | 105 | | |
104 | 106 | | |
105 | 107 | | |
106 | 108 | | |
107 | | - | |
108 | | - | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
109 | 112 | | |
110 | 113 | | |
111 | 114 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
| 28 | + | |
32 | 29 | | |
33 | 30 | | |
34 | 31 | | |
| |||
77 | 74 | | |
78 | 75 | | |
79 | 76 | | |
| 77 | + | |
80 | 78 | | |
81 | 79 | | |
82 | 80 | | |
83 | | - | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
84 | 92 | | |
85 | 93 | | |
86 | 94 | | |
| |||
97 | 105 | | |
98 | 106 | | |
99 | 107 | | |
| 108 | + | |
100 | 109 | | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
105 | 119 | | |
106 | 120 | | |
107 | 121 | | |
| |||
139 | 153 | | |
140 | 154 | | |
141 | 155 | | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
142 | 165 | | |
143 | 166 | | |
144 | 167 | | |
| |||
168 | 191 | | |
169 | 192 | | |
170 | 193 | | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
0 commit comments