build: update to Zig 0.13.0

This commit is contained in:
Isaac Freund 2024-06-07 14:01:11 +02:00
parent c5b1d1de4e
commit 8da69699e9
No known key found for this signature in database
GPG Key ID: 86DED400DDFD7A11
7 changed files with 30 additions and 29 deletions

View File

@ -40,10 +40,10 @@ tasks:
sudo ninja -C build/ install sudo ninja -C build/ install
cd .. cd ..
wget -nv https://ziglang.org/download/0.12.0/zig-linux-x86_64-0.12.0.tar.xz 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.12.0.tar.xz tar xf zig-linux-x86_64-0.13.0.tar.xz
sudo mv zig-linux-x86_64-0.12.0/zig /usr/bin/ sudo mv zig-linux-x86_64-0.13.0/zig /usr/bin/
sudo mv zig-linux-x86_64-0.12.0/lib /usr/lib/zig sudo mv zig-linux-x86_64-0.13.0/lib /usr/lib/zig
- build: | - build: |
cd river cd river
zig build zig build

View File

@ -38,10 +38,10 @@ tasks:
sudo ninja -C build/ install sudo ninja -C build/ install
cd .. cd ..
wget -nv https://ziglang.org/download/0.12.0/zig-linux-x86_64-0.12.0.tar.xz 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.12.0.tar.xz tar xf zig-linux-x86_64-0.13.0.tar.xz
sudo mv zig-linux-x86_64-0.12.0/zig /usr/bin/ sudo mv zig-linux-x86_64-0.13.0/zig /usr/bin/
sudo mv zig-linux-x86_64-0.12.0/lib /usr/lib/zig sudo mv zig-linux-x86_64-0.13.0/lib /usr/lib/zig
- build: | - build: |
cd river cd river
zig build zig build

2
.gitignore vendored
View File

@ -1,2 +1,2 @@
zig-cache/ .zig-cache/
zig-out/ zig-out/

View File

@ -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 installed. The "development" versions are required if applicable to your
distribution. distribution.
- [zig](https://ziglang.org/download/) 0.12 - [zig](https://ziglang.org/download/) 0.13
- wayland - wayland
- wayland-protocols - wayland-protocols
- [wlroots](https://gitlab.freedesktop.org/wlroots/wlroots) 0.17.2 - [wlroots](https://gitlab.freedesktop.org/wlroots/wlroots) 0.17.2

View File

@ -148,13 +148,13 @@ pub fn build(b: *Build) !void {
wlroots.resolved_target = target; wlroots.resolved_target = target;
wlroots.linkSystemLibrary("wlroots", .{}); wlroots.linkSystemLibrary("wlroots", .{});
const flags = b.createModule(.{ .root_source_file = .{ .path = "common/flags.zig" } }); const flags = b.createModule(.{ .root_source_file = b.path("common/flags.zig") });
const globber = b.createModule(.{ .root_source_file = .{ .path = "common/globber.zig" } }); const globber = b.createModule(.{ .root_source_file = b.path("common/globber.zig") });
{ {
const river = b.addExecutable(.{ const river = b.addExecutable(.{
.name = "river", .name = "river",
.root_source_file = .{ .path = "river/main.zig" }, .root_source_file = b.path("river/main.zig"),
.target = target, .target = target,
.optimize = optimize, .optimize = optimize,
.strip = strip, .strip = strip,
@ -179,7 +179,7 @@ pub fn build(b: *Build) !void {
river.root_module.addImport("globber", globber); river.root_module.addImport("globber", globber);
river.addCSourceFile(.{ river.addCSourceFile(.{
.file = .{ .path = "river/wlroots_log_wrapper.c" }, .file = b.path("river/wlroots_log_wrapper.c"),
.flags = &.{ "-std=c99", "-O2" }, .flags = &.{ "-std=c99", "-O2" },
}); });
@ -195,7 +195,7 @@ pub fn build(b: *Build) !void {
{ {
const riverctl = b.addExecutable(.{ const riverctl = b.addExecutable(.{
.name = "riverctl", .name = "riverctl",
.root_source_file = .{ .path = "riverctl/main.zig" }, .root_source_file = b.path("riverctl/main.zig"),
.target = target, .target = target,
.optimize = optimize, .optimize = optimize,
.strip = strip, .strip = strip,
@ -220,7 +220,7 @@ pub fn build(b: *Build) !void {
{ {
const rivertile = b.addExecutable(.{ const rivertile = b.addExecutable(.{
.name = "rivertile", .name = "rivertile",
.root_source_file = .{ .path = "rivertile/main.zig" }, .root_source_file = b.path("rivertile/main.zig"),
.target = target, .target = target,
.optimize = optimize, .optimize = optimize,
.strip = strip, .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. // 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" }); 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. // 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(); const stdout = scdoc.captureStdOut();
b.getInstallStep().dependOn(&b.addInstallFile(stdout, "share/man/man1/" ++ page ++ ".1").step); 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(.{ const globber_test = b.addTest(.{
.root_source_file = .{ .path = "common/globber.zig" }, .root_source_file = b.path("common/globber.zig"),
.target = target, .target = target,
.optimize = optimize, .optimize = optimize,
}); });

View File

@ -4,20 +4,20 @@
.paths = .{""}, .paths = .{""},
.dependencies = .{ .dependencies = .{
.@"zig-pixman" = .{ .@"zig-pixman" = .{
.url = "https://codeberg.org/ifreund/zig-pixman/archive/v0.1.0.tar.gz", .url = "https://codeberg.org/ifreund/zig-pixman/archive/v0.2.0.tar.gz",
.hash = "122014eeb4600a059bdcfe1c864862f17e6d5e4237e3bb7d6818f2a5583f6f4eb843", .hash = "12209db20ce873af176138b76632931def33a10539387cba745db72933c43d274d56",
}, },
.@"zig-wayland" = .{ .@"zig-wayland" = .{
.url = "https://codeberg.org/ifreund/zig-wayland/archive/v0.1.0.tar.gz", .url = "https://codeberg.org/ifreund/zig-wayland/archive/v0.2.0.tar.gz",
.hash = "1220b0f8f822c1625af7aae4cb3ab2c4ec1a4c0e99ef32867b2a8d88bb070b3e7f6d", .hash = "1220687c8c47a48ba285d26a05600f8700d37fc637e223ced3aa8324f3650bf52242",
}, },
.@"zig-wlroots" = .{ .@"zig-wlroots" = .{
.url = "https://codeberg.org/ifreund/zig-wlroots/archive/v0.17.0.tar.gz", .url = "https://codeberg.org/ifreund/zig-wlroots/archive/v0.17.1.tar.gz",
.hash = "1220714d1cc39c3abb1d9c22a0b838d847ead099cb7d9931821490483f30c022e827", .hash = "1220c65ab884c236cc950b564c70f6cd04046d86485ee76e0cde886cef7438021b4f",
}, },
.@"zig-xkbcommon" = .{ .@"zig-xkbcommon" = .{
.url = "https://codeberg.org/ifreund/zig-xkbcommon/archive/v0.1.0.tar.gz", .url = "https://codeberg.org/ifreund/zig-xkbcommon/archive/v0.2.0.tar.gz",
.hash = "1220840390382c88caf9b0887f6cebbba3a7d05960b8b2ee6d80567b2950b71e5017", .hash = "1220c90b2228d65fd8427a837d31b0add83e9fade1dcfa539bb56fd06f1f8461605f",
}, },
}, },
} }

View File

@ -36,10 +36,11 @@ pub const Orientation = enum {
vertical, vertical,
}; };
// zig fmt: off const command_impls = std.StaticStringMap(
const command_impls = std.ComptimeStringMap(
*const fn (*Seat, []const [:0]const u8, *?[]const u8) Error!void, *const fn (*Seat, []const [:0]const u8, *?[]const u8) Error!void,
).initComptime(
.{ .{
// zig fmt: off
.{ "attach-mode", @import("command/attach_mode.zig").defaultAttachMode }, .{ "attach-mode", @import("command/attach_mode.zig").defaultAttachMode },
.{ "background-color", @import("command/config.zig").backgroundColor }, .{ "background-color", @import("command/config.zig").backgroundColor },
.{ "border-color-focused", @import("command/config.zig").borderColorFocused }, .{ "border-color-focused", @import("command/config.zig").borderColorFocused },
@ -96,9 +97,9 @@ const command_impls = std.ComptimeStringMap(
.{ "unmap-switch", @import("command/map.zig").unmapSwitch }, .{ "unmap-switch", @import("command/map.zig").unmapSwitch },
.{ "xcursor-theme", @import("command/xcursor_theme.zig").xcursorTheme }, .{ "xcursor-theme", @import("command/xcursor_theme.zig").xcursorTheme },
.{ "zoom", @import("command/zoom.zig").zoom }, .{ "zoom", @import("command/zoom.zig").zoom },
// zig fmt: on
}, },
); );
// zig fmt: on
pub const Error = error{ pub const Error = error{
NoCommand, NoCommand,