editors/neovim: Update to 0.5.1 and enable LuaJIT where possible.
This commit updates to the latest version and enables LuaJIT on the architectures where we can. Neovim plugins require a very specific version of LuaJIT, so we statically embed it (for more discussion see: https://marc.info/?l=openbsd-ports&m=163153228730587&w=2). Also, make the build honour SEPARATE_BUILD. Thanks to upstream, and in particular Christian Clason, for helping me understand what needed to be done WRT LuaJIT. Tested sparc64 tb@. "looks OK to me" sthen@. OK paco@.
This commit is contained in:
parent
a0f6263423
commit
47a72e04a9
@ -1,36 +1,61 @@
|
||||
# $OpenBSD: Makefile,v 1.23 2021/07/18 09:18:07 paco Exp $
|
||||
# $OpenBSD: Makefile,v 1.24 2021/10/08 22:10:27 edd Exp $
|
||||
|
||||
# Use LuaJIT where possible, as some plugins assume it's available. Arches
|
||||
# that can't use LuaJIT have to use the system Lua (and some plugins may not
|
||||
# work).
|
||||
.if ${MACHINE_ARCH} == "arm" || ${MACHINE_ARCH} == "aarch64" || \
|
||||
${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386" || \
|
||||
${MACHINE_ARCH} == "powerpc"
|
||||
EMBED_LUAJIT = Yes
|
||||
.else
|
||||
EMBED_LUAJIT = No
|
||||
.endif
|
||||
|
||||
COMMENT = continuation and extension of Vim
|
||||
|
||||
GH_ACCOUNT = neovim
|
||||
GH_PROJECT = neovim
|
||||
GH_TAGNAME = v0.5.0
|
||||
GH_TAGNAME = v0.5.1
|
||||
|
||||
CATEGORIES = editors devel
|
||||
HOMEPAGE = https://neovim.io
|
||||
MAINTAINER = Edd Barrett <edd@openbsd.org>
|
||||
|
||||
# Neovim must be statically linked with libluv, which isn't yet ported.
|
||||
# The versions listed here must match those in third-party/CMakeLists.txt.
|
||||
LUV_VER = 1.30.1-1
|
||||
LUV = luv-${LUV_VER}
|
||||
MASTER_SITES0 = https://github.com/luvit/luv/releases/download/${LUV_VER}/
|
||||
DISTFILES = ${DISTNAME}${EXTRACT_SUFX} \
|
||||
${LUV}${EXTRACT_SUFX}:0
|
||||
LUAJIT_VER = 787736990ac3b7d5ceaba2697c7d0f58f77bb782
|
||||
|
||||
# Apache 2.0 + Vim License
|
||||
MASTER_SITES0 = https://github.com/luvit/luv/releases/download/${LUV_VER}/
|
||||
MASTER_SITES1 = https://github.com/LuaJIT/LuaJIT/archive/
|
||||
DISTFILES = ${DISTNAME}${EXTRACT_SUFX} \
|
||||
luv-${LUV_VER}${EXTRACT_SUFX}:0 \
|
||||
luajit-{}${LUAJIT_VER}${EXTRACT_SUFX}:1
|
||||
|
||||
# Neovim: Apache 2.0 + Vim License
|
||||
# LuaJIT: MIT + public domain
|
||||
# libluv: Apache 2.0
|
||||
PERMIT_PACKAGE = Yes
|
||||
|
||||
DEBUG_PACKAGES = ${BUILD_PACKAGES}
|
||||
|
||||
WANTLIB += c iconv intl ${MODLUA_WANTLIB} m msgpackc pthread termkey
|
||||
WANTLIB += ${COMPILER_LIBCXX} c iconv intl m msgpackc pthread termkey
|
||||
WANTLIB += tree-sitter unibilium util uv vterm
|
||||
|
||||
COMPILER = base-clang ports-gcc base-gcc
|
||||
.if ${EMBED_LUAJIT} != "Yes"
|
||||
WANTLIB += ${MODLUA_WANTLIB}
|
||||
.endif
|
||||
|
||||
COMPILER = base-clang ports-gcc
|
||||
|
||||
MODULES = devel/cmake \
|
||||
lang/lua \
|
||||
textproc/intltool
|
||||
|
||||
# LuaJIT is binary compatible with Lua-5.1 extension modules, so we can use
|
||||
# them directly, even on architectures where we will be embedding LuaJIT.
|
||||
# https://luajit.org/extensions.html
|
||||
MODLUA_VERSION = 5.1
|
||||
|
||||
BUILD_DEPENDS = ${RUN_DEPENDS} \
|
||||
devel/gperf \
|
||||
devel/lpeg \
|
||||
@ -46,37 +71,83 @@ LIB_DEPENDS = devel/gettext,-runtime \
|
||||
|
||||
RUN_DEPENDS += devel/libmpack/lua \
|
||||
devel/libmpack/main \
|
||||
devel/desktop-file-utils
|
||||
devel/desktop-file-utils \
|
||||
devel/lua-compat53 \
|
||||
x11/gtk+3,-guic
|
||||
|
||||
MAKE_FLAGS += USE_BUNDLED=OFF
|
||||
CONFIGURE_ARGS += -DLUA_PRG=${MODLUA_BIN} \
|
||||
SEPARATE_BUILD = Yes
|
||||
CONFIGURE_ARGS += -DUSE_BUNDLED=OFF \
|
||||
-DLIBLUV_INCLUDE_DIR=${STATIC_DEPS_INST}/include \
|
||||
-DLIBLUV_LIBRARY=${STATIC_DEPS_INST}/lib/libluv.a
|
||||
.if ${EMBED_LUAJIT} == "Yes"
|
||||
CONFIGURE_ARGS += -DLUA_PRG=${STATIC_DEPS_INST}/bin/luajit-2.1.0-beta3 \
|
||||
-DLUAJIT_INCLUDE_DIR=${STATIC_DEPS_INST}/include/luajit-2.1 \
|
||||
-DLUAJIT_LIBRARY=${STATIC_DEPS_INST}/lib/libluajit-5.1.a
|
||||
.else
|
||||
CONFIGURE_ARGS += -DPREFER_LUA=ON \
|
||||
-DLUA_PRG=${MODLUA_BIN} \
|
||||
-DLUA_INCLUDE_DIR=${MODLUA_INCL_DIR} \
|
||||
-DLUA_LIBRARIES=${MODLUA_LIB} \
|
||||
-DLIBLUV_INCLUDE_DIR=${WRKBUILD}/deps/include \
|
||||
-DLIBLUV_LIBRARY=${WRKBUILD}/deps/lib/libluv.a \
|
||||
-DPREFER_LUA=ON # disables LuaJIT
|
||||
-DLUA_LIBRARIES=${MODLUA_LIB}
|
||||
.endif
|
||||
|
||||
# Tests need gmake
|
||||
USE_GMAKE = Yes
|
||||
# `test_startup_utf8.vim' requires either bash or zsh
|
||||
MODULES += lang/python
|
||||
MODPY_RUNDEP = No
|
||||
MODPY_BUILDDEP = No
|
||||
MODPY_BUILDDEP =No
|
||||
TEST_DEPENDS = shells/bash \
|
||||
editors/py-neovim \
|
||||
editors/py-neovim${MODPY_FLAVOR}
|
||||
|
||||
# Build libluv first as a static library. We opted not to create a libluv
|
||||
# port because it must be built for a specific Lua version and we don't know
|
||||
# what version future ports might need. Currently no other port requires
|
||||
# libluv, so it's simpler to build a static library here.
|
||||
# Move static deps source code under WRKDIST so that they can be patched.
|
||||
STATIC_DEPS_WRKSRC=${WRKDIST}/static-deps/
|
||||
post-extract:
|
||||
mkdir ${STATIC_DEPS_WRKSRC}
|
||||
mv ${WRKDIR}/LuaJIT-${LUAJIT_VER} ${STATIC_DEPS_WRKSRC}/luajit
|
||||
mv ${WRKDIR}/luv-${LUV_VER} ${STATIC_DEPS_WRKSRC}/luv
|
||||
|
||||
# Build LuaJIT (if required) and libluv as static libraries.
|
||||
#
|
||||
# Most of this target is lifted from ${MODCMAKE_configure} in cmake.port.mk.
|
||||
# Unfortunately we can't use it directly, as some of the arguments make
|
||||
# assumptions that can't work for us here.
|
||||
# We opted not to create a libluv port because it must be built for a specific
|
||||
# Lua version and we don't know what version future ports might need. Currently
|
||||
# no other port requires libluv, so it's simpler to build a static library
|
||||
# here.
|
||||
#
|
||||
# Most of the libluv target is lifted from ${MODCMAKE_configure} in
|
||||
# cmake.port.mk. Unfortunately we can't use it directly, as some of the
|
||||
# arguments make assumptions that can't work for us here.
|
||||
#
|
||||
# Neovim plugins expect a very specific version of LuaJIT, so it only really
|
||||
# makes sense to embed it.
|
||||
STATIC_DEPS_WRKBUILD=${WRKBUILD}/static-deps-build
|
||||
STATIC_DEPS_INST=${WRKBUILD}/static-deps-inst
|
||||
.include <bsd.port.arch.mk>
|
||||
.if ${PROPERTIES:Mclang}
|
||||
LUAJIT_TARGET_LIBS = "-lc++abi -lpthread"
|
||||
WANTLIB += c++abi pthread
|
||||
.endif
|
||||
pre-configure:
|
||||
mkdir -p ${WRKBUILD}/build
|
||||
cd ${WRKBUILD}/build && \
|
||||
mkdir -p ${STATIC_DEPS_WRKBUILD} ${STATIC_DEPS_PREFIX}
|
||||
|
||||
.if ${EMBED_LUAJIT} == "Yes"
|
||||
# Build LuaJIT.
|
||||
# We can't build LuaJIT out of its src dir, so copy it so that we can
|
||||
# support SEPARATE_BUILD.
|
||||
cp -r ${STATIC_DEPS_WRKSRC}/luajit ${STATIC_DEPS_WRKBUILD}/luajit
|
||||
cd ${STATIC_DEPS_WRKBUILD}/luajit/src && \
|
||||
${SETENV} ${MAKE_ENV} ${MAKE_PROGRAM} \
|
||||
PREFIX=${STATIC_DEPS_INST} CC=${CC} CCOPT="${CFLAGS}" \
|
||||
CCOPT_x86="" Q="" TARGET_LIBS=${LUAJIT_TARGET_LIBS} \
|
||||
BUILDMODE=static
|
||||
cd ${STATIC_DEPS_WRKBUILD}/luajit && \
|
||||
${SETENV} ${MAKE_ENV} Q="" ${MAKE_PROGRAM} install \
|
||||
PREFIX=${STATIC_DEPS_INST}
|
||||
.endif
|
||||
|
||||
# Build libluv.
|
||||
mkdir -p ${STATIC_DEPS_WRKBUILD}/luv
|
||||
cd ${STATIC_DEPS_WRKBUILD}/luv && \
|
||||
${SETENV} CC="${CC}" \
|
||||
CXX="${CXX}" \
|
||||
CFLAGS="${CFLAGS}" \
|
||||
@ -87,16 +158,16 @@ pre-configure:
|
||||
-DCMAKE_COLOR_MAKEFILE=OFF \
|
||||
-DCMAKE_SKIP_INSTALL_ALL_DEPENDENCY=ON \
|
||||
-DCMAKE_SUPPRESS_REGENERATION=ON \
|
||||
-DCMAKE_INSTALL_PREFIX=${WRKBUILD}/deps \
|
||||
-DCMAKE_INSTALL_PREFIX=${STATIC_DEPS_INST} \
|
||||
-DLUA_BUILD_TYPE=System \
|
||||
-DLUA_INCLUDE_DIR=${MODLUA_INCL_DIR} \
|
||||
-DLUA_LIBRARIES=${MODLUA_LIB} \
|
||||
-DLUA_LIBRARIES=${MODLUA_LIBDIR} \
|
||||
-DWITH_LUA_ENGINE=Lua \
|
||||
${WRKDIR}/${LUV}
|
||||
cd ${WRKBUILD}/build && \
|
||||
${STATIC_DEPS_WRKSRC}/luv
|
||||
cd ${STATIC_DEPS_WRKBUILD}/luv && \
|
||||
${SETENV} ${MAKE_ENV} VERBOSE=1 \
|
||||
${MAKE_PROGRAM}
|
||||
cd ${WRKBUILD}/build && \
|
||||
cd ${STATIC_DEPS_WRKBUILD}/luv && \
|
||||
${SETENV} ${MAKE_ENV} VERBOSE=1 \
|
||||
${MAKE_PROGRAM} install
|
||||
|
||||
@ -105,8 +176,14 @@ pre-configure:
|
||||
#
|
||||
# If cscope is installed, one test fails:
|
||||
# https://github.com/neovim/neovim/issues/12744
|
||||
do-test:
|
||||
cd ${WRKSRC}/src/nvim/testdir && ${SETENV} LC_CTYPE=en_US.UTF-8 \
|
||||
${MAKE_PROGRAM} NVIM_PRG=${WRKBUILD}/bin/nvim ${MAKE_FLAGS}
|
||||
#
|
||||
# XXX: This is broken. The tarball doesn't contain the necessary 'ci'
|
||||
# directory. Will be fixed for the next release though:
|
||||
# https://github.com/neovim/neovim/issues/15856
|
||||
NO_TEST = Yes
|
||||
#do-test:
|
||||
# true
|
||||
# cd ${WRKSRC}/src/nvim/testdir && ${SETENV} LC_CTYPE=en_US.UTF-8 \
|
||||
# ${MAKE_PROGRAM} NVIM_PRG=${WRKBUILD}/bin/nvim ${MAKE_FLAGS}
|
||||
|
||||
.include <bsd.port.mk>
|
||||
|
@ -1,4 +1,6 @@
|
||||
SHA256 (luajit-787736990ac3b7d5ceaba2697c7d0f58f77bb782.tar.gz) = Lj90vCefRsxGOr/Gezbmn6rwNmI3AEdx9MrEvyqfXvs=
|
||||
SHA256 (luv-1.30.1-1.tar.gz) = Tih77W9R/VDOA7p/qMwz2E4bnLhpEcSBK7H0eh4+0So=
|
||||
SHA256 (neovim-0.5.0.tar.gz) = IpTKqdIBGZZJn71w5ABuTvVdt1uZtnGRVMCSYuI3ZO8=
|
||||
SHA256 (neovim-0.5.1.tar.gz) = qkSXleXMab3S7u1wlfILnAhsbs/N4Ktiq5ep0EJD7IQ=
|
||||
SIZE (luajit-787736990ac3b7d5ceaba2697c7d0f58f77bb782.tar.gz) = 1037727
|
||||
SIZE (luv-1.30.1-1.tar.gz) = 1354232
|
||||
SIZE (neovim-0.5.0.tar.gz) = 10337976
|
||||
SIZE (neovim-0.5.1.tar.gz) = 10349190
|
||||
|
@ -1,19 +0,0 @@
|
||||
$OpenBSD: patch-src_nvim_CMakeLists_txt,v 1.3 2020/08/18 19:15:54 edd Exp $
|
||||
|
||||
No need for libc++abi, only available on clang archs and only needed for
|
||||
luajit (we use lua instead).
|
||||
|
||||
Index: src/nvim/CMakeLists.txt
|
||||
--- src/nvim/CMakeLists.txt.orig
|
||||
+++ src/nvim/CMakeLists.txt
|
||||
@@ -366,10 +366,6 @@ endforeach()
|
||||
|
||||
# Our dependencies come first.
|
||||
|
||||
-if (CMAKE_SYSTEM_NAME MATCHES "OpenBSD")
|
||||
- list(APPEND NVIM_LINK_LIBRARIES pthread c++abi)
|
||||
-endif()
|
||||
-
|
||||
if (LibIntl_FOUND)
|
||||
list(APPEND NVIM_LINK_LIBRARIES ${LibIntl_LIBRARY})
|
||||
endif()
|
@ -0,0 +1,16 @@
|
||||
$OpenBSD: patch-static-deps_luajit_src_host_buildvm_asm_c,v 1.1 2021/10/08 22:10:27 edd Exp $
|
||||
|
||||
.gnu_attribute requires binutils 2.18
|
||||
|
||||
Index: static-deps/luajit/src/host/buildvm_asm.c
|
||||
--- static-deps/luajit/src/host/buildvm_asm.c.orig
|
||||
+++ static-deps/luajit/src/host/buildvm_asm.c
|
||||
@@ -327,7 +327,7 @@ void emit_asm(BuildCtx *ctx)
|
||||
#if !(LJ_TARGET_PS3 || LJ_TARGET_PSVITA)
|
||||
fprintf(ctx->fp, "\t.section .note.GNU-stack,\"\"," ELFASM_PX "progbits\n");
|
||||
#endif
|
||||
-#if LJ_TARGET_PPC && !LJ_TARGET_PS3 && !LJ_ABI_SOFTFP
|
||||
+#if 0 || LJ_TARGET_PPC && !LJ_TARGET_PS3 && !LJ_ABI_SOFTFP
|
||||
/* Hard-float ABI. */
|
||||
fprintf(ctx->fp, "\t.gnu_attribute 4, 1\n");
|
||||
#endif
|
@ -0,0 +1,18 @@
|
||||
$OpenBSD: patch-static-deps_luajit_src_lj_arch_h,v 1.1 2021/10/08 22:10:27 edd Exp $
|
||||
|
||||
Our base-clang poses as gcc-4.2.1, but building with clang on powerpc
|
||||
"requires" gcc>=4.3, unlike other archs requiring lower versions. Instead,
|
||||
ignore the gcc version check ifdef hell for all base-clang arches.
|
||||
|
||||
Index: static-deps/luajit/src/lj_arch.h
|
||||
--- static-deps/luajit/src/lj_arch.h.orig
|
||||
+++ static-deps/luajit/src/lj_arch.h
|
||||
@@ -427,7 +427,7 @@
|
||||
/* -- Checks for requirements --------------------------------------------- */
|
||||
|
||||
/* Check for minimum required compiler versions. */
|
||||
-#if defined(__GNUC__)
|
||||
+#if defined(__GNUC__) && !defined(__clang__)
|
||||
#if LJ_TARGET_X86
|
||||
#if (__GNUC__ < 3) || ((__GNUC__ == 3) && __GNUC_MINOR__ < 4)
|
||||
#error "Need at least GCC 3.4 or newer"
|
@ -1,13 +1,9 @@
|
||||
@comment $OpenBSD: PLIST,v 1.9 2021/07/18 09:18:07 paco Exp $
|
||||
@comment $OpenBSD: PLIST,v 1.10 2021/10/08 22:10:27 edd Exp $
|
||||
@bin bin/nvim
|
||||
lib/nvim/
|
||||
@man man/man1/nvim.1
|
||||
share/applications/nvim.desktop
|
||||
share/doc/pkg-readmes/${PKGSTEM}
|
||||
share/icons/
|
||||
share/icons/hicolor/
|
||||
share/icons/hicolor/128x128/
|
||||
share/icons/hicolor/128x128/apps/
|
||||
share/icons/hicolor/128x128/apps/nvim.png
|
||||
share/locale/af/LC_MESSAGES/nvim.mo
|
||||
share/locale/ca/LC_MESSAGES/nvim.mo
|
||||
@ -844,6 +840,7 @@ share/nvim/runtime/lua/vim/highlight.lua
|
||||
share/nvim/runtime/lua/vim/inspect.lua
|
||||
share/nvim/runtime/lua/vim/lsp/
|
||||
share/nvim/runtime/lua/vim/lsp.lua
|
||||
share/nvim/runtime/lua/vim/lsp/_snippet.lua
|
||||
share/nvim/runtime/lua/vim/lsp/buf.lua
|
||||
share/nvim/runtime/lua/vim/lsp/codelens.lua
|
||||
share/nvim/runtime/lua/vim/lsp/diagnostic.lua
|
||||
@ -1610,3 +1607,4 @@ share/nvim/runtime/tutor/en/vim-01-beginner.tutor.json
|
||||
share/nvim/runtime/tutor/tutor.tutor
|
||||
share/nvim/runtime/tutor/tutor.tutor.json
|
||||
@tag update-desktop-database
|
||||
@tag gtk-update-icon-cache %D/share/icons/hicolor
|
||||
|
@ -1,25 +1,17 @@
|
||||
$OpenBSD: README,v 1.3 2018/09/04 12:46:11 espie Exp $
|
||||
$OpenBSD: README,v 1.4 2021/10/08 22:10:27 edd Exp $
|
||||
|
||||
+-------------------------------------------------------------------------------
|
||||
| Running ${PKGSTEM} on OpenBSD
|
||||
+-------------------------------------------------------------------------------
|
||||
|
||||
LuaJIT Support
|
||||
==============
|
||||
|
||||
Some Neovim plugins now require LuaJIT. Those plugins won't work on
|
||||
architectures that have no LuaJIT support.
|
||||
|
||||
Why is the Escape Key Not Working Right?
|
||||
========================================
|
||||
|
||||
If you use Neovim under tmux, you are likely being bitten by a libtermkey bug.
|
||||
Read the libtermkey package README for a workaround.
|
||||
|
||||
Migrating from Vim to Neovim
|
||||
============================
|
||||
|
||||
Note that in Neovim some paths are different from traditional vim. The config
|
||||
dir is ~/.config/nvim, and the main config file is ~/.config/nvim/init.vim. You
|
||||
can symlink your existing traditional vim config and directory to the new
|
||||
paths, and this will work.
|
||||
|
||||
The first time you invoke nvim, run ':checkhealth' to see what else you might
|
||||
need to do to migrate.
|
||||
|
||||
Please note that ':checkhealth' was called ':CheckHealth' (with different
|
||||
capitalisation) prior to neovim version 0.3.0.
|
||||
|
Loading…
Reference in New Issue
Block a user