Add amd64/arm64 cross-compilation for the rax binary
Summary
- New
make build-amd64/build-arm64/build-alltargets cross-compile theraxbinary for either architecture from either an amd64 or arm64 build host. PureGOOS/GOARCHenv vars,CGO_ENABLED=0pinned explicitly — no cross C toolchain, no qemu needed, sincemodernc.org/sqlitehas no cgo dependency. Verified both binaries build andmake cleanremoves all of them (rax,rax-linux-amd64,rax-linux-arm64). -
.gitignoreupdated for the new arch-suffixed binary names. - README documents the cross-compile targets.
Docker image: still amd64-only, and why
I initially tried making the Dockerfile itself multi-arch (--platform=$BUILDPLATFORM + TARGETOS/TARGETARCH build args) but hit a real problem: hop179's own base images (cr.klab.sh/base/go:1.26.3, cr.klab.sh/base/abi:edge) are published as single-arch amd64 manifests, no arm64 variant. Building with --platform linux/arm64 against them doesn't fail — buildx silently falls back to the amd64 base under QEMU emulation and mislabels the resulting image as arm64 (Docker itself warns InvalidBaseImagePlatform — confirmed by actually running the build). The binary inside would likely still run (it's static), but the image is not a real multi-arch image and the mismatch is exactly the kind of thing that bites someone later.
That's a base-image gap outside this repo — either cr.klab.sh/base/go/abi:edge need an arm64 variant published, or the runner stage would need to move off them to a genuinely multi-arch minimal base (e.g. scratch/distroless, since the binary is fully static). Left the Dockerfile as-is (amd64-only, unchanged) and documented the binary cross-build as the current arm64 deployment path in the README, with the base-image gap noted as a follow-up for whoever maintains cr.klab.sh.
Test plan
-
gofmt -l .clean -
go build ./...,go vet ./...,go test ./... -
make build-amd64/make build-arm64/make build-all— both binaries build successfully -
make cleanremoves all built binaries -
Confirmed via docker buildx build --platform linux/arm64 .that the Dockerfile's base images are amd64-only (reverted that experiment; not shipping it)