diff --git a/app-editors/neovim/files/neovim-0.10.3-specify-POST_BUILD-when-using-add_custom_command.patch b/app-editors/neovim/files/neovim-0.10.3-specify-POST_BUILD-when-using-add_custom_command.patch new file mode 100644 index 0000000..e7e498e --- /dev/null +++ b/app-editors/neovim/files/neovim-0.10.3-specify-POST_BUILD-when-using-add_custom_command.patch @@ -0,0 +1,43 @@ +https://github.com/neovim/neovim/pull/31121 +From: dundargoc +Date: Fri, 8 Nov 2024 17:16:43 +0100 +Subject: [PATCH] build: specify POST_BUILD when using add_custom_command + +This is needed specifically for the second signature of +add_custom_command, which appends an operation to an existing target. +This will prevent the cmake warning CMP0175. + +Reference: https://cmake.org/cmake/help/latest/policy/CMP0175.html +--- a/cmake/Util.cmake ++++ b/cmake/Util.cmake +@@ -61,6 +61,7 @@ function(add_glob_target) + if(NOT ARG_COMMAND) + add_custom_target(${ARG_TARGET}) + add_custom_command(TARGET ${ARG_TARGET} ++ POST_BUILD + COMMAND ${CMAKE_COMMAND} -E echo "${ARG_TARGET} SKIP: ${ARG_COMMAND} not found") + return() + endif() +--- a/src/nvim/CMakeLists.txt ++++ b/src/nvim/CMakeLists.txt +@@ -750,6 +750,7 @@ add_custom_target(nvim_runtime_deps) + if(WIN32) + # Copy DLLs and third-party tools to bin/ and install them along with nvim + add_custom_command(TARGET nvim_runtime_deps ++ POST_BUILD + COMMAND ${CMAKE_COMMAND} -E ${COPY_DIRECTORY} ${PROJECT_BINARY_DIR}/windows_runtime_deps/ + ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) + install(DIRECTORY ${PROJECT_BINARY_DIR}/windows_runtime_deps/ +@@ -791,7 +792,10 @@ file(MAKE_DIRECTORY ${BINARY_LIB_DIR}) + + # install treesitter parser if bundled + if(EXISTS ${DEPS_PREFIX}/lib/nvim/parser) +- add_custom_command(TARGET nvim_runtime_deps COMMAND ${CMAKE_COMMAND} -E ${COPY_DIRECTORY} ${DEPS_PREFIX}/lib/nvim/parser ${BINARY_LIB_DIR}/parser) ++ add_custom_command( ++ TARGET nvim_runtime_deps ++ POST_BUILD ++ COMMAND ${CMAKE_COMMAND} -E ${COPY_DIRECTORY} ${DEPS_PREFIX}/lib/nvim/parser ${BINARY_LIB_DIR}/parser) + endif() + + install(DIRECTORY ${BINARY_LIB_DIR} + diff --git a/app-editors/neovim/files/neovim-0.9.0-cmake_lua_version.patch b/app-editors/neovim/files/neovim-0.9.0-cmake_lua_version.patch new file mode 100644 index 0000000..b14b3b9 --- /dev/null +++ b/app-editors/neovim/files/neovim-0.9.0-cmake_lua_version.patch @@ -0,0 +1,11 @@ +--- a/src/nvim/CMakeLists.txt ++++ b/src/nvim/CMakeLists.txt +@@ -464,7 +464,7 @@ endif() + # The unit test lib requires LuaJIT; it will be skipped if LuaJIT is missing. + option(PREFER_LUA "Prefer Lua over LuaJIT in the nvim executable." OFF) + if(PREFER_LUA) +- find_package(Lua 5.1 EXACT REQUIRED) ++ find_package(Lua ${PREFER_LUA} EXACT REQUIRED) + target_include_directories(main_lib SYSTEM BEFORE INTERFACE ${LUA_INCLUDE_DIR}) + target_link_libraries(main_lib INTERFACE ${LUA_LIBRARIES}) + # Passive (not REQUIRED): if LUAJIT_FOUND is not set, fixtures for unittests is skipped. diff --git a/app-editors/neovim/files/neovim-9999-cmake-darwin.patch b/app-editors/neovim/files/neovim-9999-cmake-darwin.patch new file mode 100644 index 0000000..7d2352c --- /dev/null +++ b/app-editors/neovim/files/neovim-9999-cmake-darwin.patch @@ -0,0 +1,13 @@ +Patch author: mortezadadgar +--- a/src/nvim/CMakeLists.txt ++++ b/src/nvim/CMakeLists.txt +@@ -477,9 +477,6 @@ foreach(target ${targets}) + endforeach() + endforeach() + +-if(APPLE AND CMAKE_OSX_SYSROOT) +- list(APPEND gen_cflags "-isysroot" "${CMAKE_OSX_SYSROOT}") +-endif() + if(MSVC) + list(APPEND gen_cflags -wd4003) + endif() diff --git a/app-editors/neovim/files/sysinit.vim b/app-editors/neovim/files/sysinit.vim new file mode 100644 index 0000000..de47eef --- /dev/null +++ b/app-editors/neovim/files/sysinit.vim @@ -0,0 +1,97 @@ +" Default Gentoo configuration file for neovim +" Based on the default vimrc shipped by Gentoo with app-editors/vim-core + +" You can override any of these settings on a global basis via the +" "/etc/vim/nvimrc.local" file, and on a per-user basis via "~/.nvimrc". +" You may need to create these. + +" Neovim comes with sensible defaults, see: +" https://github.com/neovim/neovim/issues/2676 +" Most of the general settings from Gentoo's vimrc have been dropped here. +" We add only some necessary fixes and a few Gentoo specific settings. + +" {{{ Locale settings +" If we have a BOM, always honour that rather than trying to guess. +if &fileencodings !~? "ucs-bom" + set fileencodings^=ucs-bom +endif + +" Always check for UTF-8 when trying to determine encodings. +if &fileencodings !~? "utf-8" + " If we have to add this, the default encoding is not Unicode. + let g:added_fenc_utf8 = 1 + set fileencodings+=utf-8 +endif +" }}} + +" {{{ Fix &shell, see bug #101665. +if "" == &shell + if executable("/bin/bash") + set shell=/bin/bash + elseif executable("/bin/sh") + set shell=/bin/sh + endif +endif +"}}} + +" {{{ Our default /bin/sh is bash, not ksh, so syntax highlighting for .sh +" files should default to bash. See :help sh-syntax and bug #101819. +if has("eval") + let is_bash=1 +endif +" }}} + +" {{{ Autocommands +if has("autocmd") + +augroup gentoo + au! + + " Gentoo-specific settings for ebuilds. These are the federally-mandated + " required tab settings. See the following for more information: + " http://www.gentoo.org/proj/en/devrel/handbook/handbook.xml + " Note that the rules below are very minimal and don't cover everything. + " Better to emerge app-vim/gentoo-syntax, which provides full syntax, + " filetype and indent settings for all things Gentoo. + au BufRead,BufNewFile *.e{build,class} set ts=4 sw=4 noexpandtab + + " When editing a file, always jump to the last cursor position + autocmd BufReadPost * + \ if ! exists("g:leave_my_cursor_position_alone") | + \ if line("'\"") > 0 && line ("'\"") <= line("$") | + \ exe "normal g'\"" | + \ endif | + \ endif + + " When editing a crontab file, set backupcopy to yes rather than auto. See + " :help crontab and bug #53437. + autocmd FileType crontab set backupcopy=yes + + " If we previously detected that the default encoding is not UTF-8 + " (g:added_fenc_utf8), assume that a file with only ASCII characters (or no + " characters at all) isn't a Unicode file, but is in the default encoding. + " Except of course if a byte-order mark is in effect. + autocmd BufReadPost * + \ if exists("g:added_fenc_utf8") && &fileencoding == "utf-8" && + \ ! &bomb && search('[\x80-\xFF]','nw') == 0 && &modifiable | + \ set fileencoding= | + \ endif + + " Strip trailing spaces on write + autocmd BufWritePre *.e{build,class} + \ if ! exists("g:leave_my_trailing_space_alone") | + \ :%s/\s\+$//e | + \ endif + +augroup END + +endif " has("autocmd") +" }}} + +" {{{ nvimrc.local +if filereadable("/etc/vim/nvimrc.local") + source /etc/vim/nvimrc.local +endif +" }}} + +" vim: set tw=80 sw=2 sts=2 et foldmethod=marker : diff --git a/app-editors/neovim/neovim-0.10.4.ebuild b/app-editors/neovim/neovim-0.10.4.ebuild new file mode 100644 index 0000000..05cb6e4 --- /dev/null +++ b/app-editors/neovim/neovim-0.10.4.ebuild @@ -0,0 +1,121 @@ +# Copyright 1999-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +# RelWithDebInfo sets -Og -g +CMAKE_BUILD_TYPE=Release +LUA_COMPAT=( lua5-{1..2} luajit ) +inherit cmake lua-single optfeature xdg + +DESCRIPTION="Vim-fork focused on extensibility and agility" +HOMEPAGE="https://neovim.io" + +SRC_URI="https://github.com/neovim/neovim/archive/v${PV}.tar.gz -> ${P}.tar.gz" +KEYWORDS="amd64 ~arm arm64 ~ppc ~ppc64 ~riscv x86 ~x64-macos" +LICENSE="Apache-2.0 vim" +SLOT="0" +IUSE="+nvimpager test" + +# Upstream say the test library needs LuaJIT +# https://github.com/neovim/neovim/blob/91109ffda23d0ce61cec245b1f4ffb99e7591b62/CMakeLists.txt#L377 +REQUIRED_USE="${LUA_REQUIRED_USE} test? ( lua_single_target_luajit )" +# TODO: Get tests running +RESTRICT="!test? ( test ) test" + +# Upstream build scripts invoke the Lua interpreter +BDEPEND="${LUA_DEPS} + >=dev-util/gperf-3.1 + >=sys-devel/gettext-0.20.1 + virtual/libiconv + virtual/libintl + virtual/pkgconfig +" +# Check https://github.com/neovim/neovim/blob/master/third-party/CMakeLists.txt for +# new dependency bounds and so on on bumps (obviously adjust for right branch/tag). +# List of required tree-sitter parsers is taken from cmake.deps/deps.txt +DEPEND="${LUA_DEPS} + >=dev-lua/luv-1.45.0[${LUA_SINGLE_USEDEP}] + $(lua_gen_cond_dep ' + dev-lua/lpeg[${LUA_USEDEP}] + dev-lua/mpack[${LUA_USEDEP}] + ') + $(lua_gen_cond_dep ' + dev-lua/LuaBitOp[${LUA_USEDEP}] + ' lua5-{1,2}) + >=dev-libs/libutf8proc-2.9.0:= + >=dev-libs/libuv-1.46.0:= + >=dev-libs/libvterm-0.3.3 + >=dev-libs/msgpack-3.0.0:= + >=dev-libs/tree-sitter-0.22.6:= + =dev-libs/tree-sitter-c-0.21* + =dev-libs/tree-sitter-lua-0.1* + =dev-libs/tree-sitter-markdown-0.2* + =dev-libs/tree-sitter-query-0.4* + =dev-libs/tree-sitter-vim-0.4* + =dev-libs/tree-sitter-vimdoc-3* + >=dev-libs/unibilium-2.0.0:0= +" +RDEPEND=" + ${DEPEND} + app-eselect/eselect-vi +" +BDEPEND+=" + test? ( + $(lua_gen_cond_dep 'dev-lua/busted[${LUA_USEDEP}]') + ) +" + +PATCHES=( + "${FILESDIR}/${PN}-0.9.0-cmake_lua_version.patch" + "${FILESDIR}/${PN}-9999-cmake-darwin.patch" +) + +src_prepare() { + # Use our system vim dir + sed -e "/^# define SYS_VIMRC_FILE/s|\$VIM|${EPREFIX}/etc/vim|" \ + -i src/nvim/globals.h || die + + # https://forums.gentoo.org/viewtopic-p-8750050.html + xdg_environment_reset + cmake_src_prepare +} + +src_configure() { + # TODO: Investigate USE_BUNDLED, doesn't seem to be needed right now + local mycmakeargs=( + # appends -flto + -DENABLE_LTO=OFF + -DPREFER_LUA=$(usex lua_single_target_luajit no "$(lua_get_version)") + -DLUA_PRG="${LUA}" + ) + cmake_src_configure +} + +src_install() { + cmake_src_install + + # install a default configuration file + insinto /etc/vim + doins "${FILESDIR}"/sysinit.vim + + # symlink tree-sitter parsers + dodir /usr/share/nvim/runtime + for parser in c lua markdown query vim vimdoc; do + dosym ../../../../$(get_libdir)/libtree-sitter-${parser}.so /usr/share/nvim/runtime/parser/${parser}.so + done + + # conditionally install a symlink for nvimpager + if use nvimpager; then + dosym ../share/nvim/runtime/macros/less.sh /usr/bin/nvimpager + fi +} + +pkg_postinst() { + xdg_pkg_postinst + + optfeature "clipboard support" x11-misc/xsel x11-misc/xclip gui-apps/wl-clipboard + optfeature "Python plugin support" dev-python/pynvim + optfeature "Ruby plugin support" dev-ruby/neovim-ruby-client + optfeature "remote/nvr support" dev-python/neovim-remote +}