Skip to content

Commit 411321a

Browse files
committed
fix build.zig for newer zig versions
1 parent 5509e62 commit 411321a

File tree

1 file changed

+23
-9
lines changed

1 file changed

+23
-9
lines changed

build.zig

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,50 @@
11
const std = @import("std");
22

33
pub fn build(b: *std.Build) void {
4+
const target = b.resolveTargetQuery(.{});
5+
const optimize = b.standardOptimizeOption(.{});
6+
47
const verifier = b.addExecutable(.{
58
.name = "verifier",
6-
.root_source_file = .{ .path = "tools/verifier.zig" },
9+
.target = target,
10+
.optimize = optimize,
11+
.root_source_file = .{ .src_path = .{ .owner = b, .sub_path = "tools/verifier.zig" } },
712
});
813
const adder = b.addExecutable(.{
914
.name = "adder",
10-
.root_source_file = .{ .path = "tools/adder.zig" },
15+
.target = target,
16+
.optimize = optimize,
17+
.root_source_file = .{ .src_path = .{ .owner = b, .sub_path = "tools/adder.zig" } },
1118
});
1219

13-
const verify = verifier.run();
14-
const add = adder.run();
20+
const verify = b.addRunArtifact(verifier);
21+
const add = b.addRunArtifact(adder);
1522

1623
const verify_step = b.step("verify", "Verifies if the repository structure is sane and valid.");
1724
verify_step.dependOn(&verify.step);
1825

1926
const add_step = b.step("add", "Adds a new package");
2027
add_step.dependOn(&add.step);
2128

22-
try buildToolsFixer(b);
29+
try buildToolsFixer(b, target, optimize);
2330
}
2431

25-
fn buildToolsFixer(b: *std.build.Builder) !void {
32+
fn buildToolsFixer(
33+
b: *std.Build,
34+
target: std.Build.ResolvedTarget,
35+
optimize: std.builtin.OptimizeMode,
36+
) !void {
2637
const exe = b.addExecutable(.{
2738
.name = "fix",
28-
.root_source_file = .{ .path = "tools/fixer.zig" },
39+
.target = target,
40+
.optimize = optimize,
41+
.root_source_file = .{ .src_path = .{ .owner = b, .sub_path = "tools/fixer.zig" } },
2942
});
30-
exe.linkSystemLibrary("libcurl");
43+
44+
exe.linkSystemLibrary("curl");
3145
exe.linkLibC();
32-
const run_cmd = exe.run();
3346

47+
const run_cmd = b.addRunArtifact(exe);
3448
const run_step = b.step("fix", "Fix GitHub package metadata");
3549
run_step.dependOn(&run_cmd.step);
3650
}

0 commit comments

Comments
 (0)