diff --git a/build.zig b/build.zig index 085201e954..e67ba0a9d1 100644 --- a/build.zig +++ b/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 {