Files
woiken-sandboxes/build.rs
T

20 lines
741 B
Rust

// Cross-compile the static guest helper (Go makes linux/arm64 static binaries trivially).
use std::process::Command;
fn main() {
println!("cargo:rerun-if-changed=guest"); // a directory: cargo watches everything in it
let out = std::path::PathBuf::from(std::env::var("OUT_DIR").unwrap()).join("wsbx-guest");
let ok = Command::new("go")
.args(["build", "-trimpath", "-ldflags=-s -w", "-o"])
.arg(&out)
.arg(".")
.current_dir("guest")
.env("GOOS", "linux")
.env("GOARCH", "arm64")
.env("CGO_ENABLED", "0")
.status()
.expect("Go is required to build the guest helper (brew install go)")
.success();
assert!(ok, "go build guest helper failed");
}