@@ -23,20 +23,14 @@ pub fn configure(b: *Build, target: Build.ResolvedTarget, optimize: std.builtin.
2323 const minilua_mod = b .createModule (.{
2424 .target = b .graph .host , // Use host target for cross build
2525 .optimize = .ReleaseSafe ,
26+ .link_libc = true ,
27+ .sanitize_c = .off ,
2628 });
2729 const minilua = b .addExecutable (.{
2830 .name = "minilua" ,
2931 .root_module = minilua_mod ,
3032 });
31- minilua .linkLibC ();
32- // FIXME: remove branch when zig-0.15 is released and 0.14 can be dropped
33- const builtin = @import ("builtin" );
34- if (builtin .zig_version .major == 0 and builtin .zig_version .minor < 15 ) {
35- minilua .root_module .sanitize_c = false ;
36- } else {
37- minilua .root_module .sanitize_c = .off ;
38- }
39- minilua .addCSourceFile (.{ .file = upstream .path ("src/host/minilua.c" ) });
33+ minilua .root_module .addCSourceFile (.{ .file = upstream .path ("src/host/minilua.c" ) });
4034
4135 // Generate the buildvm_arch.h file using minilua
4236 const dynasm_run = b .addRunArtifact (minilua );
@@ -108,18 +102,13 @@ pub fn configure(b: *Build, target: Build.ResolvedTarget, optimize: std.builtin.
108102 const vm_mod = b .createModule (.{
109103 .target = b .graph .host , // Use host target for cross build
110104 .optimize = .ReleaseSafe ,
105+ .link_libc = true ,
106+ .sanitize_c = .off ,
111107 });
112108 const buildvm = b .addExecutable (.{
113109 .name = "buildvm" ,
114110 .root_module = vm_mod ,
115111 });
116- buildvm .linkLibC ();
117- // FIXME: remove branch when zig-0.15 is released and 0.14 can be dropped
118- if (builtin .zig_version .major == 0 and builtin .zig_version .minor < 15 ) {
119- buildvm .root_module .sanitize_c = false ;
120- } else {
121- buildvm .root_module .sanitize_c = .off ;
122- }
123112
124113 // Needs to run after the buildvm_arch.h and luajit.h files are generated
125114 buildvm .step .dependOn (& dynasm_run .step );
@@ -136,7 +125,7 @@ pub fn configure(b: *Build, target: Build.ResolvedTarget, optimize: std.builtin.
136125 else
137126 &.{};
138127
139- buildvm .addCSourceFiles (.{
128+ buildvm .root_module . addCSourceFiles (.{
140129 .root = .{ .dependency = .{
141130 .dependency = upstream ,
142131 .sub_path = "" ,
@@ -145,10 +134,10 @@ pub fn configure(b: *Build, target: Build.ResolvedTarget, optimize: std.builtin.
145134 .flags = std .mem .concat (b .allocator , []const u8 , &.{ buildvm_c_flags , buildvm_windows_c_flags }) catch @panic ("OOM!" ),
146135 });
147136
148- buildvm .addIncludePath (upstream .path ("src" ));
149- buildvm .addIncludePath (upstream .path ("src/host" ));
150- buildvm .addIncludePath (buildvm_arch_h .dirname ());
151- buildvm .addIncludePath (luajit_h .dirname ());
137+ buildvm .root_module . addIncludePath (upstream .path ("src" ));
138+ buildvm .root_module . addIncludePath (upstream .path ("src/host" ));
139+ buildvm .root_module . addIncludePath (buildvm_arch_h .dirname ());
140+ buildvm .root_module . addIncludePath (luajit_h .dirname ());
152141
153142 // Use buildvm to generate files and headers used in the final vm
154143 const buildvm_bcdef = b .addRunArtifact (buildvm );
@@ -213,19 +202,19 @@ pub fn configure(b: *Build, target: Build.ResolvedTarget, optimize: std.builtin.
213202 library .step .dependOn (& buildvm_folddef .step );
214203 library .step .dependOn (& buildvm_ljvm .step );
215204
216- library .linkLibC () ;
205+ library .is_linking_libc = true ;
217206
218207 lib .addCMacro ("LUAJIT_UNWIND_EXTERNAL" , "" );
219208
220209 lib .linkSystemLibrary ("unwind" , .{});
221210
222- library .addIncludePath (upstream .path ("src" ));
223- library .addIncludePath (luajit_h .dirname ());
224- library .addIncludePath (bcdef_header .dirname ());
225- library .addIncludePath (ffdef_header .dirname ());
226- library .addIncludePath (libdef_header .dirname ());
227- library .addIncludePath (recdef_header .dirname ());
228- library .addIncludePath (folddef_header .dirname ());
211+ library .root_module . addIncludePath (upstream .path ("src" ));
212+ library .root_module . addIncludePath (luajit_h .dirname ());
213+ library .root_module . addIncludePath (bcdef_header .dirname ());
214+ library .root_module . addIncludePath (ffdef_header .dirname ());
215+ library .root_module . addIncludePath (libdef_header .dirname ());
216+ library .root_module . addIncludePath (recdef_header .dirname ());
217+ library .root_module . addIncludePath (folddef_header .dirname ());
229218
230219 lib .addCSourceFiles (.{
231220 .root = .{ .dependency = .{
@@ -235,12 +224,7 @@ pub fn configure(b: *Build, target: Build.ResolvedTarget, optimize: std.builtin.
235224 .files = & luajit_vm ,
236225 });
237226
238- // FIXME: remove branch when zig-0.15 is released and 0.14 can be dropped
239- if (builtin .zig_version .major == 0 and builtin .zig_version .minor < 15 ) {
240- lib .sanitize_c = false ;
241- } else {
242- lib .sanitize_c = .off ;
243- }
227+ lib .sanitize_c = .off ;
244228
245229 library .installHeader (upstream .path ("src/lua.h" ), "lua.h" );
246230 library .installHeader (upstream .path ("src/lualib.h" ), "lualib.h" );
0 commit comments