@@ -12,7 +12,7 @@ pub const Language = enum {
12
12
luau ,
13
13
};
14
14
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 {
16
16
const version : std.SemanticVersion = switch (lang ) {
17
17
.lua51 = > .{ .major = 5 , .minor = 1 , .patch = 5 },
18
18
.lua52 = > .{ .major = 5 , .minor = 2 , .patch = 4 },
@@ -38,6 +38,8 @@ pub fn configure(b: *Build, target: Build.ResolvedTarget, optimize: std.builtin.
38
38
39
39
lib .addIncludePath (upstream .path ("src" ));
40
40
41
+ const user_header = "user.h" ;
42
+
41
43
const flags = [_ ][]const u8 {
42
44
// Standard version used in Lua Makefile
43
45
"-std=gnu99" ,
@@ -55,6 +57,8 @@ pub fn configure(b: *Build, target: Build.ResolvedTarget, optimize: std.builtin.
55
57
56
58
// Build as DLL for windows if shared
57
59
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 "" ,
58
62
};
59
63
60
64
const lua_source_files = switch (lang ) {
@@ -87,6 +91,11 @@ pub fn configure(b: *Build, target: Build.ResolvedTarget, optimize: std.builtin.
87
91
lib .installHeader (upstream .path ("src/lauxlib.h" ), "lauxlib.h" );
88
92
lib .installHeader (upstream .path ("src/luaconf.h" ), "luaconf.h" );
89
93
94
+ if (lua_user_h ) | user_h | {
95
+ lib .addIncludePath (user_h .dirname ());
96
+ lib .installHeader (user_h , user_header );
97
+ }
98
+
90
99
return lib ;
91
100
}
92
101
0 commit comments