commit: 9feed107616c754f8a2368cd770b22a28a0a6ac0
Author: Marek Szuba <marecki <AT> gentoo <DOT> org>
AuthorDate: Thu Dec 10 00:36:34 2020 +0000
Commit: Marek Szuba <marecki <AT> gentoo <DOT> org>
CommitDate: Thu Dec 10 00:55:47 2020 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9feed107
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 <AT> gentoo.org>
.../files/neovim-0.4.4-cmake_lua_version.patch | 11 ++++++
.../files/neovim-0.4.4-cmake_multiimpl_luv.patch | 11 ++++++
...neovim-9999.ebuild => neovim-0.4.4-r100.ebuild} | 43 +++++++++++++---------
app-editors/neovim/neovim-9999.ebuild | 41 +++++++++++++--------
profiles/package.mask | 1 +
5 files changed, 75 insertions(+), 32 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 00000000000..4703dee5261
--- /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 00000000000..62c6a84eae1
--- /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-9999.ebuild
b/app-editors/neovim/neovim-0.4.4-r100.ebuild
similarity index 72%
copy from app-editors/neovim/neovim-9999.ebuild
copy to app-editors/neovim/neovim-0.4.4-r100.ebuild
index 1812d36b55d..c5a0f1bf7ba 100644
--- a/app-editors/neovim/neovim-9999.ebuild
+++ b/app-editors/neovim/neovim-0.4.4-r100.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,36 @@ 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="
- dev-libs/libutf8proc:=
+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=
- 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 +60,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 +82,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
}
diff --git a/app-editors/neovim/neovim-9999.ebuild
b/app-editors/neovim/neovim-9999.ebuild
index 1812d36b55d..38e9b6a6c5b 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
}
diff --git a/profiles/package.mask b/profiles/package.mask
index dc035a41fff..77eba5ced53 100644
--- a/profiles/package.mask
+++ b/profiles/package.mask
@@ -499,6 +499,7 @@ gnome-base/orbit
>=app-benchmarks/wrk-4.1.0-r100
>=app-crypt/cardpeek-0.8.4
>=app-crypt/ekeyd-1.1.5-r100
+>=app-editors/neovim-0.4.4-r100
=app-editors/scite-4.4.4-r10
>=app-emulation/libguestfs-1.38.6-r100
>=app-misc/worker-3.8.3-r100