diff mbox series

[meta-oe,4/4] neovim: add recipe for 0.12.6

Message ID 20261119104903.176376-5-f_l_k@t-online.de
State Under Review
Headers show
Series tree-sitter grammars and neovim | expand

Commit Message

Markus Volk Nov. 19, 2026, 10:47 a.m. UTC
Neovim is a Vim-based text editor with Lua scripting and built-in
tree-sitter support. It uses the system LuaJIT, libuv, luv, lpeg,
utf8proc and libtree-sitter; the native build provides the nvim and
nlua0 the target build runs to generate sources. It recommends the
grammars upstream bundles (c, lua, markdown, query, vim, vimdoc), and
provides vi and vim through update-alternatives with priority 95, below
vim and above vim-tiny.

0001-cmake-allow-omitting-build-paths-from-the-binary.patch keeps the
compiler flags and the build directory out of the binary for
reproducibility; Upstream-Status: Inappropriate [OE specific].

Tested on intel-corei7-64: nvim runs, :help is highlighted with
tree-sitter, and all grammars and queries load.

AI-Generated: Uses Claude Code (Claude Opus 5.5)
Signed-off-by: Markus Volk <f_l_k@t-online.de>
---
 ...omitting-build-paths-from-the-binary.patch | 43 ++++++++++++
 .../recipes-support/neovim/neovim_0.12.6.bb   | 66 +++++++++++++++++++
 2 files changed, 109 insertions(+)
 create mode 100644 meta-oe/recipes-support/neovim/neovim/0001-cmake-allow-omitting-build-paths-from-the-binary.patch
 create mode 100644 meta-oe/recipes-support/neovim/neovim_0.12.6.bb
diff mbox series

Patch

diff --git a/meta-oe/recipes-support/neovim/neovim/0001-cmake-allow-omitting-build-paths-from-the-binary.patch b/meta-oe/recipes-support/neovim/neovim/0001-cmake-allow-omitting-build-paths-from-the-binary.patch
new file mode 100644
index 0000000000..ec15ef1b78
--- /dev/null
+++ b/meta-oe/recipes-support/neovim/neovim/0001-cmake-allow-omitting-build-paths-from-the-binary.patch
@@ -0,0 +1,43 @@ 
+From: Markus Volk <f_l_k@t-online.de>
+Date: Sat, 19 Sep 2026 18:10:00 +0200
+Subject: [PATCH] cmake: allow omitting build paths from the binary
+
+The ":version" output embeds the full compiler path, the sysroot and all
+include directories, and VTERM_TEST_FILE embeds the build directory. Both
+end up in the installed nvim binary and make it non-reproducible.
+
+Add NVIM_OMIT_VERSION_CFLAGS to drop the compile flags from the version
+string and let VTERM_TEST_FILE be overridden from the command line.
+
+Upstream-Status: Inappropriate [OE specific]
+Signed-off-by: Markus Volk <f_l_k@t-online.de>
+---
+ CMakeLists.txt              | 4 +++-
+ cmake.config/CMakeLists.txt | 3 +++
+ 2 files changed, 6 insertions(+), 1 deletion(-)
+
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -51,7 +51,9 @@
+ #-------------------------------------------------------------------------------
+ set(FUNCS_DATA ${PROJECT_BINARY_DIR}/funcs_data.mpack)
+ set(TOUCHES_DIR ${PROJECT_BINARY_DIR}/touches)
+-set(VTERM_TEST_FILE ${PROJECT_BINARY_DIR}/test/vterm_test_output)
++if(NOT VTERM_TEST_FILE)
++  set(VTERM_TEST_FILE ${PROJECT_BINARY_DIR}/test/vterm_test_output)
++endif()
+ 
+ file(GLOB DOCFILES CONFIGURE_DEPENDS ${PROJECT_SOURCE_DIR}/runtime/doc/*.txt)
+ 
+--- a/cmake.config/CMakeLists.txt
++++ b/cmake.config/CMakeLists.txt
+@@ -184,6 +184,9 @@
+ append_target_expression(PREFIX "-I" PROPERTY INCLUDE_DIRECTORIES)
+ string(REPLACE ";" " " VERSION_STRING "${VERSION_STRING}")
+ string(REPLACE "  " " " VERSION_STRING "${VERSION_STRING}")
++if(NVIM_OMIT_VERSION_CFLAGS)
++  set(VERSION_STRING "")
++endif()
+ 
+ configure_file(versiondef.h.in auto/versiondef.h.gen)
+ 
diff --git a/meta-oe/recipes-support/neovim/neovim_0.12.6.bb b/meta-oe/recipes-support/neovim/neovim_0.12.6.bb
new file mode 100644
index 0000000000..e8f7e22e08
--- /dev/null
+++ b/meta-oe/recipes-support/neovim/neovim_0.12.6.bb
@@ -0,0 +1,66 @@ 
+SUMMARY = "Vim-fork focused on extensibility and usability"
+HOMEPAGE = "https://neovim.io"
+LICENSE = "Apache-2.0 AND Vim"
+LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=05b485c2880cb0b3d7dc27f07456ace1"
+
+DEPENDS = " \
+    luajit \
+    luajit-native \
+    utf8proc \
+    libuv \
+    luv \
+    lpeg \
+    libtreesitter \
+"
+DEPENDS:append:class-target = " neovim-native"
+
+SRC_URI = " \
+    git://github.com/neovim/neovim.git;protocol=https;branch=release-0.12;tag=v${PV} \
+    file://0001-cmake-allow-omitting-build-paths-from-the-binary.patch \
+"
+SRCREV = "779c36969e31080503be2dfccbcc3f999e289606"
+
+inherit cmake pkgconfig gettext mime-xdg update-alternatives
+
+EXTRA_OECMAKE = " \
+    -DENABLE_UNIBILIUM=OFF \
+    -DCMAKE_BUILD_TYPE=RelWithDebInfo \
+    -DNVIM_OMIT_VERSION_CFLAGS=ON \
+    -DVTERM_TEST_FILE=/tmp/nvim_vterm_test_output \
+"
+EXTRA_OECMAKE:append:class-native = " -DICONV_INCLUDE_DIR=${STAGING_INCDIR_NATIVE}"
+EXTRA_OECMAKE:append:class-target = " \
+    -DNVIM_HOST_PRG=${STAGING_BINDIR_NATIVE}/nvim \
+    -DNLUA0_HOST_PRG=${STAGING_LIBDIR_NATIVE}/nvim/libnlua0.so \
+"
+
+# The target build runs the native nvim and its nlua0 module to generate
+# sources and runtime files; upstream does not install nlua0.
+do_install:append:class-native() {
+    install -d ${D}${libdir}/nvim
+    install -m 0755 ${B}/lib/libnlua0.so ${D}${libdir}/nvim/libnlua0.so
+}
+
+FILES:${PN} += " \
+    ${libdir}/nvim \
+    ${datadir}/nvim \
+    ${datadir}/applications \
+    ${datadir}/icons \
+"
+
+ALTERNATIVE:${PN} = "vi vim"
+ALTERNATIVE_TARGET = "${bindir}/nvim"
+ALTERNATIVE_LINK_NAME[vi] = "${base_bindir}/vi"
+ALTERNATIVE_LINK_NAME[vim] = "${bindir}/vim"
+ALTERNATIVE_PRIORITY = "95"
+
+RRECOMMENDS:${PN}:class-target += " \
+    tree-sitter-c \
+    tree-sitter-lua \
+    tree-sitter-markdown \
+    tree-sitter-query \
+    tree-sitter-vim \
+    tree-sitter-vimdoc \
+"
+
+BBCLASSEXTEND = "native"