diff --git a/.gitignore b/.gitignore index 83f18c1..3d5b688 100644 --- a/.gitignore +++ b/.gitignore @@ -38,3 +38,13 @@ /neovim-0.10.0-vendor.tar.gz /neovim-0.10.1.tar.gz /neovim-0.10.1-vendor.tar.gz +/neovim-0.10.1-vendor-treesitter.tar.gz +/neovim-0.10.2.tar.gz +/neovim-0.10.2-vendor.tar.gz +/neovim-0.10.2-vendor-treesitter.tar.gz +/neovim-0.10.3.tar.gz +/neovim-0.10.3-vendor.tar.gz +/neovim-0.10.3-vendor-treesitter.tar.gz +/neovim-0.10.4.tar.gz +/neovim-0.10.4-vendor.tar.gz +/neovim-0.10.4-vendor-treesitter.tar.gz diff --git a/README.md b/README.md index e3533c1..3e9397f 100644 --- a/README.md +++ b/README.md @@ -8,3 +8,4 @@ The hyper-extensible Vim-based text editor * Download the new tarball * Add the tarball with `fedpkg new-sources neovim-.tar.gz` * Run `bash mkvendor.sh` +* Run `bash mkvendor-treesitter.sh` diff --git a/mkvendor-treesitter.sh b/mkvendor-treesitter.sh new file mode 100644 index 0000000..5ef2d5c --- /dev/null +++ b/mkvendor-treesitter.sh @@ -0,0 +1,27 @@ + #!/usr/bin/bash -x + +set -euo pipefail + +url=$(rpmspec -P neovim.spec | sed -En 's/^Source0:[[:space:]]+//p') +archive=$(basename "$url") +tmp=$(mktemp -d) +trap "rm -rf $tmp" EXIT + +curl -Lo "${tmp}/${archive}" "${url}" +grep -F "${archive}" sources | (cd "${tmp}" && cksum -c) +mkdir -p "${tmp}/src" +tar -zxf "${tmp}/${archive}" -C "${tmp}/src" --strip-components=1 + +cmake -S "${tmp}/src/cmake.deps" -B "${tmp}/deps" -G Ninja \ + -DUSE_BUNDLED=OFF -DUSE_BUNDLED_TS=ON +targets=$(basename -a "${tmp}/deps"/build/downloads/treesitter | \ + xargs -I {} echo build/src/{}-stamp/{}-download) +ninja -C "${tmp}/deps" ${targets} + +mv "${tmp}/${archive}" . +vendor="${archive%.tar.gz}-vendor" +tar -zcf "${vendor}-treesitter.tar.gz" -H pax --numeric-owner --owner=0:0 \ + -C "${tmp}/deps/build/downloads" . --transform="s/^\\./${vendor}-treesitter/" + +echo +echo "Run: fedpkg new-sources ${archive} ${vendor}.tar.gz ${vendor}-treesitter.tar.gz" diff --git a/neovim-bundled-licenses.txt b/neovim-bundled-licenses.txt index fee3e11..e72f40d 100644 --- a/neovim-bundled-licenses.txt +++ b/neovim-bundled-licenses.txt @@ -1,2 +1,2 @@ -"ASL 2.0" +"Apache-2.0" "MIT" diff --git a/neovim.spec b/neovim.spec index 200eff3..b0be00c 100644 --- a/neovim.spec +++ b/neovim.spec @@ -21,8 +21,18 @@ %endif %endif +%if 0%{?el10} +# tree-sitter in EL10 is too old and libtree-sitter-devel is not shipped +# https://issues.redhat.com/browse/RHEL-56996 +%bcond system_treesitter 0 +%else +%bcond system_treesitter 1 +%endif + %global luv_min_ver 1.43.0 +%if %{with system_treesitter} %global tree_sitter_min_ver 0.22.5 +%endif %global vterm_min_ver 0.3.3 %global luv_include_dir %{_includedir}/luv @@ -35,10 +45,10 @@ %endif Name: neovim -Version: 0.10.1 +Version: 0.10.4 Release: %autorelease -License: Apache-2.0 AND Vim +License: Apache-2.0 AND Vim AND MIT Summary: Vim-fork focused on extensibility and agility Url: https://neovim.io @@ -48,6 +58,7 @@ Source2: spec-template # Generated by mkvendor.sh Source3: %{name}-%{version}-vendor.tar.gz Source4: neovim-bundled-licenses.txt +Source5: %{name}-%{version}-vendor-treesitter.tar.gz Patch1000: neovim-lua-bit32.patch @@ -85,10 +96,12 @@ BuildRequires: pkgconfig(vterm) >= %{vterm_min_ver} # need the build with the fix for the resize buffer issue Requires: libvterm >= %{vterm_min_ver} BuildRequires: pkgconfig(unibilium) +%if %{with system_treesitter} BuildRequires: pkgconfig(tree-sitter) >= %{tree_sitter_min_ver} # tree-sitter didn't do an soname bump. enforce the min version # see https://github.com/nvim-treesitter/nvim-treesitter/pull/3055/files Requires: libtree-sitter >= %{tree_sitter_min_ver} +%endif # Parser generator, only needed for :TSInstallFromGrammar Recommends: tree-sitter-cli Suggests: (python2-neovim if python2) @@ -109,10 +122,19 @@ excisions, Neovim is Vim. It is built for users who want the good parts of Vim, without compromise, and more. %prep +%if %{with system_treesitter} %setup -q -b3 +%else +%setup -q -b3 -b5 + +mv ../%{name}-%{version}-vendor-treesitter/* \ + ../%{name}-%{version}-vendor/ +%endif cp %{SOURCE4} . +%patch -P 0 -p1 +%patch -P 1 -p1 %if %{without luajit} %patch -P 1000 -p1 %endif @@ -129,6 +151,9 @@ ln -sfr ../%{name}-%{version}-vendor .deps/build/downloads %define __cmake_builddir .deps %cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DUSE_BUNDLED=OFF \ +%if %{without system_treesitter} + -DUSE_BUNDLED_TS=ON \ +%endif -DUSE_BUNDLED_TS_PARSERS=ON %cmake_build diff --git a/sources b/sources index 6347979..647c98f 100644 --- a/sources +++ b/sources @@ -1,2 +1,3 @@ -SHA512 (neovim-0.10.1.tar.gz) = 37e9d45041b059a26fe02717eae7cdbde58f0a35560c590764f5888de67cfa04bee76d6b359ab14b020ac5a661d64908960283347381d334106308504c0df908 -SHA512 (neovim-0.10.1-vendor.tar.gz) = d89dcc059a78a8b3d4695d463daf709a5b3ec46ff02590b78dfad4380ccc86429f365714b0d68757c3f518969c61394312a63065cce630ecfff0e69a4d5a1892 +SHA512 (neovim-0.10.4.tar.gz) = 8dadc24edaaa27e6ecd4db6c19d0183868a8d2809ba122110685f340341d951772ac2eb0c5f7a7ab5f87d3d5d8ae5e81f156c61f04f6d4ebbaa17cd35fb70b64 +SHA512 (neovim-0.10.4-vendor.tar.gz) = 6ea5a3dac50af53aebbf3ebaadf6766f2b2bedcc6b43bca553015847be5311b5fb3803fad7d1bc856b67b77c0d73d8f9a578bc55448d5d845147d4e7b64558a1 +SHA512 (neovim-0.10.4-vendor-treesitter.tar.gz) = b3038b2fde2b1d7183667da0b37ee61e24abb9b17b744ac3c63ce49a299c4026ee2e836237a05044cd2b1bda6a3c1fa572c0199eb632fb0362d6e5e141ca882a diff --git a/sysinit.vim b/sysinit.vim index bd151fc..21a501d 100644 --- a/sysinit.vim +++ b/sysinit.vim @@ -1,9 +1,6 @@ let g:python_host_prog = '/usr/bin/python2' let g:python3_host_prog = '/usr/bin/python3' -" In order for neovim to use installed plugins shared with vim -set runtimepath+=/usr/share/vim/vimfiles/ - augroup Fedora autocmd! " RPM spec file template