Message ID | 98a6180737981490316bca8c03c787289dbddcb6.1643120885.git.luishenriquegh2701@gmail.com |
---|---|
State | Accepted |
Headers | show |
Series | [bug#53523] gnu: Add tree-sitter. | expand |
Context | Check | Description |
---|---|---|
cbaines/comparison | success | View comparision |
cbaines/git branch | success | View Git branch |
cbaines/applying patch | success | View Laminar job |
cbaines/issue | success | View issue |
Hello, Luis Henrique Gomes Higino <luishenriquegh2701@gmail.com> writes: > this series of patches adds the new required dependency for neovim, > tree-sitter, updates neovim to the newest upstream version and adds > the package variant neovim-luajit, which switches the lua > implementation used from Lua 5.1 to LuaJIT 2.1.0-beta3. > > * gnu/packages/text-editors.scm (tree-sitter): New variable. Thank you. Note there is already a pending patch set to add tree-sitter in Guix: <https://issues.guix.gnu.org/issue/49946/>. You may want to look at it and see if both works can be merged somehow. Regards,
I'll try implementing what Efraim Flashner suggested. Then, I'll see if I can merge my first patch, the one that adds tree-sitter, with the one mentioned by Nicolas Goaziou. If anyone can point me to a resource on how this could be done in regards to the technicalities, feel free to share it! Thanks for the feedback! Regards,
I was doing some tests today with the Guile REPL and it seems like luajit has been ported to more platforms recently. From my impression, it seems like now there's no need to fallback to Lua 5.1 on any system. Running `(eq? (package-supported-systems luajit) (package-supported-systems lua))` returns `#t`. Can anyone confirm this?
Any further working on this patch, or if any help is still needed? I'm very excited to have neovim 0.6.1 in guix! I did some research on source code of lua package. From https://github.com/guix-mirror/guix/blob/f9c62b23cc88541756656b3ec602ce987828d906/gnu/packages/lua.scm#L179 we can find that luajit deleted "powerpc64le-linux" from the supported system list, which lua package didn't. So I think we should keep that fallback.
I did some research on the source code of lua package. From https://github.com/guix-mirror/guix/blob/f9c62b23cc88541756656b3ec602ce987828d906/gnu/packages/lua.scm#L179 we can find that luajit deleted "powerpc64le-linux" from the supported system list, which lua package didn't. So I think we should keep that fallback. Hope this helps. ---- Zongyuan Li
li zongyuan <lyzongyuan@gmail.com> writes: > we can find that luajit deleted "powerpc64le-linux" from the > supported system list, which lua package didn't. So I think we > should keep that fallback. Thanks for bringing attention to this! I'll keep it then. Regards,
Hi Luis, I tried to apply `[PATCH v3 2/2] gnu: neovim: Update to 0.6.1.` to the current main branch of Guix, but failed. It seems like we import 'libiconv' which is not used as dependency in previous neovim, from these code: > @@ -717,11 +725,18 @@ (define-public neovim > ("unibilium" ,unibilium) > ("jemalloc" ,jemalloc) > ("libiconv" ,libiconv) > - ("lua" ,lua-5.1) > + ("lua" ,(if (member (or (if (%current-target-system) > + (gnu-triplet->nix-system (%current-target-system)) > + #f) > + (%current-system)) > + (package-supported-systems luajit)) > + luajit > + lua-5.1)) > ("lua-luv" ,lua5.1-luv) > ("lua-lpeg" ,lua5.1-lpeg) > ("lua-bitop" ,lua5.1-bitop) > - ("lua-libmpack" ,lua5.1-libmpack))) > + ("lua-libmpack" ,lua5.1-libmpack) > + ("tree-sitter" ,tree-sitter))) Did you write this patch on any commit which is not included in the Guix main branch? Maybe we should rebase this patch set on main branch. Li
Zongyuan Li <lyzongyuan@gmail.com> writes: > Did you write this patch on any commit which is not included in > the > Guix main branch? I wrote the patch on the latest master commit at the time and have no idea why didn't work for you. I just sent the new version of the patch series with the `--base=auto` option so that we can find out what's happening. Regards,
Zongyuan Li <lyzongyuan@gmail.com> writes: > It seems like we import 'libiconv' which is not used as > dependency in > previous neovim, from these code: I just noticed you're right, libiconv is not present at master since this commit: https://github.com/guix-mirror/guix/commit/1bd1f42a31a970489583682434cda706b0269c26. Thanks for noticing it, I'll remove it and send the patches again. Regards,
Luis Henrique Gomes Higino <luishenriquegh2701@gmail.com> writes: > @@ -670,13 +671,19 @@ (define-public neovim > (commit (string-append "v" version)))) > (file-name (git-file-name name version)) > (sha256 > - (base32 "11zyj6jvkwas3n6w1ckj3pk6jf81z1g7ngg4smmwm7c27y2a6f2m")))) > + (base32 "10p6lg5yv9n6wcwdprwvvi56dfcm4wsj54nm0invyx3mhf7374lx")))) > (build-system cmake-build-system) > (arguments > `(#:modules ((srfi srfi-26) > (guix build cmake-build-system) > (guix build utils)) > - #:configure-flags '("-DPREFER_LUA:BOOL=YES") > + #:configure-flags > + (list ,@(if (member (if (%current-target-system) > + (gnu-triplet->nix-system (%current-target-system)) > + (%current-system)) > + (package-supported-systems luajit)) > + '() > + '("-DPREFER_LUA:BOOL=YES"))) > #:phases > (modify-phases %standard-phases > (add-after 'unpack 'set-lua-paths We can just remove `-DPREFER_LUA:BOOL` flags. Since we have a fallback from luajit to lua, this macro won't take any effect. FYI, you can take a look about usage of this macro from here: https://github.com/neovim/neovim/blob/8ed9c84481a7d0df0708d11ffa538f832591240f/CMakeLists.txt#L431 BTW, I have tested this patch set on the x86_64 platform and it works perfectly. Maybe it's time to involve committers for reviewing this patch.
li zongyuan <lyzongyuan@gmail.com> writes: > We can just remove `-DPREFER_LUA:BOOL` flags. Since we have a > fallback > from luajit to lua, > this macro won't take any effect. I tried building it on powerpc64le-linux, through `--system`, without this flag and had this error: --8<---------------cut here---------------start------------->8--- CMake Error at /gnu/store/7vfcp65x5ys1a3jal9qys1davs2zk9rs-cmake-minimal-3.21.4/share/cmake-3.21/Modules/FindPackageHandleStandardArgs.cmake:230 (message): Could NOT find LuaJit (missing: LUAJIT_LIBRARY LUAJIT_INCLUDE_DIR) Call Stack (most recent call first): /gnu/store/7vfcp65x5ys1a3jal9qys1davs2zk9rs-cmake-minimal-3.21.4/share/cmake-3.21/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE) cmake/FindLuaJit.cmake:35 (find_package_handle_standard_args) CMakeLists.txt:422 (find_package) --8<---------------cut here---------------end--------------->8--- > BTW, I have tested this patch set on the x86_64 platform and it > works > perfectly. Maybe it's time to involve committers for reviewing > this > patch. I agree! I sense it is really close to done. Regards,
Hi Song, Would you mind take a look about this patch? This could be great for vim user if it can be applied. Thanks, Li
diff --git a/gnu/packages/text-editors.scm b/gnu/packages/text-editors.scm index 2c5f5de719..9273a8f10b 100644 --- a/gnu/packages/text-editors.scm +++ b/gnu/packages/text-editors.scm @@ -17,6 +17,7 @@ ;;; Copyright © 2021 Leo Famulari <leo@famulari.name> ;;; Copyright © 2021 Pierre Langlois <pierre.langlois@gmx.com> ;;; Copyright © 2021 Calum Irwin <calumirwin1@gmail.com> +;;; Copyright © 2022 Luis Henrique Gomes Higino <luishenriquegh2701@gmail.com> ;;; ;;; This file is part of GNU Guix. ;;; @@ -1165,3 +1166,47 @@ (define-public virtaal provided by the Translate Toolkit, including XLIFF and PO.") (home-page "https://virtaal.translatehouse.org/") (license license:gpl2+))) + +(define-public tree-sitter + (package + (name "tree-sitter") + (version "0.20.4") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/tree-sitter/tree-sitter") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "1yldgdbf3l5l4ki52abdf81nwkcbvg219gwr3ydcjwfsg7hf7zhz")))) + (build-system gnu-build-system) + (arguments + `(#:phases (modify-phases %standard-phases + (delete 'configure) + (add-after 'unpack 'fix-hardcoded-paths + (lambda _ + (substitute* "Makefile" + (("/usr/local") (assoc-ref %outputs "out")))))) + #:tests? #f + #:make-flags + (list (string-append "prefix=" + (assoc-ref %outputs "out")) + (string-append "CC=" + ,(cc-for-target))))) + (home-page "https://tree-sitter.github.io/tree-sitter/") + (synopsis "Incremental parsing system for programming tools") + (description + "Tree-sitter is a parser generator tool and an incremental parsing +library. It can build a concrete syntax tree for a source file and efficiently +update the syntax tree as the source file is edited. Tree-sitter aims to be: + +@itemize +@item General enough to parse any programming language +@item Fast enough to parse on every keystroke in a text editor +@item Robust enough to provide useful results even in the presence of syntax errors +@item Dependency-free so that the runtime library (which is written in pure C) +can be embedded in any application +@end itemize +") + (license license:expat)))