Hi,

Here's the neovim treesitter fixes backported to 7.6-stable.

(context: https://marc.info/?l=openbsd-ports&m=172873624728050&w=2)

Although 7.6 is one minor neovim version behind -current, I've checked that the
parser versions are the same.

Tested on amd64 in a vm. All seems well.

Everyone OK with this?


Index: Makefile
===================================================================
RCS file: /cvs/ports/editors/neovim/Makefile,v
diff -u -p -r1.47 Makefile
--- Makefile    19 Aug 2024 08:50:27 -0000      1.47
+++ Makefile    11 Nov 2024 22:47:08 -0000
@@ -12,6 +12,7 @@ EMBED_LUAJIT =        No
 COMMENT =      continuation and extension of Vim
 
 DIST_TUPLE =   github neovim neovim v0.10.1 .
+REVISION =     0
 
 # embedded luajit
 USE_NOBTCFI =  Yes
@@ -27,6 +28,18 @@ DIST_TUPLE +=        github LuaJIT LuaJIT 75e92
                ${STATIC_DEPS_WRKSRC}/luajit
 DIST_TUPLE +=  github keplerproject lua-compat-5.3 v0.13 \
                ${STATIC_DEPS_WRKSRC}/lua-compat-5.3
+DIST_TUPLE +=  github tree-sitter tree-sitter-c v0.21.3 \
+               ${STATIC_DEPS_WRKSRC}/parsers/treesitter_c
+DIST_TUPLE +=  github tree-sitter-grammars tree-sitter-lua v0.1.0 \
+               ${STATIC_DEPS_WRKSRC}/parsers/treesitter_lua
+DIST_TUPLE +=  github neovim tree-sitter-vim v0.4.0 \
+               ${STATIC_DEPS_WRKSRC}/parsers/treesitter_vim
+DIST_TUPLE +=  github neovim tree-sitter-vimdoc v3.0.0 \
+               ${STATIC_DEPS_WRKSRC}/parsers/treesitter_vimdoc
+DIST_TUPLE +=  github tree-sitter-grammars tree-sitter-query v0.4.0 \
+               ${STATIC_DEPS_WRKSRC}/parsers/treesitter_query
+DIST_TUPLE +=  github MDeiml tree-sitter-markdown v0.2.3 \
+               ${STATIC_DEPS_WRKSRC}/parsers/treesitter_markdown
 
 # Neovim: Apache 2.0 + Vim License
 # LuaJIT: MIT + public domain
@@ -113,6 +126,7 @@ TEST_DEPENDS =      shells/bash \
 # makes sense to embed it.
 STATIC_DEPS_WRKBUILD=${WRKBUILD}/static-deps-build
 STATIC_DEPS_INST=${WRKBUILD}/static-deps-inst
+PARSERS_WRKBUILD=${STATIC_DEPS_WRKBUILD}/parsers
 .include <bsd.port.arch.mk>
 .if ${PROPERTIES:Mclang}
 LUAJIT_TARGET_LIBS =   "-lc++abi -lpthread"
@@ -164,6 +178,24 @@ pre-configure:
        cd ${STATIC_DEPS_WRKBUILD}/luv && \
                ${SETENV} ${MAKE_ENV} VERBOSE=1 \
                ${MAKE_PROGRAM} install
+
+       # Build the treesitter parsers.
+       #
+       # For this we borrow a trick from FreeBSD and re-use just the part of
+       # upstream's build system that builds the parsers.
+       mkdir -p ${PARSERS_WRKBUILD}/build/src
+       for i in ${STATIC_DEPS_WRKSRC}/parsers/*; do \
+               cp -r $${i} ${PARSERS_WRKBUILD}/build/src/$$(basename $$i); \
+               done
+       ${MAKE_ENV} ${LOCALBASE}/bin/cmake -S ${WRKSRC}/cmake.deps \
+               -B ${PARSERS_WRKBUILD} ${CONFIGURE_ARGS} \
+               -DUSE_BUNDLED_TS_PARSERS=ON \
+               -DUSE_EXISTING_SRC_DIR:BOOL=ON
+       # The following line both builds *and* installs the parsers.
+       ${MAKE_ENV} ${LOCALBASE}/bin/cmake --build ${PARSERS_WRKBUILD}
+       mkdir -p ${WRKBUILD}/lib/nvim/parser
+       cp -r ${PARSERS_WRKBUILD}/usr/lib/nvim/parser/*.so \
+               ${WRKBUILD}/lib/nvim/parser/
 
 # These are the "old tests". There is also a new suite, but we would need the
 # "busted" test suite for Lua, which is not yet ported.
Index: distinfo
===================================================================
RCS file: /cvs/ports/editors/neovim/distinfo,v
diff -u -p -r1.26 distinfo
--- distinfo    19 Aug 2024 08:50:27 -0000      1.26
+++ distinfo    11 Nov 2024 22:47:08 -0000
@@ -1,8 +1,20 @@
 SHA256 (LuaJIT-LuaJIT-75e92777988017fe47c5eb290998021bbf972d1f.tar.gz) = 
D2kogZACTXMsZ2ReQO1bE31nqpUP7fD0SprQ89um1dI=
+SHA256 (MDeiml-tree-sitter-markdown-v0.2.3.tar.gz) = 
SQnWAjZD8a/DqyGVhdQDW3QD86F4SXgquAPF9zyKMdU=
 SHA256 (keplerproject-lua-compat-5.3-v0.13.tar.gz) = 
9dww57H9qFbuTTkr5FdkLB8MJZJkqbm/vLaAMCzoj8I=
 SHA256 (luvit-luv-1.48.0-2.tar.gz) = 
5kzYoBl0SSiLN99soFgSDo0jCPwwX1QxYrW/PpInOgU=
 SHA256 (neovim-neovim-v0.10.1.tar.gz) = 
7c6W55kDrfyzxB6agjhRGUYyXqlWj94XenCmFFAa9ok=
+SHA256 (neovim-tree-sitter-vim-v0.4.0.tar.gz) = 
n4Vvi0oQq0M0hVD6LTyyhGrj2OYPRYhyAFScBRxm+dU=
+SHA256 (neovim-tree-sitter-vimdoc-v3.0.0.tar.gz) = 
pjm/kr9Xv6HNyQyhavJ7+vJql3kGR3bdS+NMHvFFP2w=
+SHA256 (tree-sitter-grammars-tree-sitter-lua-v0.1.0.tar.gz) = 
Iwz8v6dO0fe4FJ6aHzTC78TFiacf4PXchWBiL4Ag1yI=
+SHA256 (tree-sitter-grammars-tree-sitter-query-v0.4.0.tar.gz) = 
06Qjq2bcYrKWliXigBFmeKiiJYK1/wh3lSIhCNsvam4=
+SHA256 (tree-sitter-tree-sitter-c-v0.21.3.tar.gz) = 
daN4DfYRTNN0lnYcSnyf2QDHi+46Jwf1kNeMDKOiQ2g=
 SIZE (LuaJIT-LuaJIT-75e92777988017fe47c5eb290998021bbf972d1f.tar.gz) = 1081633
+SIZE (MDeiml-tree-sitter-markdown-v0.2.3.tar.gz) = 418293
 SIZE (keplerproject-lua-compat-5.3-v0.13.tar.gz) = 60960
 SIZE (luvit-luv-1.48.0-2.tar.gz) = 134821
 SIZE (neovim-neovim-v0.10.1.tar.gz) = 12796966
+SIZE (neovim-tree-sitter-vim-v0.4.0.tar.gz) = 356704
+SIZE (neovim-tree-sitter-vimdoc-v3.0.0.tar.gz) = 58110
+SIZE (tree-sitter-grammars-tree-sitter-lua-v0.1.0.tar.gz) = 56812
+SIZE (tree-sitter-grammars-tree-sitter-query-v0.4.0.tar.gz) = 42944
+SIZE (tree-sitter-tree-sitter-c-v0.21.3.tar.gz) = 366957
Index: pkg/PLIST
===================================================================
RCS file: /cvs/ports/editors/neovim/pkg/PLIST,v
diff -u -p -r1.22 PLIST
--- pkg/PLIST   19 Aug 2024 08:50:27 -0000      1.22
+++ pkg/PLIST   11 Nov 2024 22:47:08 -0000
@@ -1,5 +1,13 @@
 @bin bin/nvim
 lib/nvim/
+lib/nvim/parser/
+@so lib/nvim/parser/c.so
+@so lib/nvim/parser/lua.so
+@so lib/nvim/parser/markdown.so
+@so lib/nvim/parser/markdown_inline.so
+@so lib/nvim/parser/query.so
+@so lib/nvim/parser/vim.so
+@so lib/nvim/parser/vimdoc.so
 @man man/man1/nvim.1
 share/applications/nvim.desktop
 share/doc/pkg-readmes/${PKGSTEM}

-- 
Best Regards
Edd Barrett

https://www.theunixzoo.co.uk

Reply via email to