cleanup build.zig

This commit is contained in:
Squibid 2025-12-22 15:44:03 -05:00
parent e4fa0c4521
commit e81334cf45
Signed by: squibid
GPG key ID: BECE5684D3C4005D

View file

@ -14,12 +14,7 @@ pub fn build(b: *std.Build) void {
else => "/usr/share", else => "/usr/share",
}; };
// If instead your goal is to create an executable, consider if users might // Add protocol xml files
// be interested in also being able to embed the core functionality of your
// program in their own executable in order to avoid the overhead involved in
// subprocessing your CLI tool.
// The below is copied from tinywl
const scanner = Scanner.create(b, .{}); const scanner = Scanner.create(b, .{});
scanner.addSystemProtocol("stable/xdg-shell/xdg-shell.xml"); scanner.addSystemProtocol("stable/xdg-shell/xdg-shell.xml");
scanner.addSystemProtocol("stable/tablet/tablet-v2.xml"); scanner.addSystemProtocol("stable/tablet/tablet-v2.xml");
@ -27,6 +22,7 @@ pub fn build(b: *std.Build) void {
scanner.addCustomProtocol(b.path("protocols/wlr-layer-shell-unstable-v1.xml")); scanner.addCustomProtocol(b.path("protocols/wlr-layer-shell-unstable-v1.xml"));
scanner.addCustomProtocol(b.path("protocols/mez-remote-lua-unstable-v1.xml")); scanner.addCustomProtocol(b.path("protocols/mez-remote-lua-unstable-v1.xml"));
// Generate protocol code
scanner.generate("zmez_remote_lua_manager_v1", 1); scanner.generate("zmez_remote_lua_manager_v1", 1);
scanner.generate("wl_compositor", 6); scanner.generate("wl_compositor", 6);
scanner.generate("wl_subcompositor", 1); scanner.generate("wl_subcompositor", 1);
@ -62,7 +58,7 @@ pub fn build(b: *std.Build) void {
}), }),
}); });
mez.linkLibC(); mez.root_module.link_libc = true;
mez.root_module.addImport("wayland", wayland); mez.root_module.addImport("wayland", wayland);
mez.root_module.addImport("xkbcommon", xkbcommon); mez.root_module.addImport("xkbcommon", xkbcommon);
@ -70,10 +66,10 @@ pub fn build(b: *std.Build) void {
mez.root_module.addImport("zlua", zlua); mez.root_module.addImport("zlua", zlua);
mez.root_module.addImport("clap", clap); mez.root_module.addImport("clap", clap);
mez.linkSystemLibrary("wayland-server"); mez.root_module.linkSystemLibrary("wayland-server", .{});
mez.linkSystemLibrary("xkbcommon"); mez.root_module.linkSystemLibrary("xkbcommon", .{});
mez.linkSystemLibrary("pixman-1"); mez.root_module.linkSystemLibrary("pixman-1", .{});
mez.linkSystemLibrary("libevdev"); mez.root_module.linkSystemLibrary("libevdev", .{});
var ret: u8 = undefined; var ret: u8 = undefined;
const version = b.runAllowFail( const version = b.runAllowFail(