fix(build): guide users when zig is missing (#2281)

build.rs now reports how to install Zig 0.15.2 (brew install zig@0.15
on macOS, ziglang.org elsewhere) and mentions the ZIG environment
variable instead of panicking with a bare NotFound error.

Co-authored-by: JJ Liebig <jonathan.liebig@gmail.com>
This commit is contained in:
Hopkins
2026-09-01 21:26:58 +02:00
committed by GitHub
co-authored by JJ Liebig
parent da8c7b05f9
commit 98307c509e
+13 -2
View File
@@ -61,7 +61,7 @@ fn main() {
.to_string();
let zig = env::var("ZIG").unwrap_or_else(|_| "zig".into());
let mut command = Command::new(zig);
let mut command = Command::new(&zig);
command
.arg("build")
.arg("-Demit-lib-vt")
@@ -77,7 +77,18 @@ fn main() {
let status = command
.current_dir(&vendored_dir)
.status()
.expect("failed to execute zig build for vendored libghostty-vt");
.unwrap_or_else(|err| {
if err.kind() == std::io::ErrorKind::NotFound {
panic!(
"zig executable not found (looked for {zig:?}; set the ZIG \
environment variable to point at the zig binary). Building \
the vendored libghostty-vt requires Zig 0.15.2: on macOS run \
`brew install zig@0.15`, elsewhere install it from \
https://ziglang.org/download/, then retry the build"
);
}
panic!("failed to execute zig build for vendored libghostty-vt: {err}");
});
assert!(
status.success(),
"zig build for vendored libghostty-vt failed: {status}"