about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNguyễn Gia Phong <cnx@loang.net>2023-08-11 14:04:20 +0900
committerNguyễn Gia Phong <cnx@loang.net>2023-08-11 14:04:20 +0900
commitc2e895d1748170713c582b182d5790315ac0d0ed (patch)
tree93d821289add0b0de74bf056313e1bd2a01162eb
parent7451d8fce4c50729ab3192c93422fa79c9e4fe85 (diff)
downloadclipbuzz-c2e895d1748170713c582b182d5790315ac0d0ed.tar.gz
Port build recipe to Zig 0.11 HEAD 2.0.1 master
-rw-r--r--build.zig31
1 files changed, 12 insertions, 19 deletions
diff --git a/build.zig b/build.zig
index a0ba02c..01e1a6e 100644
--- a/build.zig
+++ b/build.zig
@@ -1,29 +1,22 @@
-const std = @import("std");
+const Build = @import("std").Build;
 
-pub fn build(b: *std.build.Builder) void {
-    const exe = b.addExecutable("clipbuzz", "src/main.zig");
+pub fn build(b: *Build) void {
+    const exe = b.addExecutable(.{
+        .name = "clipbuzz",
+        .root_source_file = .{ .path = "src/main.zig" },
+        .target = b.standardTargetOptions(.{}),
+        .optimize = b.standardOptimizeOption(.{}),
+    });
     exe.linkLibC();
     exe.linkSystemLibrary("X11");
     exe.linkSystemLibrary("Xfixes");
+    b.installArtifact(exe);
 
-    // Standard target options allows the person running `zig build` to choose
-    // what target to build for. Here we do not override the defaults, which
-    // means any target is allowed, and the default is native. Other options
-    // for restricting supported target set are available.
-    exe.setTarget(b.standardTargetOptions(.{}));
-
-    // Standard release options allow the person running `zig build` to select
-    // between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall.
-    exe.setBuildMode(b.standardReleaseOptions());
-
-    exe.install();
-
-    const run_cmd = exe.run();
+    const run_cmd = b.addRunArtifact(exe);
     run_cmd.step.dependOn(b.getInstallStep());
-    if (b.args) |args| {
+    if (b.args) |args|
         run_cmd.addArgs(args);
-    }
 
-    const run_step = b.step("run", "Run the app");
+    const run_step = b.step("run", "Run clipbuzz");
     run_step.dependOn(&run_cmd.step);
 }