summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Szuba <marecki@gentoo.org>2020-12-10 01:36:34 +0100
committerMarek Szuba <marecki@gentoo.org>2020-12-10 01:55:47 +0100
commit9feed107616c754f8a2368cd770b22a28a0a6ac0 (patch)
treeb178dc3097dd47c798e9bed69e1d63eee32ed656 /app-editors/neovim
parentapp-editors/neovim: limit unmigrated ebuilds to dev-lang/lua:0 (diff)
downloadgentoo-9feed107616c754f8a2368cd770b22a28a0a6ac0.tar.gz
gentoo-9feed107616c754f8a2368cd770b22a28a0a6ac0.tar.bz2
gentoo-9feed107616c754f8a2368cd770b22a28a0a6ac0.zip
app-editors/neovim: migrate to lua-single.eclass
Both the latest release and the live ebuild. Set LUA_COMPAT to 'lua5-{1,2} luajit' as per the upstream build scripts; builds fine against lua5.3 but I haven't reviewed the included Lua scripts for compatibility with that version and there is no test phase yet. Migration-wise, one thing worth pointing out is that upstream build scripts attempt to locate some of the Lua modules by locating a Lua interpreter on the *build* system and telling to load those modules. For now all that has been changed is that we force the use the interpreter to match the value of LUA_SINGLE_TARGET (nb. the messages like "[lua5.2] file not found" can be ignored - there is one check which expects an absolute path and by setting LUA_PRG to $ELUA instead of $LUA we can re-use this variable for dev-lua/luv detection, this is just a status message though), then again it might require further revision. Will leave this to the actual maintainers. Beyond the above, it was just having to force CMake to look for a specific Lua version (usual) as well as a tweak to dev-lua/luv detection so that it works with multi-impl installations of that package (expected). Closes: https://bugs.gentoo.org/752912 Signed-off-by: Marek Szuba <marecki@gentoo.org>
Diffstat (limited to 'app-editors/neovim')
-rw-r--r--app-editors/neovim/files/neovim-0.4.4-cmake_lua_version.patch11
-rw-r--r--app-editors/neovim/files/neovim-0.4.4-cmake_multiimpl_luv.patch11
-rw-r--r--app-editors/neovim/neovim-0.4.4-r100.ebuild110
-rw-r--r--app-editors/neovim/neovim-9999.ebuild41
4 files changed, 158 insertions, 15 deletions
diff --git a/app-editors/neovim/files/neovim-0.4.4-cmake_lua_version.patch b/app-editors/neovim/files/neovim-0.4.4-cmake_lua_version.patch
new file mode 100644
index 000000000000..4703dee52613
--- /dev/null
+++ b/app-editors/neovim/files/neovim-0.4.4-cmake_lua_version.patch
@@ -0,0 +1,11 @@
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -384,7 +384,7 @@
+ option(PREFER_LUA "Prefer Lua over LuaJIT in the nvim executable." OFF)
+
+ if(PREFER_LUA)
+- find_package(Lua 5.1 REQUIRED)
++ find_package(Lua ${PREFER_LUA} EXACT REQUIRED)
+ set(LUA_PREFERRED_INCLUDE_DIRS ${LUA_INCLUDE_DIR})
+ set(LUA_PREFERRED_LIBRARIES ${LUA_LIBRARIES})
+ # Passive (not REQUIRED): if LUAJIT_FOUND is not set, nvim-test is skipped.
diff --git a/app-editors/neovim/files/neovim-0.4.4-cmake_multiimpl_luv.patch b/app-editors/neovim/files/neovim-0.4.4-cmake_multiimpl_luv.patch
new file mode 100644
index 000000000000..62c6a84eae13
--- /dev/null
+++ b/app-editors/neovim/files/neovim-0.4.4-cmake_multiimpl_luv.patch
@@ -0,0 +1,11 @@
+--- a/cmake/FindLibLUV.cmake
++++ b/cmake/FindLibLUV.cmake
+@@ -6,7 +6,7 @@
+
+ find_package(PkgConfig)
+ if (PKG_CONFIG_FOUND)
+- pkg_check_modules(PC_LIBLUV QUIET luv)
++ pkg_check_modules(PC_LIBLUV QUIET "libluv-${LUA_PRG}")
+ endif()
+
+ set(LIBLUV_DEFINITIONS ${PC_LIBLUV_CFLAGS_OTHER})
diff --git a/app-editors/neovim/neovim-0.4.4-r100.ebuild b/app-editors/neovim/neovim-0.4.4-r100.ebuild
new file mode 100644
index 000000000000..c5a0f1bf7baf
--- /dev/null
+++ b/app-editors/neovim/neovim-0.4.4-r100.ebuild
@@ -0,0 +1,110 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+LUA_COMPAT=( lua5-{1..2} luajit )
+
+inherit cmake lua-single optfeature xdg
+
+DESCRIPTION="Vim-fork focused on extensibility and agility."
+HOMEPAGE="https://neovim.io"
+
+if [[ ${PV} == 9999 ]]; then
+ inherit git-r3
+ EGIT_REPO_URI="https://github.com/neovim/neovim.git"
+else
+ SRC_URI="https://github.com/neovim/neovim/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+ KEYWORDS="~amd64 ~arm ~arm64 ~x86"
+fi
+
+LICENSE="Apache-2.0 vim"
+SLOT="0"
+IUSE="+lto +nvimpager +tui"
+
+REQUIRED_USE="${LUA_REQUIRED_USE}"
+# Upstream say the test library needs LuaJIT
+# https://github.com/neovim/neovim/blob/91109ffda23d0ce61cec245b1f4ffb99e7591b62/CMakeLists.txt#L377
+#REQUIRED_USE="test? ( lua_single_target_luajit )"
+#RESTRICT="!test? ( test )"
+
+# Upstream build scripts invoke the Lua interpreter
+BDEPEND="${LUA_DEPS}
+ dev-util/gperf
+ virtual/libiconv
+ virtual/libintl
+ virtual/pkgconfig
+"
+# TODO: add tests, dev-lua/busted has now got luajit support.
+# bug #584694
+DEPEND="${LUA_DEPS}
+ $(lua_gen_cond_dep '
+ dev-lua/lpeg[${LUA_USEDEP}]
+ dev-lua/luv[${LUA_USEDEP}]
+ dev-lua/mpack[${LUA_USEDEP}]
+ ')
+ $(lua_gen_cond_dep '
+ dev-lua/LuaBitOp[${LUA_USEDEP}]
+ ' lua5-{1,2})
+ dev-libs/libuv:0=
+ >=dev-libs/libvterm-0.1.2
+ dev-libs/msgpack:0=
+ net-libs/libnsl
+ tui? (
+ dev-libs/libtermkey
+ >=dev-libs/unibilium-2.0.0:0=
+ )
+"
+RDEPEND="
+ ${DEPEND}
+ app-eselect/eselect-vi
+"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-0.4.4-cmake_lua_version.patch
+ "${FILESDIR}"/${PN}-0.4.4-cmake_multiimpl_luv.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
+
+ cmake_src_prepare
+}
+
+src_configure() {
+ # Upstream default to LTO on non-debug builds
+ # Let's expose it as a USE flag because upstream
+ # have preferences for how we should use LTO
+ # if we want it on (not just -flto)
+ # ... but allow turning it off.
+ local mycmakeargs=(
+ -DENABLE_LTO=$(usex lto)
+ -DFEAT_TUI=$(usex tui)
+ -DPREFER_LUA=$(usex lua_single_target_luajit no "$(lua_get_version)")
+ -DLUA_PRG="${ELUA}"
+ )
+ cmake_src_configure
+}
+
+src_install() {
+ cmake_src_install
+
+ # install a default configuration file
+ insinto /etc/vim
+ doins "${FILESDIR}"/sysinit.vim
+
+ # 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
+}
diff --git a/app-editors/neovim/neovim-9999.ebuild b/app-editors/neovim/neovim-9999.ebuild
index 1812d36b55da..38e9b6a6c5bc 100644
--- a/app-editors/neovim/neovim-9999.ebuild
+++ b/app-editors/neovim/neovim-9999.ebuild
@@ -3,7 +3,9 @@
EAPI=7
-inherit cmake optfeature xdg
+LUA_COMPAT=( lua5-{1..2} luajit )
+
+inherit cmake lua-single optfeature xdg
DESCRIPTION="Vim-fork focused on extensibility and agility."
HOMEPAGE="https://neovim.io"
@@ -18,35 +20,38 @@ fi
LICENSE="Apache-2.0 vim"
SLOT="0"
-IUSE="+lto +luajit +nvimpager +tui"
+IUSE="+lto +nvimpager +tui"
+
+REQUIRED_USE="${LUA_REQUIRED_USE}"
# Upstream say the test library needs LuaJIT
# https://github.com/neovim/neovim/blob/91109ffda23d0ce61cec245b1f4ffb99e7591b62/CMakeLists.txt#L377
-#REQUIRED_USE="test? ( luajit )"
+#REQUIRED_USE="test? ( lua_single_target_luajit )"
#RESTRICT="!test? ( test )"
-BDEPEND="
+# Upstream build scripts invoke the Lua interpreter
+BDEPEND="${LUA_DEPS}
dev-util/gperf
virtual/libiconv
virtual/libintl
virtual/pkgconfig
"
-# Once dev-lua/busted has luajit support, we can add tests.
+# TODO: add tests, dev-lua/busted has now got luajit support.
# bug #584694
-DEPEND="
+DEPEND="${LUA_DEPS}
+ $(lua_gen_cond_dep '
+ dev-lua/lpeg[${LUA_USEDEP}]
+ dev-lua/luv[${LUA_USEDEP}]
+ dev-lua/mpack[${LUA_USEDEP}]
+ ')
+ $(lua_gen_cond_dep '
+ dev-lua/LuaBitOp[${LUA_USEDEP}]
+ ' lua5-{1,2})
dev-libs/libutf8proc:=
dev-libs/libuv:0=
>=dev-libs/libvterm-0.1.2
dev-libs/msgpack:0=
dev-libs/tree-sitter:=
- dev-lua/lpeg[luajit=]
- dev-lua/luv[luajit=]
- dev-lua/mpack[luajit=]
net-libs/libnsl
- luajit? ( dev-lang/luajit:2 )
- !luajit? (
- dev-lang/lua:=
- dev-lua/LuaBitOp
- )
tui? (
dev-libs/libtermkey
>=dev-libs/unibilium-2.0.0:0=
@@ -57,6 +62,11 @@ RDEPEND="
app-eselect/eselect-vi
"
+PATCHES=(
+ "${FILESDIR}"/${PN}-0.4.4-cmake_lua_version.patch
+ "${FILESDIR}"/${PN}-0.4.4-cmake_multiimpl_luv.patch
+)
+
src_prepare() {
# use our system vim dir
sed -e "/^# define SYS_VIMRC_FILE/s|\$VIM|${EPREFIX}/etc/vim|" \
@@ -74,7 +84,8 @@ src_configure() {
local mycmakeargs=(
-DENABLE_LTO=$(usex lto)
-DFEAT_TUI=$(usex tui)
- -DPREFER_LUA=$(usex luajit no yes)
+ -DPREFER_LUA=$(usex lua_single_target_luajit no "$(lua_get_version)")
+ -DLUA_PRG="${ELUA}"
)
cmake_src_configure
}