fix(build): remove deprecated aliases in build.zig removed for zig 0.15

This makes the zig build compatible with the upcoming zig 0.15 release,
while still supporting the current stable 0.14 release still used in CI.
This commit is contained in:
bfredl
2025-08-09 11:32:19 +02:00
parent 2c3929624a
commit a2b0be19bf
7 changed files with 58 additions and 35 deletions

View File

@@ -14,16 +14,20 @@ pub fn build_nlua0(
const nlua0_exe = b.addExecutable(.{
.name = "nlua0",
.root_source_file = b.path("src/nlua0.zig"),
.target = target,
.optimize = optimize,
.root_module = b.createModule(.{
.root_source_file = b.path("src/nlua0.zig"),
.target = target,
.optimize = optimize,
}),
});
const nlua0_mod = nlua0_exe.root_module;
const exe_unit_tests = b.addTest(.{
.root_source_file = b.path("src/nlua0.zig"),
.target = target,
.optimize = optimize,
.root_module = b.createModule(.{
.root_source_file = b.path("src/nlua0.zig"),
.target = target,
.optimize = optimize,
}),
});
const embedded_data = b.addModule("embedded_data", .{
@@ -31,7 +35,7 @@ pub fn build_nlua0(
});
for ([2]*std.Build.Module{ nlua0_mod, exe_unit_tests.root_module }) |mod| {
mod.addImport("ziglua", ziglua.module("lua_wrapper"));
mod.addImport("ziglua", ziglua.module("zlua"));
mod.addImport("embedded_data", embedded_data);
// addImport already links by itself. but we need headers as well..
mod.linkLibrary(ziglua.artifact("lua"));
@@ -112,10 +116,13 @@ pub fn build_libluv(
) !*std.Build.Step.Compile {
const upstream = b.dependency("luv", .{});
const compat53 = b.dependency("lua_compat53", .{});
const lib = b.addStaticLibrary(.{
const lib = b.addLibrary(.{
.name = "luv",
.target = target,
.optimize = optimize,
.linkage = .static,
.root_module = b.createModule(.{
.target = target,
.optimize = optimize,
}),
});
lib.linkLibrary(lua);