Build darwin-arm64 build during make dist-macos
#500
Merged
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.
The PR edits the
make dist-macos
script to also compile adarwin-arm64
build of litestream.It works by applying the appropriate
GOOS
/GOARCH
/CGO_ENABLED
env vars. But theCC="gcc -target arm64-apple-macos11"
env var does the real heavy lifting. The-target
is an apple clang-specific flag that allows you to cross compilearm64
M1/M2 targets from ax86_64
computer. I've used it in the past to cross compile Go binaries from a MacOS Github Action runner, in thissqlite-http
workflow (binaries available here).I tested this manually on my MacOS 12.3.1 x86_64 laptop. I then
scp
'ed the compiled file to my Mac M1 Mini, and was able to successfully run it. Runningfile litestream
on thedarwin-arm64
output shows it's a"Mach-O 64-bit executable arm64"
, while the previous "normal" compiler reports"Mach-O 64-bit executable x86_64"
.More than happy to move it to a separate
dist-macos-arm64
Makefile target if you'd like. I re-used thegon
andopenssl
from theamd64
target, so I think it will work?