From 42dfae8db1ec4d0d1486215b2b364003149c28ba Mon Sep 17 00:00:00 2001 From: Los Date: Tue, 4 Aug 2026 20:28:54 +0800 Subject: [PATCH] fix(build): guide users when zig is missing 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. --- build.rs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/build.rs b/build.rs index 66ed262012..11a7e2ac15 100644 --- a/build.rs +++ b/build.rs @@ -58,7 +58,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") @@ -74,7 +74,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}"