feat(macos): support Apple Silicon builds and self-update #132
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/macos-native-build"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
platform_filename()only knew linux-x86_64 and windows-x86_64, so every macOS host fell through to the catch-all arm and hard-errored with "no prebuilt binary for target_os=macos target_arch=aarch64". That brokeyt version checkandyt version updateoutright on macOS and failed 10 tests in the version module. The compile and link were always fine:cargo build --releaseproduces a working arm64 Mach-O today.Add a macos+aarch64 arm mapping to
yt-macos-aarch64and extend the catch-allnot(any(...))to match. Intel macs stay on the catch-all deliberately: no x86_64 darwin artifact is published, and claiming one would turn a clean "no prebuilt binary" error into a 404 partway through an update.Add
.forgejo/workflows/build-macos.ymlto publish the artifact. It is the only build job that does not use Docker, because macOS cannot be containerised and darwin cannot be cross-compiled from Linux without the Apple SDK, so it builds natively viacargo build --release --locked --target aarch64-apple-darwin. It uses BSDdate -uandshasum --algorithm 256(macOS ships nosha256sum; the output is the same<hash> <file>GNU format the sidecar parser already expects), and verifies the artifact is an arm64 Mach-O with a valid ad-hoc signature before uploading. The job targetsvars.RUNS_ON_MACOSand stays inert until a macOS runner is registered under that label.Fix two test portability bugs surfaced by the same run:
/bin/falsedoes not exist on macOS (only/usr/bin/false), so probe both paths; and two assertions were gated behind#[cfg(all(target_os = "linux", target_arch = "x86_64"))], silently skipping their only real check off Linux. They now derive the expected filename fromplatform_filename()so they assert on every platform that resolves one.Full suite is green on macOS arm64 (435 tests). The cfg arms were verified to stay mutually exclusive for x86_64-unknown-linux-musl, x86_64-pc-windows-gnu, aarch64-apple-darwin and x86_64-apple-darwin.