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

commit729d5716d3c8a01b96d2ed571e052dfe6b6bbe62
parent2810df621a
authorIsaac Freund <[email protected]>
date2026-04-19 11:35
build: use translate-c fork to fix FreeBSD build

This fork includes https://codeberg.org/ziglang/translate-c/pulls/331

We will switch back to upstream translate-c as soon as possible.

 build.zig     | 8 +++++---
 build.zig.zon | 4 ++++
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/build.zig b/build.zig
index 6b06f31..664f1af 100644
--- a/build.zig
+++ b/build.zig
@@ -11,6 +11,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(.{});
@@ -149,8 +150,9 @@ pub fn build(b: *Build) !void {
     const flags = b.createModule(.{ .root_source_file = b.path("common/flags.zig") });
     const slotmap = b.createModule(.{ .root_source_file = b.path("common/slotmap.zig") });
 
-    const translate_c = b.addTranslateC(.{
-        .root_source_file = b.path("river/c.h"),
+    const translate_c: Translator = .init(b.dependency("translate_c", .{}), .{
+        .name = "c",
+        .c_source_file = b.path("river/c.h"),
         .target = target,
         .optimize = optimize,
     });
@@ -184,7 +186,7 @@ pub fn build(b: *Build) !void {
         river.root_module.addImport("wlroots", wlroots);
         river.root_module.addImport("flags", flags);
         river.root_module.addImport("slotmap", slotmap);
-        river.root_module.addImport("c", translate_c.createModule());
+        river.root_module.addImport("c", translate_c.mod);
 
         river.root_module.addCSourceFile(.{
             .file = b.path("river/wlroots_log_wrapper.c"),
diff --git a/build.zig.zon b/build.zig.zon
index 5918d5d..f51f468 100644
--- a/build.zig.zon
+++ b/build.zig.zon
@@ -27,6 +27,10 @@
             .url = "https://codeberg.org/ifreund/zig-xkbcommon/archive/v0.4.0.tar.gz",
             .hash = "xkbcommon-0.4.0-VDqIe0i2AgDRsok2GpMFYJ8SVhQS10_PI2M_CnHXsJJZ",
         },
+        .translate_c = .{
+            .url = "git+https://codeberg.org/ifreund/translate-c?ref=fix-shift-assign#fdf30e6298cd1184ae6da5602aff0cb5d4cde4cb",
+            .hash = "translate_c-0.0.0-Q_BUWrT0BgDOFSyiz0UVBIpBe3-CiEqx9ej2EecgKcBD",
+        },
     },
     .fingerprint = 0xf5e3672b8e8d6efc,
 }