mirror of
https://github.com/neovim/neovim.git
synced 2026-08-17 21:44:47 -05:00
fix(build): more changes to make zig 0.16.0 work
This commit is contained in:
@@ -255,7 +255,7 @@ jobs:
|
|||||||
|
|
||||||
- uses: mlugg/setup-zig@d1434d08867e3ee9daa34448df10607b98908d29 # v2.2.1
|
- uses: mlugg/setup-zig@d1434d08867e3ee9daa34448df10607b98908d29 # v2.2.1
|
||||||
with:
|
with:
|
||||||
version: 0.16.0-dev.1912+0cbaaa5eb
|
version: 0.16.0
|
||||||
- run: sudo apt-get install -y inotify-tools
|
- run: sudo apt-get install -y inotify-tools
|
||||||
|
|
||||||
- run: zig build $OPTS test_nlua0
|
- run: zig build $OPTS test_nlua0
|
||||||
@@ -278,7 +278,7 @@ jobs:
|
|||||||
|
|
||||||
- uses: mlugg/setup-zig@d1434d08867e3ee9daa34448df10607b98908d29 # v2.2.1
|
- uses: mlugg/setup-zig@d1434d08867e3ee9daa34448df10607b98908d29 # v2.2.1
|
||||||
with:
|
with:
|
||||||
version: 0.16.0-dev.1912+0cbaaa5eb
|
version: 0.16.0
|
||||||
|
|
||||||
- run: zig build test_nlua0 -Dluajit=false
|
- run: zig build test_nlua0 -Dluajit=false
|
||||||
- run: zig build nvim_bin -Dluajit=false && ./zig-out/bin/nvim --version
|
- run: zig build nvim_bin -Dluajit=false && ./zig-out/bin/nvim --version
|
||||||
@@ -295,7 +295,7 @@ jobs:
|
|||||||
|
|
||||||
- uses: mlugg/setup-zig@d1434d08867e3ee9daa34448df10607b98908d29 # v2.2.1
|
- uses: mlugg/setup-zig@d1434d08867e3ee9daa34448df10607b98908d29 # v2.2.1
|
||||||
with:
|
with:
|
||||||
version: 0.16.0-dev.1912+0cbaaa5eb
|
version: 0.16.0
|
||||||
|
|
||||||
- run: zig build test_nlua0
|
- run: zig build test_nlua0
|
||||||
- run: zig build nvim_bin
|
- run: zig build nvim_bin
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ compile_commands.json
|
|||||||
# Build/deps dir
|
# Build/deps dir
|
||||||
/.zig-cache/
|
/.zig-cache/
|
||||||
/zig-out/
|
/zig-out/
|
||||||
|
/zig-pkg/
|
||||||
/.deps/
|
/.deps/
|
||||||
/tmp/
|
/tmp/
|
||||||
/.clangd/
|
/.clangd/
|
||||||
|
|||||||
@@ -42,9 +42,7 @@ pub fn lazyArtifact(d: *std.Build.Dependency, name: []const u8) ?*std.Build.Step
|
|||||||
pub fn build(b: *std.Build) !void {
|
pub fn build(b: *std.Build) !void {
|
||||||
const target = b.standardTargetOptions(.{});
|
const target = b.standardTargetOptions(.{});
|
||||||
const optimize = b.standardOptimizeOption(.{});
|
const optimize = b.standardOptimizeOption(.{});
|
||||||
var threaded: std.Io.Threaded = .init_single_threaded;
|
const io = b.graph.io;
|
||||||
defer threaded.deinit();
|
|
||||||
const io = threaded.io();
|
|
||||||
|
|
||||||
const t = target.result;
|
const t = target.result;
|
||||||
const os_tag = t.os.tag;
|
const os_tag = t.os.tag;
|
||||||
@@ -69,7 +67,7 @@ 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 system_integration_options = SystemIntegrationOptions{
|
const sys_opts = SystemIntegrationOptions{
|
||||||
.lpeg = b.systemIntegrationOption("lpeg", .{}),
|
.lpeg = b.systemIntegrationOption("lpeg", .{}),
|
||||||
.lua = b.systemIntegrationOption("lua", .{}),
|
.lua = b.systemIntegrationOption("lua", .{}),
|
||||||
.tree_sitter = b.systemIntegrationOption("tree-sitter", .{}),
|
.tree_sitter = b.systemIntegrationOption("tree-sitter", .{}),
|
||||||
@@ -83,20 +81,20 @@ pub fn build(b: *std.Build) !void {
|
|||||||
.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,
|
||||||
.system_lua = system_integration_options.lua,
|
.system_lua = sys_opts.lua,
|
||||||
});
|
});
|
||||||
const ziglua_host = if (cross_compiling) b.dependency("zlua", .{
|
const ziglua_host = if (cross_compiling) b.dependency("zlua", .{
|
||||||
.target = target_host,
|
.target = target_host,
|
||||||
.optimize = .ReleaseSmall,
|
.optimize = .ReleaseSmall,
|
||||||
.lang = if (host_use_luajit) E.luajit else E.lua51,
|
.lang = if (host_use_luajit) E.luajit else E.lua51,
|
||||||
.system_lua = system_integration_options.lua,
|
.system_lua = sys_opts.lua,
|
||||||
.shared = false,
|
.shared = false,
|
||||||
}) else ziglua;
|
}) else ziglua;
|
||||||
var lua: ?*Compile = null;
|
var lua: ?*Compile = null;
|
||||||
var libuv: ?*Compile = null;
|
var libuv: ?*Compile = null;
|
||||||
var libluv: ?*Compile = null;
|
var libluv: ?*Compile = null;
|
||||||
var libluv_host: ?*Compile = null;
|
var libluv_host: ?*Compile = null;
|
||||||
if (!system_integration_options.lua) {
|
if (!sys_opts.lua) {
|
||||||
// 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.
|
||||||
lua = lazyArtifact(ziglua, "lua") orelse return;
|
lua = lazyArtifact(ziglua, "lua") orelse return;
|
||||||
@@ -104,7 +102,7 @@ pub fn build(b: *std.Build) !void {
|
|||||||
_ = lazyArtifact(ziglua_host, "lua") orelse return;
|
_ = lazyArtifact(ziglua_host, "lua") orelse return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!system_integration_options.uv) {
|
if (!sys_opts.uv) {
|
||||||
// NOTE: libuv on Windows depends on Windows SDK when compiled with .Debug mode
|
// NOTE: libuv on Windows depends on Windows SDK when compiled with .Debug mode
|
||||||
// https://github.com/neovim/neovim/issues/36889
|
// https://github.com/neovim/neovim/issues/36889
|
||||||
const optimize_uv = if (optimize == .Debug and target.result.os.tag == .windows) .ReleaseSafe else optimize;
|
const optimize_uv = if (optimize == .Debug and target.result.os.tag == .windows) .ReleaseSafe else optimize;
|
||||||
@@ -130,25 +128,25 @@ pub fn build(b: *std.Build) !void {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const lpeg = if (system_integration_options.lpeg) null else b.lazyDependency("lpeg", .{});
|
const lpeg = if (sys_opts.lpeg) null else b.lazyDependency("lpeg", .{});
|
||||||
|
|
||||||
const iconv = if (is_windows or is_darwin) b.lazyDependency("libiconv", .{
|
const iconv = if (is_windows or is_darwin) b.lazyDependency("libiconv", .{
|
||||||
.target = target,
|
.target = target,
|
||||||
.optimize = optimize,
|
.optimize = optimize,
|
||||||
}) else null;
|
}) else null;
|
||||||
|
|
||||||
const utf8proc = if (system_integration_options.utf8proc) null else b.lazyDependency("utf8proc", .{
|
const utf8proc = if (sys_opts.utf8proc) null else b.lazyDependency("utf8proc", .{
|
||||||
.target = target,
|
.target = target,
|
||||||
.optimize = optimize,
|
.optimize = optimize,
|
||||||
});
|
});
|
||||||
const unibilium = if (use_unibilium and !system_integration_options.unibilium) b.lazyDependency("unibilium", .{
|
const unibilium = if (use_unibilium and !sys_opts.unibilium) b.lazyDependency("unibilium", .{
|
||||||
.target = target,
|
.target = target,
|
||||||
.optimize = optimize,
|
.optimize = optimize,
|
||||||
}) else null;
|
}) else null;
|
||||||
|
|
||||||
// TODO(bfredl): fix upstream bugs with UBSAN
|
// TODO(bfredl): fix upstream bugs with UBSAN
|
||||||
const optimize_ts = .ReleaseFast;
|
const optimize_ts = .ReleaseFast;
|
||||||
const treesitter = if (system_integration_options.tree_sitter) null else b.lazyDependency("treesitter", .{
|
const treesitter = if (sys_opts.tree_sitter) null else b.lazyDependency("treesitter", .{
|
||||||
.target = target,
|
.target = target,
|
||||||
.optimize = optimize_ts,
|
.optimize = optimize_ts,
|
||||||
});
|
});
|
||||||
@@ -162,7 +160,7 @@ pub fn build(b: *std.Build) !void {
|
|||||||
ziglua_host,
|
ziglua_host,
|
||||||
lpeg,
|
lpeg,
|
||||||
libluv_host,
|
libluv_host,
|
||||||
system_integration_options,
|
sys_opts,
|
||||||
);
|
);
|
||||||
|
|
||||||
// usual caveat emptor: might need to force a rebuild if the only change is
|
// usual caveat emptor: might need to force a rebuild if the only change is
|
||||||
@@ -340,7 +338,7 @@ pub fn build(b: *std.Build) !void {
|
|||||||
"-C", b.build_root.path orelse ".", // affects the --git-dir argument
|
"-C", b.build_root.path orelse ".", // affects the --git-dir argument
|
||||||
"--git-dir", ".git", // affected by the -C argument
|
"--git-dir", ".git", // affected by the -C argument
|
||||||
"describe", "--dirty", "--match", "v*.*.*", //
|
"describe", "--dirty", "--match", "v*.*.*", //
|
||||||
}, &code, .Ignore) catch {
|
}, &code, .ignore) catch {
|
||||||
break :v version_string;
|
break :v version_string;
|
||||||
};
|
};
|
||||||
const git_describe = std.mem.trim(u8, git_describe_untrimmed, " \n\r");
|
const git_describe = std.mem.trim(u8, git_describe_untrimmed, " \n\r");
|
||||||
@@ -379,31 +377,31 @@ pub fn build(b: *std.Build) !void {
|
|||||||
var unittest_include_path: std.ArrayList(LazyPath) = try .initCapacity(b.allocator, 2);
|
var unittest_include_path: std.ArrayList(LazyPath) = try .initCapacity(b.allocator, 2);
|
||||||
try unittest_include_path.append(b.allocator, b.path("src/"));
|
try unittest_include_path.append(b.allocator, b.path("src/"));
|
||||||
try unittest_include_path.append(b.allocator, gen_config.getDirectory());
|
try unittest_include_path.append(b.allocator, gen_config.getDirectory());
|
||||||
if (system_integration_options.lua) {
|
if (sys_opts.lua) {
|
||||||
try appendSystemIncludePath(b, &unittest_include_path, lualib_name);
|
try appendSystemIncludePath(b, &unittest_include_path, lualib_name);
|
||||||
} else if (lua) |compile| {
|
} else if (lua) |compile| {
|
||||||
try unittest_include_path.append(b.allocator, compile.getEmittedIncludeTree());
|
try unittest_include_path.append(b.allocator, compile.getEmittedIncludeTree());
|
||||||
}
|
}
|
||||||
if (system_integration_options.uv) {
|
if (sys_opts.uv) {
|
||||||
try appendSystemIncludePath(b, &unittest_include_path, "libuv");
|
try appendSystemIncludePath(b, &unittest_include_path, "libuv");
|
||||||
try appendSystemIncludePath(b, &unittest_include_path, "libluv");
|
try appendSystemIncludePath(b, &unittest_include_path, "libluv");
|
||||||
} else {
|
} else {
|
||||||
if (libuv) |compile| try unittest_include_path.append(b.allocator, compile.getEmittedIncludeTree());
|
if (libuv) |compile| try unittest_include_path.append(b.allocator, compile.getEmittedIncludeTree());
|
||||||
if (libluv) |compile| try unittest_include_path.append(b.allocator, compile.getEmittedIncludeTree());
|
if (libluv) |compile| try unittest_include_path.append(b.allocator, compile.getEmittedIncludeTree());
|
||||||
}
|
}
|
||||||
if (system_integration_options.utf8proc) {
|
if (sys_opts.utf8proc) {
|
||||||
try appendSystemIncludePath(b, &unittest_include_path, "libutf8proc");
|
try appendSystemIncludePath(b, &unittest_include_path, "libutf8proc");
|
||||||
} else if (utf8proc) |dep| {
|
} else if (utf8proc) |dep| {
|
||||||
try unittest_include_path.append(b.allocator, dep.artifact("utf8proc").getEmittedIncludeTree());
|
try unittest_include_path.append(b.allocator, dep.artifact("utf8proc").getEmittedIncludeTree());
|
||||||
}
|
}
|
||||||
if (use_unibilium) {
|
if (use_unibilium) {
|
||||||
if (system_integration_options.unibilium) {
|
if (sys_opts.unibilium) {
|
||||||
try appendSystemIncludePath(b, &unittest_include_path, "unibilium");
|
try appendSystemIncludePath(b, &unittest_include_path, "unibilium");
|
||||||
} else if (unibilium) |dep| {
|
} else if (unibilium) |dep| {
|
||||||
try unittest_include_path.append(b.allocator, dep.artifact("unibilium").getEmittedIncludeTree());
|
try unittest_include_path.append(b.allocator, dep.artifact("unibilium").getEmittedIncludeTree());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (system_integration_options.tree_sitter) {
|
if (sys_opts.tree_sitter) {
|
||||||
try appendSystemIncludePath(b, &unittest_include_path, "tree-sitter");
|
try appendSystemIncludePath(b, &unittest_include_path, "tree-sitter");
|
||||||
} else if (treesitter) |dep| {
|
} else if (treesitter) |dep| {
|
||||||
try unittest_include_path.append(b.allocator, dep.artifact("tree-sitter").getEmittedIncludeTree());
|
try unittest_include_path.append(b.allocator, dep.artifact("tree-sitter").getEmittedIncludeTree());
|
||||||
@@ -439,63 +437,51 @@ pub fn build(b: *std.Build) !void {
|
|||||||
.install_subdir = "headers/",
|
.install_subdir = "headers/",
|
||||||
}).step);
|
}).step);
|
||||||
|
|
||||||
var nvim_exe_module = b.createModule(.{
|
var nvim_mod = b.createModule(.{
|
||||||
.target = target,
|
.target = target,
|
||||||
.optimize = optimize,
|
.optimize = optimize,
|
||||||
.link_libc = true,
|
.link_libc = true,
|
||||||
});
|
});
|
||||||
const nvim_exe = b.addExecutable(.{
|
const nvim_exe = b.addExecutable(.{ .name = "nvim", .root_module = nvim_mod });
|
||||||
.name = "nvim",
|
|
||||||
.root_module = nvim_exe_module,
|
|
||||||
});
|
|
||||||
nvim_exe.rdynamic = true; // -E
|
nvim_exe.rdynamic = true; // -E
|
||||||
|
|
||||||
if (system_integration_options.lua) {
|
if (sys_opts.lua) {
|
||||||
nvim_exe.root_module.linkSystemLibrary(lualib_name, .{});
|
nvim_exe.root_module.linkSystemLibrary(lualib_name, .{});
|
||||||
} else if (lua) |compile| {
|
} else if (lua) |compile| {
|
||||||
nvim_exe_module.linkLibrary(compile);
|
nvim_mod.linkLibrary(compile);
|
||||||
}
|
}
|
||||||
if (system_integration_options.uv) {
|
if (sys_opts.uv) {
|
||||||
nvim_exe_module.linkSystemLibrary("libuv", .{});
|
nvim_mod.linkSystemLibrary("libuv", .{});
|
||||||
nvim_exe_module.linkSystemLibrary("libluv", .{});
|
nvim_mod.linkSystemLibrary("libluv", .{});
|
||||||
} else {
|
} else {
|
||||||
if (libuv) |compile| nvim_exe.root_module.linkLibrary(compile);
|
if (libuv) |compile| nvim_mod.linkLibrary(compile);
|
||||||
if (libluv) |compile| nvim_exe.root_module.linkLibrary(compile);
|
if (libluv) |compile| nvim_mod.linkLibrary(compile);
|
||||||
}
|
}
|
||||||
if (iconv) |dep| nvim_exe_module.linkLibrary(dep.artifact("iconv"));
|
if (iconv) |dep| nvim_mod.linkLibrary(dep.artifact("iconv"));
|
||||||
if (system_integration_options.utf8proc) {
|
if (sys_opts.utf8proc) {
|
||||||
nvim_exe_module.linkSystemLibrary("utf8proc", .{});
|
nvim_mod.linkSystemLibrary("utf8proc", .{});
|
||||||
} else if (utf8proc) |dep| {
|
} else if (utf8proc) |dep| {
|
||||||
nvim_exe_module.linkLibrary(dep.artifact("utf8proc"));
|
nvim_mod.linkLibrary(dep.artifact("utf8proc"));
|
||||||
}
|
}
|
||||||
if (use_unibilium) {
|
if (use_unibilium) {
|
||||||
if (system_integration_options.unibilium) {
|
if (sys_opts.unibilium) {
|
||||||
nvim_exe_module.linkSystemLibrary("unibilium", .{});
|
nvim_mod.linkSystemLibrary("unibilium", .{});
|
||||||
} else if (unibilium) |dep| {
|
} else if (unibilium) |dep| {
|
||||||
nvim_exe_module.linkLibrary(dep.artifact("unibilium"));
|
nvim_mod.linkLibrary(dep.artifact("unibilium"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (system_integration_options.tree_sitter) {
|
if (sys_opts.tree_sitter) {
|
||||||
nvim_exe_module.linkSystemLibrary("tree-sitter", .{});
|
nvim_mod.linkSystemLibrary("tree-sitter", .{});
|
||||||
} else if (treesitter) |dep| {
|
} else if (treesitter) |dep| {
|
||||||
nvim_exe_module.linkLibrary(dep.artifact("tree-sitter"));
|
nvim_mod.linkLibrary(dep.artifact("tree-sitter"));
|
||||||
}
|
}
|
||||||
if (is_windows) {
|
if (is_windows) {
|
||||||
nvim_exe_module.linkSystemLibrary("netapi32", .{});
|
nvim_mod.linkSystemLibrary("netapi32", .{});
|
||||||
}
|
}
|
||||||
nvim_exe_module.addIncludePath(b.path("src"));
|
nvim_mod.addIncludePath(b.path("src"));
|
||||||
nvim_exe_module.addIncludePath(gen_config.getDirectory());
|
nvim_mod.addIncludePath(gen_config.getDirectory());
|
||||||
nvim_exe_module.addIncludePath(gen_headers.getDirectory());
|
nvim_mod.addIncludePath(gen_headers.getDirectory());
|
||||||
try build_lua.add_lua_modules(
|
try build_lua.add_lua_modules(b, io, t, nvim_mod, lpeg, use_luajit, false, sys_opts);
|
||||||
b,
|
|
||||||
io,
|
|
||||||
t,
|
|
||||||
nvim_exe_module,
|
|
||||||
lpeg,
|
|
||||||
use_luajit,
|
|
||||||
false,
|
|
||||||
system_integration_options,
|
|
||||||
);
|
|
||||||
|
|
||||||
var unit_test_sources = try std.ArrayList([]u8).initCapacity(b.allocator, 10);
|
var unit_test_sources = try std.ArrayList([]u8).initCapacity(b.allocator, 10);
|
||||||
if (support_unittests) {
|
if (support_unittests) {
|
||||||
@@ -527,9 +513,9 @@ pub fn build(b: *std.Build) !void {
|
|||||||
if (is_windows) "-DUTF8PROC_STATIC" else "",
|
if (is_windows) "-DUTF8PROC_STATIC" else "",
|
||||||
if (use_unibilium) "-DHAVE_UNIBILIUM" else "",
|
if (use_unibilium) "-DHAVE_UNIBILIUM" else "",
|
||||||
};
|
};
|
||||||
nvim_exe_module.addCSourceFiles(.{ .files = src_paths, .flags = &flags });
|
nvim_mod.addCSourceFiles(.{ .files = src_paths, .flags = &flags });
|
||||||
|
|
||||||
nvim_exe_module.addCSourceFiles(.{ .files = &.{
|
nvim_mod.addCSourceFiles(.{ .files = &.{
|
||||||
"src/xdiff/xdiffi.c",
|
"src/xdiff/xdiffi.c",
|
||||||
"src/xdiff/xemit.c",
|
"src/xdiff/xemit.c",
|
||||||
"src/xdiff/xhistogram.c",
|
"src/xdiff/xhistogram.c",
|
||||||
@@ -542,7 +528,7 @@ pub fn build(b: *std.Build) !void {
|
|||||||
}, .flags = &flags });
|
}, .flags = &flags });
|
||||||
|
|
||||||
if (is_windows) {
|
if (is_windows) {
|
||||||
nvim_exe_module.addWin32ResourceFile(.{ .file = b.path("src/nvim/os/nvim.rc") });
|
nvim_mod.addWin32ResourceFile(.{ .file = b.path("src/nvim/os/nvim.rc") });
|
||||||
}
|
}
|
||||||
|
|
||||||
const nvim_exe_step = b.step("nvim_bin", "only the binary (not a fully working install!)");
|
const nvim_exe_step = b.step("nvim_bin", "only the binary (not a fully working install!)");
|
||||||
@@ -595,29 +581,11 @@ pub fn build(b: *std.Build) !void {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test_deps.dependOn(test_fixture(b, "shell-test", false, false, null, target, optimize, &flags));
|
test_deps.dependOn(test_fixture(b, "shell-test", false, false, null, target, optimize, &flags));
|
||||||
test_deps.dependOn(test_fixture(
|
test_deps.dependOn(test_fixture(b, "tty-test", true, sys_opts.uv, libuv, target, optimize, &flags));
|
||||||
b,
|
|
||||||
"tty-test",
|
|
||||||
true,
|
|
||||||
system_integration_options.uv,
|
|
||||||
libuv,
|
|
||||||
target,
|
|
||||||
optimize,
|
|
||||||
&flags,
|
|
||||||
));
|
|
||||||
test_deps.dependOn(test_fixture(b, "pwsh-test", false, false, null, target, optimize, &flags));
|
test_deps.dependOn(test_fixture(b, "pwsh-test", false, false, null, target, optimize, &flags));
|
||||||
test_deps.dependOn(test_fixture(b, "printargs-test", false, false, null, target, optimize, &flags));
|
test_deps.dependOn(test_fixture(b, "printargs-test", false, false, null, target, optimize, &flags));
|
||||||
test_deps.dependOn(test_fixture(b, "printenv-test", false, false, null, target, optimize, &flags));
|
test_deps.dependOn(test_fixture(b, "printenv-test", false, false, null, target, optimize, &flags));
|
||||||
test_deps.dependOn(test_fixture(
|
test_deps.dependOn(test_fixture(b, "streams-test", true, sys_opts.uv, libuv, target, optimize, &flags));
|
||||||
b,
|
|
||||||
"streams-test",
|
|
||||||
true,
|
|
||||||
system_integration_options.uv,
|
|
||||||
libuv,
|
|
||||||
target,
|
|
||||||
optimize,
|
|
||||||
&flags,
|
|
||||||
));
|
|
||||||
|
|
||||||
// tee: vendored in src/tee/
|
// tee: vendored in src/tee/
|
||||||
const tee_exe = b.addExecutable(.{
|
const tee_exe = b.addExecutable(.{
|
||||||
@@ -625,10 +593,10 @@ pub fn build(b: *std.Build) !void {
|
|||||||
.root_module = b.createModule(.{
|
.root_module = b.createModule(.{
|
||||||
.target = target,
|
.target = target,
|
||||||
.optimize = optimize,
|
.optimize = optimize,
|
||||||
|
.link_libc = true,
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
tee_exe.addCSourceFile(.{ .file = b.path("src/tee/tee.c") });
|
tee_exe.root_module.addCSourceFile(.{ .file = b.path("src/tee/tee.c") });
|
||||||
tee_exe.linkLibC();
|
|
||||||
test_deps.dependOn(&b.addInstallArtifact(tee_exe, .{}).step);
|
test_deps.dependOn(&b.addInstallArtifact(tee_exe, .{}).step);
|
||||||
|
|
||||||
// xxd - hex dump utility (vendored from Vim)
|
// xxd - hex dump utility (vendored from Vim)
|
||||||
@@ -698,10 +666,7 @@ pub fn test_fixture(
|
|||||||
.optimize = optimize,
|
.optimize = optimize,
|
||||||
.link_libc = true,
|
.link_libc = true,
|
||||||
});
|
});
|
||||||
const fixture = b.addExecutable(.{
|
const fixture = b.addExecutable(.{ .name = name, .root_module = root_module });
|
||||||
.name = name,
|
|
||||||
.root_module = root_module,
|
|
||||||
});
|
|
||||||
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;
|
||||||
if (std.mem.eql(u8, name, "printenv-test")) {
|
if (std.mem.eql(u8, name, "printenv-test")) {
|
||||||
fixture.mingw_unicode_entry_point = true; // uses UNICODE on WINDOWS :scream:
|
fixture.mingw_unicode_entry_point = true; // uses UNICODE on WINDOWS :scream:
|
||||||
@@ -827,7 +792,7 @@ fn appendSystemIncludePath(
|
|||||||
const stdout = try b.runAllowFail(
|
const stdout = try b.runAllowFail(
|
||||||
&[_][]const u8{ "pkg-config", system_name, "--cflags-only-I", "--keep-system-cflags" },
|
&[_][]const u8{ "pkg-config", system_name, "--cflags-only-I", "--keep-system-cflags" },
|
||||||
&code,
|
&code,
|
||||||
.Ignore,
|
.ignore,
|
||||||
);
|
);
|
||||||
if (code != 0) return std.Build.PkgConfigError.PkgConfigFailed;
|
if (code != 0) return std.Build.PkgConfigError.PkgConfigFailed;
|
||||||
var arg_it = std.mem.tokenizeAny(u8, stdout, " \r\n\t");
|
var arg_it = std.mem.tokenizeAny(u8, stdout, " \r\n\t");
|
||||||
|
|||||||
+2
-2
@@ -6,8 +6,8 @@
|
|||||||
|
|
||||||
.dependencies = .{
|
.dependencies = .{
|
||||||
.zlua = .{
|
.zlua = .{
|
||||||
.url = "git+https://github.com/natecraddock/ziglua#a1cae53f6b841dd4fa108103f4bd0f515ca29cfb",
|
.url = "git+https://github.com/natecraddock/ziglua#c09d0cb9f8175c1c02fbeae51940cfab15f3e085",
|
||||||
.hash = "zlua-0.1.0-hGRpCwxDBQD25I09a5dhcaNCEontuUsq2pgB34wjugHQ",
|
.hash = "zlua-0.1.0-hGRpC1hWBQAhR6kPtfypQ1Awn09a9JWpIuErNKPCMwSq",
|
||||||
},
|
},
|
||||||
.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",
|
||||||
|
|||||||
Vendored
+2
-1
@@ -1,5 +1,6 @@
|
|||||||
.{
|
.{
|
||||||
.name = "unibilium",
|
.name = .unibilium,
|
||||||
|
.fingerprint = 0x1d1baa4896ad720,
|
||||||
.version = "2.1.2",
|
.version = "2.1.2",
|
||||||
.paths = .{""},
|
.paths = .{""},
|
||||||
|
|
||||||
|
|||||||
Vendored
+2
-1
@@ -1,5 +1,6 @@
|
|||||||
.{
|
.{
|
||||||
.name = "utf8proc",
|
.name = .utf8proc,
|
||||||
|
.fingerprint = 0xdcddf08dbb8954c4,
|
||||||
.version = "2.10.0",
|
.version = "2.10.0",
|
||||||
.paths = .{""},
|
.paths = .{""},
|
||||||
|
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ API
|
|||||||
|
|
||||||
BUILD
|
BUILD
|
||||||
|
|
||||||
• todo
|
• Building using "zig build" requires zig 0.16.x.
|
||||||
|
|
||||||
DEFAULTS
|
DEFAULTS
|
||||||
|
|
||||||
|
|||||||
@@ -30,9 +30,9 @@ local zig_mode = {
|
|||||||
luajit = false,
|
luajit = false,
|
||||||
uncrustify = false,
|
uncrustify = false,
|
||||||
wasmtime = false,
|
wasmtime = false,
|
||||||
|
libuv = false,
|
||||||
unibilium = 'nested',
|
unibilium = 'nested',
|
||||||
utf8proc = 'nested',
|
utf8proc = 'nested',
|
||||||
libuv = 'nested',
|
|
||||||
}
|
}
|
||||||
|
|
||||||
local dependency_table = {} --- @type table<string, string>
|
local dependency_table = {} --- @type table<string, string>
|
||||||
|
|||||||
+1
-1
@@ -200,7 +200,7 @@ fn findLpeg(b: *std.Build, io: std.Io, target: std.Target) !?[]const u8 {
|
|||||||
"--variable=pc_system_libdirs",
|
"--variable=pc_system_libdirs",
|
||||||
"--keep-system-cflags",
|
"--keep-system-cflags",
|
||||||
"pkg-config",
|
"pkg-config",
|
||||||
}, &code, .Ignore), "\r\n");
|
}, &code, .ignore), "\r\n");
|
||||||
var paths: std.ArrayList([]const u8) = try .initCapacity(b.allocator, 0);
|
var paths: std.ArrayList([]const u8) = try .initCapacity(b.allocator, 0);
|
||||||
var path_it = std.mem.tokenizeAny(u8, dirs_stdout, " ,");
|
var path_it = std.mem.tokenizeAny(u8, dirs_stdout, " ,");
|
||||||
while (path_it.next()) |dir| {
|
while (path_it.next()) |dir| {
|
||||||
|
|||||||
+18
-10
@@ -22,7 +22,7 @@ extern "c" fn luaopen_lpeg(ptr: *anyopaque) c_int;
|
|||||||
extern "c" fn luaopen_bit(ptr: *anyopaque) c_int;
|
extern "c" fn luaopen_bit(ptr: *anyopaque) c_int;
|
||||||
extern "c" fn luaopen_luv(ptr: *anyopaque) c_int;
|
extern "c" fn luaopen_luv(ptr: *anyopaque) c_int;
|
||||||
|
|
||||||
fn init() !*Lua {
|
fn init_lua() !*Lua {
|
||||||
// Initialize the Lua vm
|
// Initialize the Lua vm
|
||||||
var lua = try Lua.init(std.heap.c_allocator);
|
var lua = try Lua.init(std.heap.c_allocator);
|
||||||
lua.openLibs();
|
lua.openLibs();
|
||||||
@@ -69,26 +69,34 @@ fn init() !*Lua {
|
|||||||
return lua;
|
return lua;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn main() !void {
|
pub fn main(init: std.process.Init) !void {
|
||||||
const argv = std.os.argv;
|
const args = init.minimal.args;
|
||||||
|
|
||||||
const lua = try init();
|
const lua = try init_lua();
|
||||||
defer lua.deinit();
|
defer lua.deinit();
|
||||||
|
|
||||||
if (argv.len < 2) {
|
if (args.vector.len < 2) {
|
||||||
std.debug.print("USAGE: nlua0 script.lua args...\n\n", .{});
|
std.debug.print("USAGE: nlua0 script.lua args...\n\n", .{});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
lua.createTable(@intCast(argv.len - 2), 1);
|
lua.createTable(@intCast(args.vector.len - 2), 1);
|
||||||
for (0.., argv[1..]) |i, arg| {
|
|
||||||
_ = lua.pushString(std.mem.span(arg));
|
var iter = try init.minimal.args.iterateAllocator(init.arena.allocator());
|
||||||
|
_ = iter.skip();
|
||||||
|
var i: u32 = 0;
|
||||||
|
var firstarg: [:0]const u8 = undefined;
|
||||||
|
while (iter.next()) |val| : (i += 1) {
|
||||||
|
_ = lua.pushString(val);
|
||||||
|
if (i == 0) {
|
||||||
|
firstarg = try lua.toString(-1); // preserved on lua heap..
|
||||||
|
}
|
||||||
lua.rawSetIndex(-2, @intCast(i));
|
lua.rawSetIndex(-2, @intCast(i));
|
||||||
}
|
}
|
||||||
lua.setGlobal("arg");
|
lua.setGlobal("arg");
|
||||||
|
|
||||||
_ = try lua.getGlobal("debug");
|
_ = try lua.getGlobal("debug");
|
||||||
_ = lua.getField(-1, "traceback");
|
_ = lua.getField(-1, "traceback");
|
||||||
try lua.loadFile(std.mem.span(argv[1]));
|
try lua.loadFile(firstarg);
|
||||||
lua.protectedCall(.{ .msg_handler = -2 }) catch |e| {
|
lua.protectedCall(.{ .msg_handler = -2 }) catch |e| {
|
||||||
if (e == error.LuaRuntime) {
|
if (e == error.LuaRuntime) {
|
||||||
const msg = try lua.toString(-1);
|
const msg = try lua.toString(-1);
|
||||||
@@ -104,7 +112,7 @@ fn do_ret1(lua: *Lua, str: [:0]const u8) !void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
test "simple test" {
|
test "simple test" {
|
||||||
const lua = try init();
|
const lua = try init_lua();
|
||||||
defer lua.deinit();
|
defer lua.deinit();
|
||||||
|
|
||||||
try do_ret1(lua, "return vim.isarray({2,3})");
|
try do_ret1(lua, "return vim.isarray({2,3})");
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ local clear = n.clear
|
|||||||
local eval = n.eval
|
local eval = n.eval
|
||||||
local has_powershell = n.has_powershell
|
local has_powershell = n.has_powershell
|
||||||
local matches = t.matches
|
local matches = t.matches
|
||||||
|
local not_matches = t.not_matches
|
||||||
local api = n.api
|
local api = n.api
|
||||||
local testprg = n.testprg
|
local testprg = n.testprg
|
||||||
|
|
||||||
@@ -48,7 +49,7 @@ describe(':make', function()
|
|||||||
local out = eval('execute("make")')
|
local out = eval('execute("make")')
|
||||||
-- Error message is captured in the file and printed in the footer
|
-- Error message is captured in the file and printed in the footer
|
||||||
matches(
|
matches(
|
||||||
'[\r\n]+.*[\r\n]+.*Unknown first argument%: foo%^%[%[0m[\r\n]+shell returned 3[\r\n]+%(1 of 1%)%: Unknown first argument%: foo',
|
'[\r\n]+.*[\r\n]+.*Unknown first argument%: foo.*[\r\n]+shell returned 3[\r\n]+%(1 of 1%)%: Unknown first argument%: foo',
|
||||||
out
|
out
|
||||||
)
|
)
|
||||||
end)
|
end)
|
||||||
@@ -63,8 +64,9 @@ describe(':make', function()
|
|||||||
local out = eval('execute("make")')
|
local out = eval('execute("make")')
|
||||||
-- Ensure there are no "shell returned X" messages between
|
-- Ensure there are no "shell returned X" messages between
|
||||||
-- command and last line (indicating zero exit)
|
-- command and last line (indicating zero exit)
|
||||||
matches('.*ready [$]%s+%^%[%[0m', out)
|
matches('.*ready [$]%s+', out)
|
||||||
matches('\n.*%: ready [$]', out)
|
matches('\n.*%: ready [$]', out)
|
||||||
|
not_matches('shell returned', out)
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|||||||
+2
-2
@@ -33,8 +33,8 @@ pub fn testStep(b: *std.Build, kind: []const u8, nvim_bin: *std.Build.Step.Compi
|
|||||||
try env.put("TMPDIR", b.fmt("{s}/Xtest_tmpdir", .{b.install_path}));
|
try env.put("TMPDIR", b.fmt("{s}/Xtest_tmpdir", .{b.install_path}));
|
||||||
try env.put("NVIM_LOG_FILE", b.fmt("{s}/Xtest_nvimlog", .{b.install_path}));
|
try env.put("NVIM_LOG_FILE", b.fmt("{s}/Xtest_nvimlog", .{b.install_path}));
|
||||||
|
|
||||||
env.remove("NVIM");
|
_ = env.swapRemove("NVIM");
|
||||||
env.remove("XDG_DATA_DIRS");
|
_ = env.swapRemove("XDG_DATA_DIRS");
|
||||||
return test_step;
|
return test_step;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user