From 60981aa3e5c7d2e4798fb9ac9312c2d138925139 Mon Sep 17 00:00:00 2001 From: Interrupt Date: Wed, 14 Jan 2026 09:56:43 -0800 Subject: [PATCH] Adding an option to pass additional system headers to include when building Lua --- build.zig | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/build.zig b/build.zig index 10d7291..d74f44b 100644 --- a/build.zig +++ b/build.zig @@ -21,6 +21,7 @@ pub fn build(b: *Build) void { const system_lua = b.option(bool, "system_lua", "Use system lua") orelse false; const luau_use_4_vector = b.option(bool, "luau_use_4_vector", "Build Luau to use 4-vectors instead of the default 3-vector.") orelse false; const lua_user_h = b.option(Build.LazyPath, "lua_user_h", "Lazy path to user supplied c header file") orelse null; + const additional_system_headers = b.option(Build.LazyPath, "additional_system_headers", "Lazy path to additional system headers to include when building Lua") orelse null; if (lang == .luau and shared) { std.debug.panic("Luau does not support compiling or loading shared modules", .{}); @@ -100,6 +101,13 @@ pub fn build(b: *Build) void { .optimize = optimize, }); c_headers.addIncludePath(lib.getEmittedIncludeTree()); + + // If we've been given additional system headers, add them now + // Useful for things like linking Emscripten headers by including a new sysroot + if (additional_system_headers != null) { + c_headers.addSystemIncludePath(additional_system_headers.?); + } + c_headers.step.dependOn(&install_lib.step); const ziglua_c = c_headers.createModule();