neovim-9999.ebuild 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. # Copyright 1999-2024 Gentoo Authors
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=8
  4. # RelWithDebInfo sets -Og -g
  5. CMAKE_BUILD_TYPE=Release
  6. LUA_COMPAT=( lua5-{1..2} luajit )
  7. inherit cmake lua-single optfeature xdg
  8. DESCRIPTION="Vim-fork focused on extensibility and agility"
  9. HOMEPAGE="https://neovim.io"
  10. if [[ ${PV} == 9999 ]]; then
  11. inherit git-r3
  12. EGIT_REPO_URI="https://github.com/neovim/neovim.git"
  13. else
  14. SRC_URI="https://github.com/neovim/neovim/archive/v${PV}.tar.gz -> ${P}.tar.gz"
  15. KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~riscv ~x86 ~x64-macos"
  16. fi
  17. LICENSE="Apache-2.0 vim"
  18. SLOT="0"
  19. IUSE="doc lint +lto +nvimpager test"
  20. # Upstream say the test library needs LuaJIT
  21. # https://github.com/neovim/neovim/blob/91109ffda23d0ce61cec245b1f4ffb99e7591b62/CMakeLists.txt#L377
  22. REQUIRED_USE="${LUA_REQUIRED_USE} test? ( lua_single_target_luajit )"
  23. # TODO: Get tests running
  24. RESTRICT="!test? ( test ) test"
  25. # Upstream build scripts invoke the Lua interpreter
  26. BDEPEND="${LUA_DEPS}
  27. >=dev-util/gperf-3.1
  28. >=sys-devel/gettext-0.20.1
  29. virtual/libiconv
  30. virtual/libintl
  31. virtual/pkgconfig
  32. "
  33. # Check https://github.com/neovim/neovim/blob/master/third-party/CMakeLists.txt for
  34. # new dependency bounds and so on on bumps (obviously adjust for right branch/tag).
  35. # List of required tree-sitter parsers is taken from cmake.deps/deps.txt
  36. DEPEND="${LUA_DEPS}
  37. >=dev-lua/luv-1.45.0[${LUA_SINGLE_USEDEP}]
  38. $(lua_gen_cond_dep '
  39. dev-lua/lpeg[${LUA_USEDEP}]
  40. dev-lua/mpack[${LUA_USEDEP}]
  41. dev-lua/busted[${LUA_USEDEP}]
  42. ')
  43. $(lua_gen_cond_dep '
  44. dev-lua/LuaBitOp[${LUA_USEDEP}]
  45. ' lua5-{1,2})
  46. >=dev-libs/libutf8proc-2.9.0:=
  47. >=dev-libs/libuv-1.46.0:=
  48. >=dev-libs/libvterm-0.3.3
  49. >=dev-libs/msgpack-3.0.0:=
  50. >=dev-libs/tree-sitter-0.22.6:=
  51. =dev-libs/tree-sitter-c-0.21*
  52. =dev-libs/tree-sitter-lua-0.1*
  53. =dev-libs/tree-sitter-markdown-0.2*
  54. =dev-libs/tree-sitter-query-0.4*
  55. =dev-libs/tree-sitter-vim-0.4*
  56. =dev-libs/tree-sitter-vimdoc-3*
  57. >=dev-libs/unibilium-2.0.0:0=
  58. lint? (
  59. dev-util/shellcheck
  60. dev-util/stylua
  61. )
  62. "
  63. RDEPEND="
  64. ${DEPEND}
  65. app-eselect/eselect-vi
  66. "
  67. BDEPEND+="
  68. test? (
  69. $(lua_gen_cond_dep 'dev-lua/busted[${LUA_USEDEP}]')
  70. )
  71. "
  72. PATCHES=(
  73. "${FILESDIR}/${PN}-9999-cmake_lua_version.patch"
  74. "${FILESDIR}/${PN}-0.10.3-specify-POST_BUILD-when-using-add_custom_command.patch"
  75. "${FILESDIR}/${PN}-9999-cmake-darwin.patch"
  76. )
  77. src_prepare() {
  78. use doc || ( sed -e '/^file(GLOB DOCFILES .*)$/,/^ DESTINATION .*nvim\/runtime\/syntax\/vim)$/d' -i runtime/CMakeLists.txt || die )
  79. # Use our system vim dir
  80. sed -e "/^# define SYS_VIMRC_FILE/s|\$VIM|${EPREFIX}/etc/vim|" \
  81. -i src/nvim/globals.h || die
  82. # https://forums.gentoo.org/viewtopic-p-8750050.html
  83. xdg_environment_reset
  84. cmake_src_prepare
  85. }
  86. src_configure() {
  87. # TODO: Investigate USE_BUNDLED, doesn't seem to be needed right now
  88. local mycmakeargs=(
  89. -DENABLE_LTO=$(usex lto)
  90. -DPREFER_LUA=$(usex lua_single_target_luajit no "$(lua_get_version)")
  91. -DLUA_PRG="${LUA}"
  92. #-DLUA_GEN_PRG="${ELUA}"
  93. -DUSE_BUNDLED_BUSTED=0
  94. -DCOMPILE_LUA=0
  95. -DCI_LINT=$(usex lint)
  96. )
  97. cmake_src_configure
  98. }
  99. src_install() {
  100. cmake_src_install
  101. # install a default configuration file
  102. insinto /etc/vim
  103. doins "${FILESDIR}"/sysinit.vim
  104. # symlink tree-sitter parsers
  105. dodir /usr/share/nvim/runtime
  106. for parser in c lua markdown query vim vimdoc; do
  107. dosym ../../../../$(get_libdir)/libtree-sitter-${parser}.so /usr/share/nvim/runtime/parser/${parser}.so
  108. done
  109. # conditionally install a symlink for nvimpager
  110. if use nvimpager; then
  111. dosym ../share/nvim/runtime/macros/less.sh /usr/bin/nvimpager
  112. fi
  113. }
  114. pkg_postinst() {
  115. xdg_pkg_postinst
  116. optfeature "clipboard support" x11-misc/xsel x11-misc/xclip gui-apps/wl-clipboard
  117. optfeature "Python plugin support" dev-python/pynvim
  118. optfeature "Ruby plugin support" dev-ruby/neovim-ruby-client
  119. optfeature "remote/nvr support" dev-python/neovim-remote
  120. }