@@ -12,7 +12,7 @@ pub const Language = enum {
1212 luau ,
1313};
1414
15- pub fn configure (b : * Build , target : Build.ResolvedTarget , optimize : std.builtin.OptimizeMode , upstream : * Build.Dependency , lang : Language , shared : bool , library_name : []const u8 ) * Step.Compile {
15+ pub fn configure (b : * Build , target : Build.ResolvedTarget , optimize : std.builtin.OptimizeMode , upstream : * Build.Dependency , lang : Language , shared : bool , library_name : []const u8 , lua_user_h : ? Build.LazyPath ) * Step.Compile {
1616 const version : std.SemanticVersion = switch (lang ) {
1717 .lua51 = > .{ .major = 5 , .minor = 1 , .patch = 5 },
1818 .lua52 = > .{ .major = 5 , .minor = 2 , .patch = 4 },
@@ -38,6 +38,8 @@ pub fn configure(b: *Build, target: Build.ResolvedTarget, optimize: std.builtin.
3838
3939 lib .addIncludePath (upstream .path ("src" ));
4040
41+ const user_header = "user.h" ;
42+
4143 const flags = [_ ][]const u8 {
4244 // Standard version used in Lua Makefile
4345 "-std=gnu99" ,
@@ -55,6 +57,8 @@ pub fn configure(b: *Build, target: Build.ResolvedTarget, optimize: std.builtin.
5557
5658 // Build as DLL for windows if shared
5759 if (target .result .os .tag == .windows and shared ) "-DLUA_BUILD_AS_DLL" else "" ,
60+
61+ if (lua_user_h ) | _ | b .fmt ("-DLUA_USER_H=\" {s}\" " , .{user_header }) else "" ,
5862 };
5963
6064 const lua_source_files = switch (lang ) {
@@ -87,6 +91,11 @@ pub fn configure(b: *Build, target: Build.ResolvedTarget, optimize: std.builtin.
8791 lib .installHeader (upstream .path ("src/lauxlib.h" ), "lauxlib.h" );
8892 lib .installHeader (upstream .path ("src/luaconf.h" ), "luaconf.h" );
8993
94+ if (lua_user_h ) | user_h | {
95+ lib .addIncludePath (user_h .dirname ());
96+ lib .installHeader (user_h , user_header );
97+ }
98+
9099 return lib ;
91100}
92101
0 commit comments