mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 05:44:20 +00:00
build: Use the new b.addFail() for the update-mingw step.
This is precisely the kind of use case it was added for.
This commit is contained in:
parent
019c0fc184
commit
4a2b23c2be
1 changed files with 11 additions and 12 deletions
23
build.zig
23
build.zig
|
|
@ -537,21 +537,20 @@ pub fn build(b: *std.Build) !void {
|
|||
|
||||
const update_mingw_step = b.step("update-mingw", "Update zig's bundled mingw");
|
||||
const opt_mingw_src_path = b.option([]const u8, "mingw-src", "path to mingw-w64 source directory");
|
||||
const update_mingw_exe = b.addExecutable(.{
|
||||
.name = "update_mingw",
|
||||
.target = b.graph.host,
|
||||
.root_source_file = b.path("tools/update_mingw.zig"),
|
||||
});
|
||||
const update_mingw_run = b.addRunArtifact(update_mingw_exe);
|
||||
update_mingw_run.addDirectoryArg(b.path("lib"));
|
||||
if (opt_mingw_src_path) |mingw_src_path| {
|
||||
const update_mingw_exe = b.addExecutable(.{
|
||||
.name = "update_mingw",
|
||||
.target = b.graph.host,
|
||||
.root_source_file = b.path("tools/update_mingw.zig"),
|
||||
});
|
||||
const update_mingw_run = b.addRunArtifact(update_mingw_exe);
|
||||
update_mingw_run.addDirectoryArg(b.path("lib"));
|
||||
update_mingw_run.addDirectoryArg(.{ .cwd_relative = mingw_src_path });
|
||||
} else {
|
||||
// Intentionally cause an error if this build step is requested.
|
||||
update_mingw_run.addArg("--missing-mingw-source-directory");
|
||||
}
|
||||
|
||||
update_mingw_step.dependOn(&update_mingw_run.step);
|
||||
update_mingw_step.dependOn(&update_mingw_run.step);
|
||||
} else {
|
||||
update_mingw_step.dependOn(&b.addFail("The -Dmingw-src=... option is required for this step").step);
|
||||
}
|
||||
}
|
||||
|
||||
fn addWasiUpdateStep(b: *std.Build, version: [:0]const u8) !void {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue