aboutsummaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
authorbfredl <bjorn.linse@gmail.com>2025-05-02 10:34:25 +0200
committerGitHub <noreply@github.com>2025-05-02 10:34:25 +0200
commitda401ca25b4dbef121da627fdcdc1dbaf8b7e092 (patch)
tree53a37c82e5e7298a30c4809c452926aa0a31fa5b /runtime
parentce8b755a86c10496a81675c49b3bc9a42c79d80f (diff)
parent1f004970f00bd8ef7ad955b52857df136f82185b (diff)
downloadrneovim-da401ca25b4dbef121da627fdcdc1dbaf8b7e092.tar.gz
rneovim-da401ca25b4dbef121da627fdcdc1dbaf8b7e092.tar.bz2
rneovim-da401ca25b4dbef121da627fdcdc1dbaf8b7e092.zip
Merge pull request #28344 from bfredl/wonderland
feat(build): build.zig MVP: build and run functionaltests on linux
Diffstat (limited to 'runtime')
-rw-r--r--runtime/CMakeLists.txt5
-rw-r--r--runtime/doc/news.txt6
-rw-r--r--runtime/embedded_data.zig3
-rw-r--r--runtime/gen_runtime.zig39
4 files changed, 53 insertions, 0 deletions
diff --git a/runtime/CMakeLists.txt b/runtime/CMakeLists.txt
index d103b5f4d7..fdd846561e 100644
--- a/runtime/CMakeLists.txt
+++ b/runtime/CMakeLists.txt
@@ -12,12 +12,17 @@ get_directory_property(LUA_GEN_DEPS DIRECTORY ${PROJECT_SOURCE_DIR}/src/nvim DEF
add_custom_command(OUTPUT ${GENERATED_SYN_VIM}
COMMAND ${LUA_GEN} ${SYN_VIM_GENERATOR} ${GENERATED_SYN_VIM} ${FUNCS_DATA}
+ ${PROJECT_SOURCE_DIR}/src/nvim/options.lua
+ ${PROJECT_SOURCE_DIR}/src/nvim/auevents.lua
+ ${PROJECT_SOURCE_DIR}/src/nvim/ex_cmds.lua
+ ${PROJECT_SOURCE_DIR}/src/nvim/vvars.lua
DEPENDS
${LUA_GEN_DEPS}
${SYN_VIM_GENERATOR}
${PROJECT_SOURCE_DIR}/src/nvim/ex_cmds.lua
${PROJECT_SOURCE_DIR}/src/nvim/auevents.lua
${PROJECT_SOURCE_DIR}/src/nvim/options.lua
+ ${PROJECT_SOURCE_DIR}/src/nvim/vvars.lua
${PROJECT_SOURCE_DIR}/src/nvim/eval.c
${FUNCS_DATA}
)
diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt
index bde4f8bf0c..dddb5f520c 100644
--- a/runtime/doc/news.txt
+++ b/runtime/doc/news.txt
@@ -110,6 +110,12 @@ API
it would return `nil`, which made it impossible to tell if the directory was
actually trusted.
+BUILD
+
+• A Zig-based build system has been added as an alternative to CMake. It is
+ currently limited in functionality, and CMake remains the recommended option
+ for the time being.
+
DEFAULTS
• 'statusline' default is exposed as a statusline expression (previously it
diff --git a/runtime/embedded_data.zig b/runtime/embedded_data.zig
new file mode 100644
index 0000000000..5872a20faf
--- /dev/null
+++ b/runtime/embedded_data.zig
@@ -0,0 +1,3 @@
+pub const inspect_module = @embedFile("./lua/vim/inspect.lua");
+pub const shared_module = @embedFile("./lua/vim/shared.lua");
+pub const iter_module = @embedFile("./lua/vim/iter.lua");
diff --git a/runtime/gen_runtime.zig b/runtime/gen_runtime.zig
new file mode 100644
index 0000000000..1bf7bfde38
--- /dev/null
+++ b/runtime/gen_runtime.zig
@@ -0,0 +1,39 @@
+const std = @import("std");
+const LazyPath = std.Build.LazyPath;
+
+pub const SourceItem = struct { name: []u8, api_export: bool };
+
+pub fn nvim_gen_runtime(
+ b: *std.Build,
+ nlua0: *std.Build.Step.Compile,
+ nvim_bin: *std.Build.Step.Compile,
+ funcs_data: LazyPath,
+) !*std.Build.Step.WriteFile {
+ const gen_runtime = b.addWriteFiles();
+
+ {
+ const gen_step = b.addRunArtifact(nlua0);
+ gen_step.addFileArg(b.path("src/gen/gen_vimvim.lua"));
+ const file = gen_step.addOutputFileArg("generated.vim");
+ _ = gen_runtime.addCopyFile(file, "syntax/vim/generated.vim");
+ gen_step.addFileArg(funcs_data);
+ gen_step.addFileArg(b.path("src/nvim/options.lua"));
+ gen_step.addFileArg(b.path("src/nvim/auevents.lua"));
+ gen_step.addFileArg(b.path("src/nvim/ex_cmds.lua"));
+ gen_step.addFileArg(b.path("src/nvim/vvars.lua"));
+ }
+
+ {
+ const install_doc_files = b.addInstallDirectory(.{ .source_dir = b.path("runtime/doc"), .install_dir = .prefix, .install_subdir = "runtime/doc" });
+ const gen_step = b.addRunArtifact(nvim_bin);
+ gen_step.step.dependOn(&install_doc_files.step);
+ gen_step.addArgs(&.{ "-u", "NONE", "-i", "NONE", "-e", "--headless", "-c", "helptags ++t doc", "-c", "quit" });
+ // TODO(bfredl): ugly on purpose. nvim should be able to generate "tags" at a specificed destination
+ const install_path: std.Build.LazyPath = .{ .cwd_relative = b.install_path };
+ gen_step.setCwd(install_path.path(b, "runtime/"));
+
+ gen_runtime.step.dependOn(&gen_step.step);
+ }
+
+ return gen_runtime;
+}