feat(xtask): cross-platform release build via cargo-zigbuild
Some checks failed
CI / Test (Linux) (push) Has been cancelled
CI / Test (Windows MSVC) (push) Has been cancelled
CI / Clippy (push) Has been cancelled
CI / Format (push) Has been cancelled

Replace build-all.sh shell script with a Rust xtask workspace member.
Uses cargo-zigbuild + zig as a universal cross-linker -- no VMs, no
containers, no root required.

Produces all three release binaries from a single FreeBSD machine:
  anvil-X.Y.Z-freebsd-x86_64.tar.gz  (native cargo build)
  anvil-X.Y.Z-linux-x86_64.tar.gz    (cargo zigbuild)
  anvil-X.Y.Z-windows-x86_64.zip     (cargo zigbuild)

Commands:
  cargo xtask --fix     install zig, zip, cargo-zigbuild, rustup targets
  cargo xtask --check   verify all dependencies
  cargo xtask           build all three binaries + SHA256SUMS
  cargo xtask --clean   remove cross-compile artifacts
  cargo xtask --suffix rc1  build with version suffix

Also converts Cargo.toml to a workspace (members: anvil, xtask).
build-all.sh retained as a thin wrapper around cargo xtask.
This commit is contained in:
Eric Ratliff
2026-03-16 19:54:33 -05:00
parent 13ab202880
commit e7995de547
8 changed files with 768 additions and 209 deletions

View File

@@ -1019,6 +1019,7 @@ fn is_freebsd() -> bool {
cfg!(target_os = "freebsd")
}
#[cfg(unix)]
fn serial_group_name() -> &'static str {
if is_freebsd() {
"dialer"
@@ -1027,6 +1028,7 @@ fn serial_group_name() -> &'static str {
}
}
#[cfg(unix)]
fn serial_group_fix_command() -> String {
if is_freebsd() {
"sudo pw groupmod dialer -m $USER".to_string()
@@ -1071,6 +1073,8 @@ fn check_operator_group() -> bool {
}
}
#[cfg(unix)]
#[allow(dead_code)]
fn whoami() -> String {
std::process::Command::new("whoami")
.output()