mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-05-24 05:40:15 +00:00
build: pass zig exe path to combine_archives
`combine_archives` spawns `zig ar -M` to combine static archives via an MRI script. It hard-coded the command name `"zig"` and relied on the binary being on `PATH`, which fails on Windows when the build is driven by an absolute zig.exe path (common in CI and in Scoop/winget installs where PATH isn't populated at build time). The failure surfaces as `error: FileNotFound` from `Child.spawn`. Pass `b.graph.zig_exe` as the first argument so the tool always uses the exact zig binary that is driving the build, matching how other build tools in this repo spawn zig subcommands.
This commit is contained in:
@@ -339,6 +339,7 @@ fn combineArchives(
|
||||
}),
|
||||
});
|
||||
const run = b.addRunArtifact(tool);
|
||||
run.addArg(b.graph.zig_exe);
|
||||
const output = run.addOutputFileArg("libghostty-vt.a");
|
||||
for (sources) |source| run.addFileArg(source);
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
//! available on Windows. This tool handles both the script generation
|
||||
//! and the piping in a single cross-platform executable.
|
||||
//!
|
||||
//! Usage: combine_archives <output.a> <input1.a> [input2.a ...]
|
||||
//! Usage: combine_archives <zig_exe> <output.a> <input1.a> [input2.a ...]
|
||||
|
||||
const std = @import("std");
|
||||
|
||||
@@ -16,13 +16,14 @@ pub fn main() !void {
|
||||
const alloc = gpa.allocator();
|
||||
|
||||
const args = try std.process.argsAlloc(alloc);
|
||||
if (args.len < 3) {
|
||||
std.log.err("usage: combine_archives <output> <input...>", .{});
|
||||
if (args.len < 4) {
|
||||
std.log.err("usage: combine_archives <zig_exe> <output> <input...>", .{});
|
||||
std.process.exit(1);
|
||||
}
|
||||
|
||||
const output_path = args[1];
|
||||
const inputs = args[2..];
|
||||
const zig_exe = args[1];
|
||||
const output_path = args[2];
|
||||
const inputs = args[3..];
|
||||
|
||||
// Build the MRI script.
|
||||
var script: std.ArrayListUnmanaged(u8) = .empty;
|
||||
@@ -36,7 +37,7 @@ pub fn main() !void {
|
||||
}
|
||||
try script.appendSlice(alloc, "SAVE\nEND\n");
|
||||
|
||||
var child: std.process.Child = .init(&.{ "zig", "ar", "-M" }, alloc);
|
||||
var child: std.process.Child = .init(&.{ zig_exe, "ar", "-M" }, alloc);
|
||||
child.stdin_behavior = .Pipe;
|
||||
child.stdout_behavior = .Inherit;
|
||||
child.stderr_behavior = .Inherit;
|
||||
|
||||
Reference in New Issue
Block a user