git.lucas.co / cce-compositor
Wayland compositor (wlroots)
git clone https://git.lucas.co/cce-compositor.git

commitb00e234e863f90d18aa426685ed00cde06898096
parent4ce3eaaf82
authorIsaac Freund <[email protected]>
date2024-06-07 14:01
build: update to Zig 0.13.0

 .builds/alpine.yml    |  8 ++++----
 .builds/archlinux.yml |  8 ++++----
 .gitignore            |  2 +-
 README.md             |  2 +-
 build.zig             | 16 ++++++++--------
 build.zig.zon         | 16 ++++++++--------
 river/command.zig     |  7 ++++---
 7 files changed, 30 insertions(+), 29 deletions(-)

diff --git a/.builds/alpine.yml b/.builds/alpine.yml
index ef40998..29be9f6 100644
--- a/.builds/alpine.yml
+++ b/.builds/alpine.yml
@@ -40,10 +40,10 @@ tasks:
       sudo ninja -C build/ install
       cd ..
 
-      wget -nv https://ziglang.org/download/0.12.0/zig-linux-x86_64-0.12.0.tar.xz
-      tar xf zig-linux-x86_64-0.12.0.tar.xz
-      sudo mv zig-linux-x86_64-0.12.0/zig /usr/bin/
-      sudo mv zig-linux-x86_64-0.12.0/lib /usr/lib/zig
+      wget -nv https://ziglang.org/download/0.13.0/zig-linux-x86_64-0.13.0.tar.xz
+      tar xf zig-linux-x86_64-0.13.0.tar.xz
+      sudo mv zig-linux-x86_64-0.13.0/zig /usr/bin/
+      sudo mv zig-linux-x86_64-0.13.0/lib /usr/lib/zig
   - build: |
       cd river
       zig build
diff --git a/.builds/archlinux.yml b/.builds/archlinux.yml
index ef1a5de..5025899 100644
--- a/.builds/archlinux.yml
+++ b/.builds/archlinux.yml
@@ -38,10 +38,10 @@ tasks:
       sudo ninja -C build/ install
       cd ..
 
-      wget -nv https://ziglang.org/download/0.12.0/zig-linux-x86_64-0.12.0.tar.xz
-      tar xf zig-linux-x86_64-0.12.0.tar.xz
-      sudo mv zig-linux-x86_64-0.12.0/zig /usr/bin/
-      sudo mv zig-linux-x86_64-0.12.0/lib /usr/lib/zig
+      wget -nv https://ziglang.org/download/0.13.0/zig-linux-x86_64-0.13.0.tar.xz
+      tar xf zig-linux-x86_64-0.13.0.tar.xz
+      sudo mv zig-linux-x86_64-0.13.0/zig /usr/bin/
+      sudo mv zig-linux-x86_64-0.13.0/lib /usr/lib/zig
   - build: |
       cd river
       zig build
diff --git a/.gitignore b/.gitignore
index e73c965..3389c86 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,2 @@
-zig-cache/
+.zig-cache/
 zig-out/
diff --git a/README.md b/README.md
index e3cd756..c9ed713 100644
--- a/README.md
+++ b/README.md
@@ -57,7 +57,7 @@ To compile river first ensure that you have the following dependencies
 installed. The "development" versions are required if applicable to your
 distribution.
 
-- [zig](https://ziglang.org/download/) 0.12
+- [zig](https://ziglang.org/download/) 0.13
 - wayland
 - wayland-protocols
 - [wlroots](https://gitlab.freedesktop.org/wlroots/wlroots) 0.17.2
diff --git a/build.zig b/build.zig
index b4eacc1..1addf36 100644
--- a/build.zig
+++ b/build.zig
@@ -148,13 +148,13 @@ pub fn build(b: *Build) !void {
     wlroots.resolved_target = target;
     wlroots.linkSystemLibrary("wlroots", .{});
 
-    const flags = b.createModule(.{ .root_source_file = .{ .path = "common/flags.zig" } });
-    const globber = b.createModule(.{ .root_source_file = .{ .path = "common/globber.zig" } });
+    const flags = b.createModule(.{ .root_source_file = b.path("common/flags.zig") });
+    const globber = b.createModule(.{ .root_source_file = b.path("common/globber.zig") });
 
     {
         const river = b.addExecutable(.{
             .name = "river",
-            .root_source_file = .{ .path = "river/main.zig" },
+            .root_source_file = b.path("river/main.zig"),
             .target = target,
             .optimize = optimize,
             .strip = strip,
@@ -179,7 +179,7 @@ pub fn build(b: *Build) !void {
         river.root_module.addImport("globber", globber);
 
         river.addCSourceFile(.{
-            .file = .{ .path = "river/wlroots_log_wrapper.c" },
+            .file = b.path("river/wlroots_log_wrapper.c"),
             .flags = &.{ "-std=c99", "-O2" },
         });
 
@@ -195,7 +195,7 @@ pub fn build(b: *Build) !void {
     {
         const riverctl = b.addExecutable(.{
             .name = "riverctl",
-            .root_source_file = .{ .path = "riverctl/main.zig" },
+            .root_source_file = b.path("riverctl/main.zig"),
             .target = target,
             .optimize = optimize,
             .strip = strip,
@@ -220,7 +220,7 @@ pub fn build(b: *Build) !void {
     {
         const rivertile = b.addExecutable(.{
             .name = "rivertile",
-            .root_source_file = .{ .path = "rivertile/main.zig" },
+            .root_source_file = b.path("rivertile/main.zig"),
             .target = target,
             .optimize = optimize,
             .strip = strip,
@@ -265,7 +265,7 @@ pub fn build(b: *Build) !void {
             // Even passing a buffer to std.Build.Step.Run appears to be racy and occasionally deadlocks.
             const scdoc = b.addSystemCommand(&.{ "/bin/sh", "-c", "scdoc < doc/" ++ page ++ ".1.scd" });
             // This makes the caching work for the Workaround, and the extra argument is ignored by /bin/sh.
-            scdoc.addFileArg(.{ .path = "doc/" ++ page ++ ".1.scd" });
+            scdoc.addFileArg(b.path("doc/" ++ page ++ ".1.scd"));
 
             const stdout = scdoc.captureStdOut();
             b.getInstallStep().dependOn(&b.addInstallFile(stdout, "share/man/man1/" ++ page ++ ".1").step);
@@ -286,7 +286,7 @@ pub fn build(b: *Build) !void {
 
     {
         const globber_test = b.addTest(.{
-            .root_source_file = .{ .path = "common/globber.zig" },
+            .root_source_file = b.path("common/globber.zig"),
             .target = target,
             .optimize = optimize,
         });
diff --git a/build.zig.zon b/build.zig.zon
index 057490a..a1c2a92 100644
--- a/build.zig.zon
+++ b/build.zig.zon
@@ -4,20 +4,20 @@
     .paths = .{""},
     .dependencies = .{
         .@"zig-pixman" = .{
-            .url = "https://codeberg.org/ifreund/zig-pixman/archive/v0.1.0.tar.gz",
-            .hash = "122014eeb4600a059bdcfe1c864862f17e6d5e4237e3bb7d6818f2a5583f6f4eb843",
+            .url = "https://codeberg.org/ifreund/zig-pixman/archive/v0.2.0.tar.gz",
+            .hash = "12209db20ce873af176138b76632931def33a10539387cba745db72933c43d274d56",
         },
         .@"zig-wayland" = .{
-            .url = "https://codeberg.org/ifreund/zig-wayland/archive/v0.1.0.tar.gz",
-            .hash = "1220b0f8f822c1625af7aae4cb3ab2c4ec1a4c0e99ef32867b2a8d88bb070b3e7f6d",
+            .url = "https://codeberg.org/ifreund/zig-wayland/archive/v0.2.0.tar.gz",
+            .hash = "1220687c8c47a48ba285d26a05600f8700d37fc637e223ced3aa8324f3650bf52242",
         },
         .@"zig-wlroots" = .{
-            .url = "https://codeberg.org/ifreund/zig-wlroots/archive/v0.17.0.tar.gz",
-            .hash = "1220714d1cc39c3abb1d9c22a0b838d847ead099cb7d9931821490483f30c022e827",
+            .url = "https://codeberg.org/ifreund/zig-wlroots/archive/v0.17.1.tar.gz",
+            .hash = "1220c65ab884c236cc950b564c70f6cd04046d86485ee76e0cde886cef7438021b4f",
         },
         .@"zig-xkbcommon" = .{
-            .url = "https://codeberg.org/ifreund/zig-xkbcommon/archive/v0.1.0.tar.gz",
-            .hash = "1220840390382c88caf9b0887f6cebbba3a7d05960b8b2ee6d80567b2950b71e5017",
+            .url = "https://codeberg.org/ifreund/zig-xkbcommon/archive/v0.2.0.tar.gz",
+            .hash = "1220c90b2228d65fd8427a837d31b0add83e9fade1dcfa539bb56fd06f1f8461605f",
         },
     },
 }
diff --git a/river/command.zig b/river/command.zig
index d32efce..6ea5b96 100644
--- a/river/command.zig
+++ b/river/command.zig
@@ -36,10 +36,11 @@ pub const Orientation = enum {
     vertical,
 };
 
-// zig fmt: off
-const command_impls = std.ComptimeStringMap(
+const command_impls = std.StaticStringMap(
     *const fn (*Seat, []const [:0]const u8, *?[]const u8) Error!void,
+).initComptime(
     .{
+        // zig fmt: off
         .{ "attach-mode",               @import("command/attach_mode.zig").defaultAttachMode },
         .{ "background-color",          @import("command/config.zig").backgroundColor },
         .{ "border-color-focused",      @import("command/config.zig").borderColorFocused },
@@ -96,9 +97,9 @@ const command_impls = std.ComptimeStringMap(
         .{ "unmap-switch",              @import("command/map.zig").unmapSwitch },
         .{ "xcursor-theme",             @import("command/xcursor_theme.zig").xcursorTheme },
         .{ "zoom",                      @import("command/zoom.zig").zoom },
+        // zig fmt: on
     },
 );
-// zig fmt: on
 
 pub const Error = error{
     NoCommand,