build: switch to translate-c package

We require a recent version for FreeBSD compatibility

References: https://codeberg.org/ziglang/translate-c/pulls/331
This commit is contained in:
Isaac Freund
2026-04-29 13:33:52 +02:00
parent 49721c5641
commit 5d8a493057
9 changed files with 23 additions and 27 deletions
+11
View File
@@ -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"),
+4
View File
@@ -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,
}
+1 -1
View File
@@ -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");
+1 -1
View File
@@ -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");
+1 -1
View File
@@ -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");
+1 -1
View File
@@ -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");
+3
View File
@@ -0,0 +1,3 @@
#include <linux/input-event-codes.h>
#include <libevdev/libevdev.h>
#include <libinput.h>
-22
View File
@@ -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 <https://www.gnu.org/licenses/>.
pub const c = @cImport({
@cInclude("linux/input-event-codes.h");
@cInclude("libevdev/libevdev.h");
@cInclude("libinput.h");
});
+1 -1
View File
@@ -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");