Add package: lua-language-server

This commit is contained in:
Aditya Alok 2021-08-10 20:38:17 +05:30 committed by Henrik Grimler
parent c869760fce
commit 5942789b2a
7 changed files with 138 additions and 0 deletions

View File

@ -0,0 +1,12 @@
--- lua-language-server/3rd/bee.lua/make.lua 2021-08-10 10:20:06.735907389 +0530
+++ lua-language-server-patch/3rd/bee.lua/make.lua 2021-08-10 19:24:38.931999705 +0530
@@ -23,9 +23,3 @@
output = "$bin/main.lua",
deps = "bootstrap",
}
-
-lm:build "test" {
- "$bin/bootstrap"..exe, "@test/test.lua",
- deps = { "bootstrap", "copy_script", "bee" },
- pool = "console"
-}

View File

@ -0,0 +1,57 @@
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.3.4
TERMUX_PKG_SRCURL=https://github.com/sumneko/lua-language-server.git
TERMUX_PKG_GIT_BRANCH="master"
TERMUX_PKG_BUILD_DEPENDS="libandroid-spawn"
TERMUX_PKG_HOSTBUILD=true
termux_step_host_build() {
termux_setup_ninja
cd $TERMUX_PKG_SRCDIR/3rd/luamake
./compile/install.sh
}
termux_step_make() {
cd $TERMUX_PKG_SRCDIR
./3rd/luamake/luamake -cc "${CC}" -flags "${CFLAGS} ${CPPFLAGS}" -hostos "android"
}
termux_step_make_install() {
cd $TERMUX_PKG_SRCDIR
local INSTALL_DIR="${TERMUX_PREFIX}/lib/lua-language-server"
cat > "lua-language-server" <<- 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 "\$@"
fi
EOF
install -Dm755 ./lua-language-server "${TERMUX_PREFIX}/bin"
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 [ "\$1" != "remove" ]; then exit 0; fi
# since lsp creates log file, therefore not removed automatically
rm -rf "${TERMUX_PREFIX}/lib/lua-language-server"
EOF
}

View File

@ -0,0 +1,11 @@
--- 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,15 @@
--- lua-language-server/3rd/bee.lua/3rd/lua/loslib.c 2021-08-09 14:37:07.223522941 +0530
+++ lua-language-server-patch/3rd/bee.lua/3rd/lua/loslib.c 2021-08-10 00:15:30.293997622 +0530
@@ -114,10 +114,10 @@
#include <unistd.h>
-#define LUA_TMPNAMBUFSIZE 32
+#define LUA_TMPNAMBUFSIZE 128
#if !defined(LUA_TMPNAMTEMPLATE)
-#define LUA_TMPNAMTEMPLATE "/tmp/lua_XXXXXX"
+#define LUA_TMPNAMTEMPLATE "@TERMUX_PREFIX@/tmp/lua_XXXXXX"
#endif
#define lua_tmpnam(b,e) { \

View File

@ -0,0 +1,11 @@
--- lua-language-server/3rd/bee.lua/3rd/lua/luaconf.h 2021-08-09 14:37:07.223522941 +0530
+++ lua-language-server-patch/3rd/bee.lua/3rd/lua/luaconf.h 2021-08-10 00:18:08.283997562 +0530
@@ -227,7 +227,7 @@
#else /* }{ */
-#define LUA_ROOT "/usr/local/"
+#define LUA_ROOT "@TERMUX_PREFIX@/"
#define LUA_LDIR LUA_ROOT "share/lua/" LUA_VDIR "/"
#define LUA_CDIR LUA_ROOT "lib/lua/" LUA_VDIR "/"

View File

@ -0,0 +1,12 @@
--- 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

@ -0,0 +1,20 @@
--- lua-language-server/make.lua 2021-08-10 10:19:09.365907411 +0530
+++ lua-language-server-patch/make.lua 2021-08-10 19:21:14.691999783 +0530
@@ -22,17 +22,3 @@
'bootstrap',
}
}
-
-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',
- 'test',
- }
-}
-
-lm:default 'unittest'