Files
guru/dev-util/lua-language-server/lua-language-server-3.19.2.ebuild
T
Charlotte Deleńkec b8db62e4bd dev-util/lua-language-server: Use | in sed patches
Previously, the ebuild would fail with unknown options in s commands in
sed, should one of the used make.conf variables contain a /. In my
particular case, my C/CXX/LDFLAGS contain an -ffile-prefix-map argument,
which includes multiple slashes.

I also extended this to the replacements involving CC and AR, as they
could theoretically be set to an absolute path too.

Signed-off-by: Charlotte Deleńkec <lotte@chir.rs>
Part-of: https://codeberg.org/gentoo/guru/pulls/133
Merges: https://codeberg.org/gentoo/guru/pulls/133
Signed-off-by: ingenarel (NeoJesus) <ingenarel_neojesus@disroot.org>
2026-10-27 23:40:18 +06:00

96 lines
2.5 KiB
Bash

# Copyright 2022-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
LUA_COMPAT=( lua{5-{1,3,4},jit} )
inherit ninja-utils toolchain-funcs lua-single prefix
DESCRIPTION="Lua language server"
HOMEPAGE="https://github.com/LuaLS/lua-language-server"
SRC_URI="https://github.com/LuaLS/lua-language-server/releases/download/${PV}/${P}-submodules.zip -> ${P}.zip"
S="${WORKDIR}"
LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="llvm-libunwind test"
REQUIRE_USE="${LUA_REQUIRED_USE}"
DEPEND="
${LUA_DEPS}
sys-libs/binutils-libs
"
RDEPEND="${DEPEND}"
BDEPEND="
app-alternatives/ninja
app-arch/unzip
!llvm-libunwind? ( sys-libs/libunwind )
llvm-libunwind? ( llvm-runtimes/libunwind )
"
RESTRICT="!test? ( test )"
src_prepare() {
# Remove hardcoded gcc references
sed -i "/lm.cxx/a lm.cc = '$(tc-getCC)'" \
make.lua || die
sed -i "s/CC = gcc/ CC = ${tc-getCC}/" \
3rd/lpeglabel/makefile || die
# Shipped file doesn't respect CFLAGS/CXXFLAGS/LDFLAGS
eapply "${FILESDIR}/3.16.4-linux.ninja.patch"
eapply_user
sed -i -e "s|^cc = REPLACE_ME|cc = $(tc-getCC)|" \
-e "s|^ar = REPLACE_AR|ar = $(tc-getAR)|" \
-e "s|CFLAGS|${CFLAGS}|" \
-e "s|CXXFLAGS|${CXXFLAGS}|" \
-e "s|LDFLAGS|${LDFLAGS}|" \
3rd/luamake/compile/ninja/linux.ninja || die
if [[ $(tc-get-cxx-stdlib) == libc++ ]]; then
sed -i "s/-lstdc++fs//" 3rd/luamake/compile/ninja/linux.ninja || die
fi
prefixify_ro "${FILESDIR}/wrapper.sh"
}
src_compile() {
eninja -C 3rd/luamake -f compile/ninja/linux.ninja "$(usex test "test" "luamake")"
use test && eninja -C 3rd/luamake -f compile/ninja/linux.ninja luamake
./3rd/luamake/luamake init || die
# Generated file doesn't respect CFLAGS/CXXFLAGS/LDFLAGS
sed -i -e "s/^cc =.*./cc = REPLACE_ME/" \
-e "s/^ar =.*./ar = REPLACE_AR/" \
build/build.ninja || die
eapply "${FILESDIR}/3.16.4-build.ninja.patch"
sed -i -e "s|REPLACE_ME|$(tc-getCC)|" \
-e "s|REPLACE_AR|$(tc-getAR)|" \
-e "s|LUAMAKE_PATH|${S}/3rd/luamake/luamake|" \
-e "s|CFLAGS|${CFLAGS}|" \
-e "s|CXXFLAGS|${CXXFLAGS}|" \
-e "s|LDFLAGS|${LDFLAGS}|" \
build/build.ninja || die
if [[ $(tc-get-cxx-stdlib) == libc++ ]]; then
sed -i "s/-lstdc++fs//" build/build.ninja || die
fi
use test && eninja -f build/build.ninja || eninja -f build/build.ninja all
rm -rf meta/198256b1
}
src_install() {
newbin "${T}/wrapper.sh" ${PN}
into /opt/${PN}
dobin bin/${PN}
insinto /opt/${PN}/bin
doins bin/main.lua
insinto /opt/${PN}
doins -r debugger.lua main.lua locale meta script
einstalldocs
}