termux-packages/packages/lua-language-server/build.sh
Henrik Grimler 864f6a63fe lua-language-server: fix hostbuild step
Package still fails to build though:

FAILED: build/obj/source_bee/subprocess_posix.obj
aarch64-linux-android-clang -MMD -MT build/obj/source_bee/subprocess_posix.obj -MF build/obj/source_bee/subprocess_posix.obj.d -std=c++17 -O2 -Wall -Werror -fvisibility=hidden -I3rd/bee.lua/bee/nonstd -I3rd/bee.lua -DBEE_INLINE -DNDEBUG  -fstack-protector-strong -Oz -I/data/data/com.termux/files/usr/include -o build/obj/source_bee/subprocess_posix.obj -c 3rd/bee.lua/bee/subprocess/subprocess_posix.cpp
3rd/bee.lua/bee/subprocess/subprocess_posix.cpp:152:17: error: 'posix_spawnattr_init' is unavailable: introduced in Android 28
        int r = posix_spawnattr_init(&spawnattr_);
                ^
/data/data/com.termux/files/usr/include/spawn.h:56:5: note: 'posix_spawnattr_init' has been explicitly marked unavailable here
int posix_spawnattr_init(posix_spawnattr_t* __attr) __INTRODUCED_IN(28);
    ^
2021-10-22 23:05:45 +02:00

59 lines
1.8 KiB
Bash

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=4
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
termux_step_host_build() {
termux_setup_ninja
mkdir 3rd
cp -a $TERMUX_PKG_SRCDIR/3rd/luamake 3rd/
cd 3rd/luamake
./compile/install.sh
}
termux_step_make() {
termux_setup_ninja
$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"
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 [ "$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
}