Merge pull request #7785 from MrAdityaAlok/update-lua-lsp

This commit is contained in:
Leonid Pliushch 2021-10-27 13:51:07 +03:00 committed by GitHub
commit a64dedc3b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 90 additions and 72 deletions

View File

@ -0,0 +1,11 @@
--- lua-language-server/3rd/bee.lua/project/common.lua 2021-10-22 15:08:44.191055637 +0530
+++ lua-language-server-patch/3rd/bee.lua/project/common.lua 2021-10-25 22:52:35.474777452 +0530
@@ -45,6 +45,8 @@
}
},
android = {
+ flags ="-fPIC",
+ ldflags ="-L@TERMUX_PREFIX@/lib -landroid-spawn",
sources = {
"!bee/**_win.cpp",
"!bee/**_osx.cpp",

View File

@ -2,57 +2,63 @@ TERMUX_PKG_HOMEPAGE="https://github.com/sumneko/lua-language-server"
TERMUX_PKG_DESCRIPTION="Sumneko Lua Language Server coded in Lua"
TERMUX_PKG_LICENSE="MIT"
TERMUX_PKG_MAINTAINER="MrAdityaAlok <dev.aditya.alok@gmail.com>"
TERMUX_PKG_VERSION=2.4.1
TERMUX_PKG_REVISION=5
TERMUX_PKG_VERSION=2.4.5
TERMUX_PKG_SRCURL=https://github.com/sumneko/lua-language-server.git
TERMUX_PKG_GIT_BRANCH="${TERMUX_PKG_VERSION}"
TERMUX_PKG_BUILD_DEPENDS="libandroid-spawn"
TERMUX_PKG_HOSTBUILD=true
TERMUX_PKG_BUILD_IN_SRC=true
# no cpu_relax support present for these archs.
# https://github.com/actboy168/bee.lua/blob/32f65b92739fa236d87fc1b2e7617470d47f0355/bee/thread/spinlock.h#L14
TERMUX_PKG_BLACKLISTED_ARCHES="arm,i686"
termux_step_host_build() {
termux_setup_ninja
mkdir 3rd
cp -a $TERMUX_PKG_SRCDIR/3rd/luamake 3rd/
cd 3rd/luamake
cp -a "${TERMUX_PKG_SRCDIR}"/3rd/luamake 3rd/
cd 3rd/luamake
if [ "${TERMUX_ON_DEVICE_BUILD}" = true ]; then
sed -i "s/-lstdc++/-lc++_static -lc++abi -landroid-spawn/g" ./compile/ninja/android.ninja
fi
./compile/install.sh
}
termux_step_make() {
termux_setup_ninja
$TERMUX_PKG_HOSTBUILD_DIR/3rd/luamake/luamake -cc "${CC}" -flags "${CFLAGS} ${CPPFLAGS}" -hostos "android"
"${TERMUX_PKG_HOSTBUILD_DIR}"/3rd/luamake/luamake \
-cc "${CC}" \
-flags "${CFLAGS} ${CPPFLAGS}" \
-hostos "android"
}
termux_step_make_install() {
local INSTALL_DIR="${TERMUX_PREFIX}/lib/lua-language-server"
local INSTALL_DIR="${TERMUX_PREFIX}/lib/${TERMUX_PKG_NAME}"
cat >"lua-language-server" <<-EOF
cat >"${TERMUX_PREFIX}/bin/${TERMUX_PKG_NAME}" <<-EOF
#!${TERMUX_PREFIX}/bin/bash
if [ "\$1" = "--start-lsp" ]; then
# use wrapper because lsp paths are relative
exec ${INSTALL_DIR}/lua-language-server -E ${INSTALL_DIR}/main.lua
elif [ "\$1" = "-h" ] || [ "\$1" = "--help" ]; then
echo -e "\n\e[32mTo start language server use --start-lsp\e[39m\n"
exec ${INSTALL_DIR}/lua-language-server "\$@"
else
exec ${INSTALL_DIR}/lua-language-server "\$@"
# After action of termux-elf-cleaner lua-language-server's binary(ELF) is unable to
# determine its version, so provide it manually.
if [ "\$1" = "--version" ]; then
echo "${TERMUX_PKG_NAME}: ${TERMUX_PKG_VERSION}"
else
TMPPATH=\$(mktemp -d "${TERMUX_PREFIX}/tmp/${TERMUX_PKG_NAME}.XXXX")
exec ${INSTALL_DIR}/bin/Android/${TERMUX_PKG_NAME} \\
--logpath="\${TMPPATH}/log" \\
--metapath="\${TMPPATH}/meta" \\
"\${@}"
fi
EOF
install -Dm755 ./lua-language-server "${TERMUX_PREFIX}/bin"
chmod 744 "${TERMUX_PREFIX}/bin/${TERMUX_PKG_NAME}"
mkdir -p "${INSTALL_DIR}"
install -Dm755 ./bin/Android/* "${INSTALL_DIR}"
cp -r ./script ./meta ./tools ./platform.lua ./locale ./debugger.lua ./main.lua "${INSTALL_DIR}"
}
termux_step_create_debscripts() {
cat >prerm <<-EOF
#!${TERMUX_PREFIX}/bin/bash
if [ "$TERMUX_PACKAGE_FORMAT" != "pacman" ] && [ "\$1" != "remove" ]; then exit 0; fi
# log files created by lsp is not removed automatically
rm -rf "${TERMUX_PREFIX}/lib/lua-language-server"
EOF
install -Dm744 -t "${INSTALL_DIR}"/bin/Android ./bin/Android/"${TERMUX_PKG_NAME}"
install -Dm644 -t "${INSTALL_DIR}" ./{main,debugger}.lua
install -Dm644 -t "${INSTALL_DIR}"/bin/Android ./bin/Android/main.lua
cp -r ./script ./meta ./locale "${INSTALL_DIR}"
}

View File

@ -1,11 +0,0 @@
--- lua-language-server/make/install.lua 2021-08-09 14:36:08.073522963 +0530
+++ lua-language-server-patch/make/install.lua 2021-08-10 10:55:34.845906577 +0530
@@ -3,7 +3,7 @@
local pf = require 'bee.platform'
local CWD = fs.current_path()
-local output = CWD / 'bin' / pf.OS
+local output = CWD / 'bin' / 'Android'
local bindir = CWD / builddir / 'bin'
local exe = pf.OS == 'Windows' and ".exe" or ""
local dll = pf.OS == 'Windows' and ".dll" or ".so"

View File

@ -0,0 +1,43 @@
--- a/make.lua 2021-10-22 13:27:28.381004922 +0530
+++ b/make.lua 2021-10-22 13:30:47.541004846 +0530
@@ -2,7 +2,7 @@
local platform = require 'bee.platform'
local exe = platform.OS == 'Windows' and ".exe" or ""
-lm.bindir = "bin/"..platform.OS
+lm.bindir = "bin/Android"
lm.EXE_DIR = ""
lm:import "3rd/bee.lua/make.lua"
@@ -42,29 +42,7 @@
output = lm.bindir.."/main.lua",
}
-lm:build "bee-test" {
- lm.bindir.."/lua-language-server"..exe, "3rd/bee.lua/test/test.lua",
- pool = "console",
- deps = {
- "lua-language-server",
- "copy_bootstrap",
- },
- windows = {
- deps = {
- "copy_vcrt"
- }
- }
-}
-
-lm:build 'unit-test' {
- lm.bindir.."/lua-language-server"..exe, 'test.lua',
- pool = "console",
- deps = {
- "bee-test",
- }
-}
-
lm:default {
- "bee-test",
- "unit-test",
+ "lua-language-server",
+ "copy_bootstrap",
}

View File

@ -1,12 +0,0 @@
--- lua-language-server/3rd/luamake/scripts/compiler/gcc.lua 2021-08-10 10:20:07.635907389 +0530
+++ lua-language-server-patch/3rd/luamake/scripts/compiler/gcc.lua 2021-08-10 14:26:20.565901753 +0530
@@ -64,7 +64,8 @@
function gcc.update_ldflags(ldflags, attribute)
if globals.os == "android" then
--TODO android不支持static crt
- ldflags[#ldflags+1] = "-lstdc++"
+ ldflags[#ldflags+1] = "-lc++_static"
+ ldflags[#ldflags+1] = "-lc++abi"
elseif attribute.crt == "dynamic" then
ldflags[#ldflags+1] = "-lstdc++"
else

View File

@ -1,19 +0,0 @@
--- lua-language-server/make.lua 2021-10-04 00:13:48.079999941 +0530
+++ lua-language-server-patch/make.lua 2021-10-04 00:18:30.059999834 +0530
@@ -21,16 +21,3 @@
'bee',
}
}
-
-local fs = require 'bee.filesystem'
-local pf = require 'bee.platform'
-local exe = pf.OS == 'Windows' and ".exe" or ""
-lm:build 'unittest' {
- fs.path 'bin' / pf.OS / ('lua-language-server' .. exe), 'test.lua', '-E',
- pool = "console",
- deps = {
- 'install',
- }
-}
-
-lm:default 'unittest'