commit 8061314de01bd20cd238299b34f586a62b1d8e3a from: Isaac Freund via: mtmn date: Wed Apr 29 11:33:52 2026 UTC build: switch to translate-c package We require a recent version for FreeBSD compatibility References: https://codeberg.org/ziglang/translate-c/pulls/331 commit - 1fa0a40f147b843d82d2f1014c58917ac45d0197 commit + 8061314de01bd20cd238299b34f586a62b1d8e3a blob - 0ba03fb1ec9c74142ad64a7eff226c71bc80160b blob + 91647fd559ed4f0eca8c04b309fad836fd02288c --- build.zig +++ build.zig @@ -8,6 +8,7 @@ const manifest = @import("build.zig.zon"); const version = manifest.version; const Scanner = @import("wayland").Scanner; +const Translator = @import("translate_c").Translator; pub fn build(b: *Build) !void { const target = b.standardTargetOptions(.{}); @@ -157,6 +158,15 @@ pub fn build(b: *Build) !void { 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 translate_c: Translator = .init(b.dependency("translate_c", .{}), .{ + .name = "c", + .c_source_file = b.path("river/c.h"), + .target = target, + .optimize = optimize, + }); + translate_c.linkSystemLibrary("libevdev", .{}); + translate_c.linkSystemLibrary("libinput", .{}); + { const river = b.addExecutable(.{ .name = "river", @@ -185,6 +195,7 @@ pub fn build(b: *Build) !void { river.root_module.addImport("wlroots", wlroots); river.root_module.addImport("flags", flags); river.root_module.addImport("globber", globber); + river.root_module.addImport("c", translate_c.mod); river.root_module.addCSourceFile(.{ .file = b.path("river/wlroots_log_wrapper.c"), blob - 6c5f5ece7ff92614a359343967c7006f19bcd07d blob + d6f5661688354dadbf9b2695603629fd21311bab --- build.zig.zon +++ build.zig.zon @@ -24,6 +24,10 @@ .url = "https://codeberg.org/ifreund/zig-xkbcommon/archive/v0.3.0.tar.gz", .hash = "xkbcommon-0.3.0-VDqIe3K9AQB2fG5ZeRcMC9i7kfrp5m2rWgLrmdNn9azr", }, + .translate_c = .{ + .url = "git+https://codeberg.org/ziglang/translate-c/#7a1a9fdc4ab00835748a6657ecbb835e3d5d45f7", + .hash = "translate_c-0.0.0-Q_BUWvP1BgCjAk6PWv5286tOlvzD9-X-NkuTzh0KxY0Q", + }, }, .fingerprint = 0x3dae7aba2ea52a3b, } blob - feb19d2b2f7fcd9fc1fd1ed4bf781a640b474dd1 blob + 795d5e6704f022e57e8a60be32acde8a0d3dcb1c --- river/Cursor.zig +++ river/Cursor.zig @@ -26,7 +26,7 @@ const wayland = @import("wayland"); const wl = wayland.server.wl; const zwlr = wayland.server.zwlr; -const c = @import("c.zig").c; +const c = @import("c"); const server = &@import("main.zig").server; const util = @import("util.zig"); blob - 8557a26f7b1ccbc83f7f2cce7c05d221867fe5bf blob + 81d95bbc9b9ef8c146356c02906f58109ffaf242 --- river/InputConfig.zig +++ river/InputConfig.zig @@ -25,7 +25,7 @@ const wlr = @import("wlroots"); const log = std.log.scoped(.input_config); -const c = @import("c.zig").c; +const c = @import("c"); const server = &@import("main.zig").server; const util = @import("util.zig"); blob - df26266c9fd29137d070347b6165809a8f13e4e9 blob + ffd8a6681481b05d0b0aeeb7090a93a6c74601b3 --- river/InputDevice.zig +++ river/InputDevice.zig @@ -24,7 +24,7 @@ const wl = @import("wayland").server.wl; const globber = @import("globber"); -const c = @import("c.zig").c; +const c = @import("c"); const server = &@import("main.zig").server; const util = @import("util.zig"); blob - dc277c538fa6659f438712612f53a3ce1013c454 blob + c7b46438d28fe7db1016592346573f129f5c10ae --- river/Server.zig +++ river/Server.zig @@ -26,7 +26,7 @@ const wayland = @import("wayland"); const wl = wayland.server.wl; const wp = wayland.server.wp; -const c = @import("c.zig").c; +const c = @import("c"); const util = @import("util.zig"); const Config = @import("Config.zig"); blob - 9ef5b9796ba04f9e7610714da98d1b34c8fc8736 (mode 644) blob + /dev/null --- river/c.zig +++ /dev/null @@ -1,22 +0,0 @@ -// This file is part of river, a dynamic tiling wayland compositor. -// -// Copyright 2020 The River Developers -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 3. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -pub const c = @cImport({ - @cInclude("linux/input-event-codes.h"); - @cInclude("libevdev/libevdev.h"); - - @cInclude("libinput.h"); -}); blob - /dev/null blob + efef65cf9582e2a825e8a1daaa65acb0b140a42d (mode 644) --- /dev/null +++ river/c.h @@ -0,0 +1,3 @@ +#include +#include +#include blob - cd966f4b984ee1e8a53308b9c8663e7fdf5cba5a blob + c0d34c1fcfa22b9584d5f8122cd723f05175614f --- river/command/map.zig +++ river/command/map.zig @@ -22,7 +22,7 @@ const wlr = @import("wlroots"); const xkb = @import("xkbcommon"); const flags = @import("flags"); -const c = @import("../c.zig").c; +const c = @import("c"); const server = &@import("../main.zig").server; const util = @import("../util.zig");