mirror of
				https://github.com/neovim/neovim.git
				synced 2025-11-04 01:34:25 +00:00 
			
		
		
		
	NEW BUILD SYSTEM!
This is a MVP implementation which supports building the "nvim" binary,
including cross-compilation for some targets.
As an example, you can build a aarch64-macos binary from
an x86-64-linux-gnu host, or vice versa
Add CI target for build.zig currently for functionaltests on linux
x86_64 only
Follow up items:
-  praxis for version and dependency bumping
-  windows 💀
-  full integration of libintl and gettext (or a desicion not to)
-  update help and API metadata files
-  installation into a $PREFIX
-  more tests and linters
		
	
		
			
				
	
	
		
			40 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			Zig
		
	
	
	
	
	
			
		
		
	
	
			40 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			Zig
		
	
	
	
	
	
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;
 | 
						|
}
 |