Skip to content

feat(release): build FreeBSD binaries for x86_64 and ARM64 - #221

Open
fxrdhan wants to merge 3 commits into
devfrom
feat/freebsd-release-binary
Open

fxrdhan wants to merge 3 commits into
devfrom
feat/freebsd-release-binary

Conversation

@fxrdhan

@fxrdhan fxrdhan commented Dec 1, 2026 •

Copy link
Copy Markdown
Owner

Summary

Releases had no FreeBSD binary, and packaging/install.sh refused FreeBSD outright. This adds x86_64-unknown-freebsd and aarch64-unknown-freebsd.

  • Build: GitHub has no FreeBSD runner. On its runners a FreeBSD VM runs ARM64 emulated, which is too slow to compile in. So both targets are cross-compiled on ubuntu-latest like any other target. A new composite action, .github/actions/freebsd-sysroot, sets this up:

    • installs clang, lld and llvm-ar;
    • fetches FreeBSD 14.0's base.txz from archive.freebsd.org and checks it against the SHA-256 in that release's MANIFEST;
    • unpacks lib, usr/lib and usr/include as the sysroot;
    • points CC_<target>, AR_<target> and CARGO_TARGET_<TARGET>_LINKER at one clang driver script. It is a script rather than RUSTFLAGS because CI's own RUSTFLAGS would replace those.

    The archive is the only place that still serves 14.0, and it is slow from GitHub's runners. In the first run of this PR the 200 MB download took 41 min for x86_64 and 11 min for ARM64. The build itself took about 70s and each VM run 1–1.5 min, the emulated ARM64 one included. So the verified base.txz is now kept in actions/cache, keyed by its checksum, and fetched only on a cache miss.

    14.0 is the first release of the oldest major release still supported (14 and 15, per freebsd.org/security). zlib is linked from FreeBSD's base system; libgit2 is built from source, as on every other target.

  • Run: each FreeBSD binary then runs in a FreeBSD VM (vmactions/freebsd-vm v1.6.0, the workspace mounted over NFS):

    • the release workflow runs --version on FreeBSD 14;
    • CI's Release Build runs -la@O --git --group, --tree --level=2 and --json --long on FreeBSD 15.

    Between them, both supported major releases run the binaries. CI's build is also the only one that compiles the FreeBSD code paths with --deny warnings.

  • Installer: FreeBSD now maps to unknown-freebsd and downloads the archive for amd64 or arm64. INSTALL.md notes that bash and curl have to come from pkg.

  • cargo-binstall: no change needed. The default tgz format and URL template cover both archives, and binstall_metadata reads the release matrix, so it checks both new rows.

  • CI path filter (separate commit): the suite and Release Build now also run when only release.yml, packaging/**, INSTALL.md or .github/actions/** change.

An earlier push of this PR built x86_64 natively inside a FreeBSD 14.5 VM: 1m55s to compile, then the same smoke run passed. That approach is replaced by the cross build above, so both targets are built the same way and link against the same FreeBSD release.

Type of Change

  • ✨ New feature (non-breaking change adding functionality)
  • 📝 Documentation / Man pages / Completions
  • 🔧 Build / CI / Dependencies

Related Issues & Upstream References

How Has This Been Tested?

  • Testing commands executed: cargo nextest run --test platform_tests -E 'test(binstall) | test(install_script)' (11 passed). The FreeBSD installer tests fail with the install.sh change reverted. Also ran cargo clippy --test platform_tests -- -D warnings, cargo fmt --check, actionlint and yamlfmt -lint on the workflows and the action, and shellcheck on install.sh and the action's script.
  • Platforms verified: macOS (tests). The cross build and the FreeBSD 14/15 runs are verified only by this PR's CI and release dry run.

Contributor Checklist

  • Base branch is set to dev (unless this is a release PR targeting main)
  • My commits follow Conventional Commits format
  • Tests covering the changes have been added/updated
  • cargo clippy --all-targets passes with no warnings (ran on platform_tests only; CI covers the rest)
  • cargo nextest run (or cargo test) passes (ran the platform suites only; CI covers the rest)
  • cargo fmt --check / nix fmt passes
  • License headers (SPDX / REUSE) are properly preserved/added

🤖 Generated with Claude Code

@fxrdhan
fxrdhan force-pushed the feat/freebsd-release-binary branch from 30d9777 to 6c9be4d Compare December 1, 2026 21:37
@fxrdhan fxrdhan changed the title feat(release): build an x86_64 FreeBSD binary feat(release): build FreeBSD binaries for x86_64 and ARM64 Dec 1, 2026
fxrdhan and others added 3 commits December 2, 2026 05:26
GitHub has no FreeBSD runner, and a FreeBSD virtual machine on one runs
ARM64 emulated, too slow to build in. So the release workflow builds
x86_64-unknown-freebsd and aarch64-unknown-freebsd on ubuntu-latest
like any other target, after a new composite action,
.github/actions/freebsd-sysroot, points cargo and the cc crate at clang
and lld with FreeBSD 14.0's base system as the sysroot. 14.0 is the
first release of the oldest major release still supported; its
base.txz is fetched from the FreeBSD archive, which alone still serves
it and slowly (200 MB took 41 minutes on one run), so it is cached
under the checksum its MANIFEST gives and checked against it each run.

Each binary then runs in a FreeBSD virtual machine (vmactions/freebsd-vm,
the workspace mounted over NFS): --version on FreeBSD 14 before a
release, and in CI's Release Build on FreeBSD 15 a long listing of the
checkout with xattrs, flags and Git, a tree and JSON. That build is
also the one place the FreeBSD code paths are held to no warnings.

The binstall metadata needs no change: the default tgz format and URL
template cover both archives, which the binstall tests read from the
release matrix.

Upstream: eza-community#1999

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The installer refused FreeBSD as an unknown system. It now asks the
release for the <arch>-unknown-freebsd archive, on amd64 and arm64 as
uname -m names them there. NetBSD stands in as the unknown system in
the refusal test.

INSTALL.md says the script needs bash and curl from pkg there, neither
being in FreeBSD's base system.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
binstall_metadata reads the release workflow's matrix of targets, and
install_script runs packaging/install.sh and checks INSTALL.md lists
the archive it takes. Release Build cross-compiles FreeBSD with the
action under .github/actions. A pull request that touched only those
files skipped the jobs that check them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@fxrdhan
fxrdhan force-pushed the feat/freebsd-release-binary branch from 6c9be4d to 827dfb8 Compare December 1, 2026 22:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant