Merge pull request #35263 from bfredl/zig15

fix(build): remove deprecated aliases in build.zig removed for zig 0.15
This commit is contained in:
bfredl
2025-08-10 09:24:27 +02:00
committed by GitHub
7 changed files with 58 additions and 35 deletions

View File

@@ -54,14 +54,14 @@ pub fn build(b: *std.Build) !void {
const host_use_luajit = if (cross_compiling) false else use_luajit; const host_use_luajit = if (cross_compiling) false else use_luajit;
const E = enum { luajit, lua51 }; const E = enum { luajit, lua51 };
const ziglua = b.dependency("lua_wrapper", .{ const ziglua = b.dependency("zlua", .{
.target = target, .target = target,
.optimize = optimize_lua, .optimize = optimize_lua,
.lang = if (use_luajit) E.luajit else E.lua51, .lang = if (use_luajit) E.luajit else E.lua51,
.shared = false, .shared = false,
}); });
const ziglua_host = if (cross_compiling) b.dependency("lua_wrapper", .{ const ziglua_host = if (cross_compiling) b.dependency("zlua", .{
.target = target_host, .target = target_host,
.optimize = optimize_lua, .optimize = optimize_lua,
.lang = if (host_use_luajit) E.luajit else E.lua51, .lang = if (host_use_luajit) E.luajit else E.lua51,
@@ -74,8 +74,8 @@ pub fn build(b: *std.Build) !void {
// this is currently not necessary, as ziglua currently doesn't use lazy dependencies // this is currently not necessary, as ziglua currently doesn't use lazy dependencies
// to circumvent ziglua.artifact() failing in a bad way. // to circumvent ziglua.artifact() failing in a bad way.
// const lua = lazyArtifact(ziglua, "lua") orelse return; const lua = lazyArtifact(ziglua, "lua") orelse return;
const lua = ziglua.artifact("lua"); // const lua = ziglua.artifact("lua");
const libuv_dep = b.dependency("libuv", .{ .target = target, .optimize = optimize }); const libuv_dep = b.dependency("libuv", .{ .target = target, .optimize = optimize });
const libuv = libuv_dep.artifact("uv"); const libuv = libuv_dep.artifact("uv");
@@ -257,8 +257,10 @@ pub fn build(b: *std.Build) !void {
const nvim_exe = b.addExecutable(.{ const nvim_exe = b.addExecutable(.{
.name = "nvim", .name = "nvim",
.root_module = b.createModule(.{
.target = target, .target = target,
.optimize = optimize, .optimize = optimize,
}),
}); });
nvim_exe.rdynamic = true; // -E nvim_exe.rdynamic = true; // -E
@@ -371,8 +373,10 @@ pub fn test_fixture(
) *std.Build.Step { ) *std.Build.Step {
const fixture = b.addExecutable(.{ const fixture = b.addExecutable(.{
.name = name, .name = name,
.root_module = b.createModule(.{
.target = target, .target = target,
.optimize = optimize, .optimize = optimize,
}),
}); });
const source = if (std.mem.eql(u8, name, "pwsh-test")) "shell-test" else name; const source = if (std.mem.eql(u8, name, "pwsh-test")) "shell-test" else name;
fixture.addCSourceFile(.{ .file = b.path(b.fmt("./test/functional/fixtures/{s}.c", .{source})) }); fixture.addCSourceFile(.{ .file = b.path(b.fmt("./test/functional/fixtures/{s}.c", .{source})) });

View File

@@ -5,9 +5,9 @@
.minimum_zig_version = "0.14.0", .minimum_zig_version = "0.14.0",
.dependencies = .{ .dependencies = .{
.lua_wrapper = .{ .zlua = .{
.url = "git+https://github.com/natecraddock/ziglua#7bfb3c2b87220cdc89ef01cc99a200dad7a28e50", .url = "git+https://github.com/natecraddock/ziglua#6889b2d90ee6ae96810a9f04ec7c62d9aa91d088",
.hash = "lua_wrapper-0.1.0-OyMC27fOBAAU3E2ueB-EWGSgsuCFQZL83pT0nQJ1ufOI", .hash = "zlua-0.1.0-hGRpCxctBQDEQgDArJ0Kc4RDIsD-Hw3pw9pPPw_kGmmY",
}, },
.lpeg = .{ .lpeg = .{
.url = "https://github.com/neovim/deps/raw/d495ee6f79e7962a53ad79670cb92488abe0b9b4/opt/lpeg-1.1.0.tar.gz", .url = "https://github.com/neovim/deps/raw/d495ee6f79e7962a53ad79670cb92488abe0b9b4/opt/lpeg-1.1.0.tar.gz",
@@ -22,8 +22,8 @@
.hash = "N-V-__8AADi-AwDnVoXwDCQvv2wcYOmN0bJLqZ44J3lwoQY2", .hash = "N-V-__8AADi-AwDnVoXwDCQvv2wcYOmN0bJLqZ44J3lwoQY2",
}, },
.treesitter = .{ .treesitter = .{
.url = "git+https://github.com/tree-sitter/tree-sitter?ref=v0.25.8#854f527f6ef9fdf563efb13d016e52df3ee6c45c", .url = "git+https://github.com/tree-sitter/tree-sitter#d87921bb9c39b0b06c811f2082f9a9991cdca027",
.hash = "tree_sitter-0.26.0-Tw2sR8u8CwBPBvzDbE0Ggokap5sll_qol0WSVuwjdOfC", .hash = "tree_sitter-0.26.0-Tw2sRxO7CwC0NyDrSygSi7UXRHMNUFEF8GRq6dK81lRF",
}, },
.libuv = .{ .path = "./deps/libuv" }, .libuv = .{ .path = "./deps/libuv" },
.utf8proc = .{ .path = "./deps/utf8proc/" }, .utf8proc = .{ .path = "./deps/utf8proc/" },

View File

@@ -5,10 +5,13 @@ pub fn build(b: *std.Build) !void {
const optimize = b.standardOptimizeOption(.{}); const optimize = b.standardOptimizeOption(.{});
const upstream = b.dependency("libiconv", .{}); const upstream = b.dependency("libiconv", .{});
const lib = b.addStaticLibrary(.{ const lib = b.addLibrary(.{
.name = "iconv", .name = "iconv",
.linkage = .static,
.root_module = b.createModule(.{
.target = target, .target = target,
.optimize = optimize, .optimize = optimize,
}),
}); });
lib.addIncludePath(b.path("include/")); lib.addIncludePath(b.path("include/"));

View File

@@ -6,10 +6,13 @@ pub fn build(b: *std.Build) !void {
const optimize = b.standardOptimizeOption(.{}); const optimize = b.standardOptimizeOption(.{});
const upstream = b.dependency("libuv", .{}); const upstream = b.dependency("libuv", .{});
const lib = b.addStaticLibrary(.{ const lib = b.addLibrary(.{
.name = "uv", .name = "uv",
.linkage = .static,
.root_module = b.createModule(.{
.target = target, .target = target,
.optimize = optimize, .optimize = optimize,
}),
}); });
lib.addIncludePath(upstream.path("include")); lib.addIncludePath(upstream.path("include"));

View File

@@ -5,10 +5,13 @@ pub fn build(b: *std.Build) !void {
const optimize = b.standardOptimizeOption(.{}); const optimize = b.standardOptimizeOption(.{});
const upstream = b.dependency("unibilium", .{}); const upstream = b.dependency("unibilium", .{});
const lib = b.addStaticLibrary(.{ const lib = b.addLibrary(.{
.name = "unibilium", .name = "unibilium",
.linkage = .static,
.root_module = b.createModule(.{
.target = target, .target = target,
.optimize = optimize, .optimize = optimize,
}),
}); });
lib.addIncludePath(upstream.path("")); lib.addIncludePath(upstream.path(""));

View File

@@ -5,10 +5,13 @@ pub fn build(b: *std.Build) !void {
const optimize = b.standardOptimizeOption(.{}); const optimize = b.standardOptimizeOption(.{});
const upstream = b.dependency("utf8proc", .{}); const upstream = b.dependency("utf8proc", .{});
const lib = b.addStaticLibrary(.{ const lib = b.addLibrary(.{
.name = "utf8proc", .name = "utf8proc",
.linkage = .static,
.root_module = b.createModule(.{
.target = target, .target = target,
.optimize = optimize, .optimize = optimize,
}),
}); });
lib.addIncludePath(upstream.path("")); lib.addIncludePath(upstream.path(""));

View File

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