build: make build.zig generate helptags without running "nvim" binary

This is matters for cross-compiling where we might not
be able to run the "nvim" binary on the host.

Instead reimplement the helptags extractor as a small
lua script, which we can run on the host using the nlua0
helper already used for other generator scripts.
This commit is contained in:
bfredl
2025-05-25 14:14:28 +02:00
parent 25bc41847e
commit 6b936002cc
6 changed files with 104 additions and 12 deletions

View File

@@ -20,6 +20,7 @@ const Lua = ziglua.Lua;
extern "c" fn luaopen_mpack(ptr: *anyopaque) c_int;
extern "c" fn luaopen_lpeg(ptr: *anyopaque) c_int;
extern "c" fn luaopen_bit(ptr: *anyopaque) c_int;
extern "c" fn luaopen_luv(ptr: *anyopaque) c_int;
fn init() !*Lua {
// Initialize the Lua vm
@@ -56,6 +57,10 @@ fn init() !*Lua {
if (retval2 != 1) return error.LoadError;
lua.setField(-3, "lpeg");
const retval3 = luaopen_luv(lua);
if (retval3 != 1) return error.LoadError;
lua.setField(-3, "uv");
lua.pop(2);
if (!options.use_luajit) {