diff options
| author | Hopkins <kknkkk@hotmail.com> | 2026-09-02 03:26:58 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-09-01 21:26:58 +0200 |
| commit | 98307c509e9688575d006b47d26d0db561cda0a4 (patch) | |
| tree | a8f373790ff3116b263dae32b8de9bd96b8e09e3 /build.rs | |
| parent | da8c7b05f9ef7898cfb7494989df8a533b947bb9 (diff) | |
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>
Diffstat (limited to 'build.rs')
| -rw-r--r-- | build.rs | 15 |
1 files changed, 13 insertions, 2 deletions
@@ -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}" |
