Replace deprecated functions with root_module interactions

This commit is contained in:
PegaFox 2026-04-24 11:27:11 -04:00
parent 4f814ff761
commit 9d12e6d06f

View file

@ -69,24 +69,24 @@ pub fn build(b: *Build) !void {
.freebsd, .netbsd, .openbsd => { .freebsd, .netbsd, .openbsd => {
t.root_module.addCMacro("LUA_USE_LINUX", ""); t.root_module.addCMacro("LUA_USE_LINUX", "");
t.root_module.addCMacro("LUA_USE_READLINE", ""); t.root_module.addCMacro("LUA_USE_READLINE", "");
t.addIncludePath(.{ .cwd_relative = "/usr/include/edit" }); t.root_module.addIncludePath(.{ .cwd_relative = "/usr/include/edit" });
t.linkSystemLibrary("edit"); t.root_module.linkSystemLibrary("edit", .{});
}, },
.ios => { .ios => {
t.root_module.addCMacro("LUA_USE_IOS", ""); t.root_module.addCMacro("LUA_USE_IOS", "");
}, },
.linux => { .linux => {
t.root_module.addCMacro("LUA_USE_LINUX", ""); t.root_module.addCMacro("LUA_USE_LINUX", "");
t.linkSystemLibrary("dl"); t.root_module.linkSystemLibrary("dl", .{});
if (use_readline.?) { if (use_readline.?) {
t.root_module.addCMacro("LUA_USE_READLINE", ""); t.root_module.addCMacro("LUA_USE_READLINE", "");
t.linkSystemLibrary("readline"); t.root_module.linkSystemLibrary("readline", .{});
} }
}, },
.macos => { .macos => {
t.root_module.addCMacro("LUA_USE_MACOSX", ""); t.root_module.addCMacro("LUA_USE_MACOSX", "");
t.root_module.addCMacro("LUA_USE_READLINE", ""); t.root_module.addCMacro("LUA_USE_READLINE", "");
t.linkSystemLibrary("readline"); t.root_module.linkSystemLibrary("readline", .{});
}, },
else => {}, else => {},
} }
@ -96,7 +96,7 @@ pub fn build(b: *Build) !void {
exe.root_module.addCMacro("LUA_BUILD_AS_DLL", ""); exe.root_module.addCMacro("LUA_BUILD_AS_DLL", "");
} }
if (shared) |s| { if (shared) |s| {
s.addCSourceFiles(.{ s.root_module.addCSourceFiles(.{
.root = lua_src.path("src"), .root = lua_src.path("src"),
.files = &base_src, .files = &base_src,
.flags = &cflags, .flags = &cflags,
@ -109,7 +109,7 @@ pub fn build(b: *Build) !void {
); );
} }
lib.addCSourceFiles(.{ lib.root_module.addCSourceFiles(.{
.root = lua_src.path("src"), .root = lua_src.path("src"),
.files = &base_src, .files = &base_src,
.flags = &cflags, .flags = &cflags,
@ -121,26 +121,26 @@ pub fn build(b: *Build) !void {
.{ .include_extensions = &lua_inc }, .{ .include_extensions = &lua_inc },
); );
exe.addCSourceFile(.{ exe.root_module.addCSourceFile(.{
.file = lua_src.path("src/lua.c"), .file = lua_src.path("src/lua.c"),
.flags = &cflags, .flags = &cflags,
}); });
exec.addCSourceFile(.{ exec.root_module.addCSourceFile(.{
.file = lua_src.path("src/luac.c"), .file = lua_src.path("src/luac.c"),
.flags = &cflags, .flags = &cflags,
}); });
if (shared) |s| { if (shared) |s| {
exe.linkLibrary(s); exe.root_module.linkLibrary(s);
b.installArtifact(s); b.installArtifact(s);
} else { } else {
exe.linkLibrary(lib); exe.root_module.linkLibrary(lib);
b.installArtifact(lib); b.installArtifact(lib);
} }
b.installArtifact(exe); b.installArtifact(exe);
exec.linkLibrary(lib); exec.root_module.linkLibrary(lib);
b.installArtifact(exec); b.installArtifact(exec);
b.installDirectory(.{ b.installDirectory(.{