From 21171592fdc826f33673acdb784fb0da649edb85 Mon Sep 17 00:00:00 2001 From: Peter Li Date: Sun, 4 Oct 2026 16:14:22 -0700 Subject: [PATCH] fixes for macos, submitting to linux machine for regenerating protocols --- src/linux/build.zig | 2 -- src/linux/tools/protocols.py | 7 ++++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/linux/build.zig b/src/linux/build.zig index 7e79b78..cf9f873 100644 --- a/src/linux/build.zig +++ b/src/linux/build.zig @@ -45,8 +45,6 @@ pub fn configure(b: *std.Build, module: *std.Build.Module, target: std.Build.Res .flags = &.{ "-std=c99", "-fdata-sections", - "-include", - "private-symbols.h", }, }); } diff --git a/src/linux/tools/protocols.py b/src/linux/tools/protocols.py index 37483fb..00f2e46 100644 --- a/src/linux/tools/protocols.py +++ b/src/linux/tools/protocols.py @@ -47,7 +47,12 @@ def generate(root, version): name = interface.attrib['name'] + '_interface' symbols.append(f'#define {name} z_uhdk_{name}') for mode, suffix in [('client-header', '.h'), ('private-code', '.c')]: - subprocess.run(['wayland-scanner', mode, str(xml), str(output / (('wayland-client-protocol' if xml.stem == 'wayland' and mode == 'client-header' else xml.stem) + suffix))], check=True) + target = output / (('wayland-client-protocol' if xml.stem == 'wayland' and mode == 'client-header' else xml.stem) + suffix) + subprocess.run(['wayland-scanner', mode, str(xml), str(target)], check=True) + if mode == 'private-code': + # Rename the descriptors before the scanner's definitions; a -include flag cannot + # name this file because Zig 0.17 build scripts cannot resolve absolute paths. + target.write_text('#include "private-symbols.h"\n' + target.read_text()) (output / 'private-symbols.h').write_text('\n'.join(symbols) + '\n')