31 Commits

Author SHA1 Message Date
bfredl d50cca5b87 fix(build.zig): reunify parser install path
Both for tests and for system wide install, $PREFIX/lib/nvim/parser
is a valid path for tree-sitter parsers. This also brings the build.zig
behavior in line with how we set up the paths in CMakeLists.txt
2026-04-23 15:37:37 +02:00
bfredl 52693e7af3 fix(build): more changes to make zig 0.16.0 work 2026-04-21 12:46:01 +02:00
Chinmay Dalal 427d62c434 feat(build.zig): update to zig 0.16 2026-04-21 11:18:43 +02:00
Lewis Russell 55f9c2136e test: replace busted with local harness
Replace the busted-based Lua test runner with a repo-local harness.

The new harness runs spec files directly under `nvim -ll`, ships its own
reporter and lightweight `luassert` shim, and keeps the helper/preload
flow used by the functional and unit test suites.

Keep the file boundary model shallow and busted-like by restoring `_G`,
`package.loaded`, `package.preload`, `arg`, and the process environment
between files, without carrying extra reset APIs or custom assertion
machinery.

Update the build and test entrypoints to use the new runner, add
black-box coverage for the harness itself, and drop the bundled
busted/luacheck dependency path.

AI-assisted: Codex
2026-04-15 12:09:25 +01:00
Justin M. Keyes b3e7fe6647 Merge pull request #38688 from eamonburns/master
fix(build.zig): remove runtime dependency on Windows SDK
2026-04-14 12:20:49 -04:00
Eamon Burns b34cd44ae6 fix(build.zig): call build_libluv with standard optimize mode 2026-04-13 16:03:30 -07:00
Chinmay Dalal c8a7604307 build(zig): update version 2026-04-03 13:42:03 -04:00
Eamon Burns 00acd1db22 fix(build.zig): remove runtime dependency on Windows SDK
Co-Authored-By: ntdiary <2471314@gmail.com>
2026-04-01 11:21:31 -07:00
bfredl 8069df2661 fix(build): build.zig: use luajit for windows
These were disabled as they failed when tested with cross-compiling,
but it works fine for windows natively on ci, so let's use that.

mac os builds after disabling debug info, which currently
triggers a bug in zig's MachO linker: natecraddock/ziglua#191
Tracking issue: https://codeberg.org/ziglang/zig/issues/30669
Unfortunately actually using the JIT of luajit still triggers
issues on mac os, so we cannot use it yet.

Also sync luajit version used via ziglua to a recent one
like we use in cmake, see natecraddock/ziglua#196
2026-02-23 10:33:06 +01:00
Justin M. Keyes a512af0d74 build: zig tee, drop old XXD_URL #37863
Problem:
- tee was vendored in ceb7eb5230 but
  forgot to add it to `build.zig`.
- xxd was vendored in 5bb8734fb6 but
  the old XXD_URL is still referenced.

Solution:
- update `build.zig`
- remove XXD_URL
2026-02-14 08:55:20 -05:00
bfredl b4db223d33 fix(build): treesitter parsers are not ReleaseSafe 2026-01-15 11:43:46 +01:00
Chinmay Dalal 5ec0c1ca07 feat(build.zig): install parsers in install step
Problem: The install step does not install parsers
Solution: Make the install step depend on installing parsers
2026-01-14 13:16:38 -05:00
Chinmay Dalal 41bc3020c4 fix(build.zig): format build.zig to keep lines under 100 chars 2026-01-13 22:09:03 -05:00
Chinmay Dalal 6d9031390c feat(build.zig): add option to use system dependencies
Problem:
build.zig always downloads dependencies and statically links them,
which is frowned upon by distro packagers.

Solution:
Add option to use system libraries.
2026-01-13 22:09:03 -05:00
Eamon Burns 565cfa04eb fix(build.zig): replace slashes in filepaths #37111
Problem:
`zig build` fails if `b.install_path` and `b.lib_dir` contain backslashes (on Windows).

Solution:
Replace backslashes (\) with forward slashes (/).
2026-01-08 00:31:24 -05:00
bfredl 8e0692cdc5 feat(build): support full runtime distribution work
Working towards making the build.zig build actually useful for
users..

For building a full runtime distribution in /usr or /opt/nvim or
whatever, use

sudo zig build install -p /usr

by default "zig build" will now work like "make" e.g. just build the binary
and the generated parts of the runtime. This will work for development,
but you need to use both parts of the runtime, just like with
an "uninstalled" cmake build:

   zig build
   VIM=. ./zig-out/bin/nvim --clean --cmd "set rtp+=./zig-out/runtime"

As a wrapper, `zig build run_dev` can be used
2025-12-09 12:57:14 +01:00
bfredl 6741c134e1 fix(build): zig build can has git version 2025-12-03 11:48:14 +01:00
benarcher2691 5bb8734fb6 build(windows): vendor xxd.c #36746
Problem:
Currently we fetch a prebuilt xxd.exe from neovim/deps for Windows,
which is not ideal in terms of obviousness, misses updates, and is
clumsy to update.

Solution:
Similar to tee.c (#36363), vendor xxd.c from Vim and build it as part
of the Neovim build process. This makes the source obvious, enables
analyzer checks, and simplifies updates.

Fixes #36664
2025-11-29 23:15:47 -05:00
bfredl e1ffa8d33b feat(build): HAVE_UNIBILIUM
compile time features are hot again.

Note: this changes the &term value for builtin definition from
'builtin_xterm' to just 'xterm'. It's an xterm regardless of we use an
external definition or an internal. Prior to this commit the vast
majority of POSIX users will have used external terminfo, so plugins and
scripts are only going to have checked for &term == 'xterm' or 'tmux' or
whatever.
The status of external loading is still available in "nvim -V3" output.
2025-10-31 08:39:32 +01:00
bfredl 0458a1e694 build(ci): bump zig to 0.15.1 and add more platforms
- Bump zig version to 0.15.1 and workaround zig fetch hang (ziglang/zig#24916)
- add mac os zig build (currently without luajit, linker failure)
- Add windows zig build, currently with very limited testing
2025-09-15 12:10:23 +02:00
bfredl 6b936002cc 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.
2025-08-19 11:14:02 +02:00
bfredl 442f297c63 refactor(build): remove INCLUDE_GENERATED_DECLARATIONS guards
These are not needed after #35129 but making uncrustify still play nice
with them was a bit tricky.

Unfortunately `uncrustify --update-config-with-doc` breaks strings
with backslashes. This issue has been reported upstream,
and in the meanwhile auto-update on every single run has been disabled.
2025-08-14 09:34:38 +02:00
bfredl dc6cf3add9 feat(build): build.zig windows support
Tested using cross-compiling from linux:

    zig build -Dcross=true -Dtarget=x86_64-windows nvim_bin

Note: not fully functional without a runtime, which still has to be
fuddled with manually

Macos and windows builds require a recent zig 0.15+dev version
As this zig master branch is currently too much in flux, we can't make
our CI depend on zig master.

Revisit CI after zig 0.15 release or at least feature freeze.
2025-08-12 13:33:24 +02:00
bfredl a2b0be19bf fix(build): remove deprecated aliases in build.zig removed for zig 0.15
This makes the zig build compatible with the upcoming zig 0.15 release,
while still supporting the current stable 0.14 release still used in CI.
2025-08-09 12:02:07 +02:00
bfredl 79c8159f41 refactor(build): don't use the preprocessor when generating headers
Using the preprocessor before generating prototypes provides some
"niceties" but the places that rely on these are pretty few.
Vastly simplifying the BUILD SYSTEM is a better trade-off.

Unbalancing { } blocks due to the preprocessor is cringe anyway (think
of the tree-sitter trees!), write these in a different way.

Add some workarounds for plattform specific features.

INCLUDE_GENERATED_DECLARATIONS flag is now technically redundant,
but will be cleaned up in a follow-up PR as it is a big mess.
2025-08-06 15:10:25 +02:00
bfredl e25b99c5b6 feat(build): make build.zig run unittests 2025-05-24 21:05:24 +02:00
bfredl c4501e98f2 feat(build): make build.zig use luajit on main plattforms 2025-05-24 21:05:24 +02:00
bfredl 2d4b028d02 fix(tests): use correct include path for unittest
Copy whatever was made to work for generated headers:

(1) we need to consider all cmake targets not just main_lib
(2) we need to add the sysroot for macOS
2025-05-22 11:56:46 +02:00
Vlad Panazan 3268f51d20 fix(build): musl libc build.zig 2025-05-04 22:55:19 +02:00
bfredl 921f8b0df7 fix(build): use correct cmake expression for $<CONFIG>
${CONFIG} is an empty string even when configuration is known at
configuration time. $<CONFIG> has to be used at "generation time"

Currently zig's reimplementation of cmake config headers does not
support $<CONFIG> so use a branch to pick the one which works.
2025-05-04 09:49:10 +02:00
bfredl 1f004970f0 feat(build): build.zig MVP: build and run functionaltests on linux
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
2025-05-02 09:28:50 +02:00