fix(luarocks)

provide shim to dynamically update static config

closes #6096
This commit is contained in:
Jacob Heider 2024-05-09 16:46:35 -04:00 committed by Jacob Heider
parent 72934b3600
commit d713c05c69

View file

@ -19,11 +19,43 @@ build:
- make --jobs {{ hw.concurrency }} install - make --jobs {{ hw.concurrency }} install
- run: | - run: |
fix-shebangs.ts luarocks-admin luarocks fix-shebangs.ts luarocks-admin luarocks
sed -i.bak \ sed -i \
-e 's|\[\[{{prefix}}|debug.getinfo(1).source:match("@?(.*/)") .. \[\[..|g' \ -e 's|\[\[{{prefix}}|debug.getinfo(1).source:match("@?(.*/)") .. \[\[..|g' \
luarocks-admin luarocks luarocks-admin luarocks
rm luarocks-admin.bak luarocks.bak
working-directory: ${{prefix}}/bin working-directory: ${{prefix}}/bin
# luarocks config has fixed paths
- run: |
mv bin tbin
mkdir bin
working-directory: ${{prefix}}
- run: |
cat $PROP >luarocks
cat $PROP >luarocks-admin
chmod +x luarocks luarocks-admin
working-directory: ${{prefix}}/bin
prop: |
#!/bin/sh
d="$(cd "$(dirname "$0")"/.. && pwd)"
x="$(basename "$0")"
cat >"$d/etc/luarocks/config-{{deps.lua.org.version.marketing}}.lua" <<EOF
-- LuaRocks configuration
rocks_trees = {
{ name = "user", root = home .. "/.luarocks" };
{ name = "system", root = "${PKGX_DIR:-$HOME/.pkgx}/luarocks.org/v{{version}}" };
}
variables = {
LUA_DIR = "${PKGX_DIR:-$HOME/.pkgx}/lua.org/v{{deps.lua.org.version.marketing}}";
LUA_BINDIR = "${PKGX_DIR:-$HOME/.pkgx}/lua.org/v{{deps.lua.org.version.marketing}}/bin";
LUA_VERSION = "{{deps.lua.org.version.marketing}}";
LUA = "${PKGX_DIR:-$HOME/.pkgx}/lua.org/v{{deps.lua.org.version.marketing}}/bin/lua";
}
EOF
exec "$d/tbin/$x" "$@"
env: env:
ARGS: ARGS:
- --prefix="{{prefix}}" - --prefix="{{prefix}}"
@ -36,4 +68,17 @@ provides:
- bin/luarocks - bin/luarocks
- bin/luarocks-admin - bin/luarocks-admin
test: test "$(luarocks --version | awk 'NR==1 {print $NF}')" = "{{version.raw}}" test:
dependencies:
gnu.org/gcc: '*'
curl.se: '*'
script:
- test "$(luarocks --version | awk 'NR==1 {print $NF}')" = "{{version.raw}}"
- luarocks install busted $EXTRA_ARGS
env:
# some of lua components want this set to build, even though librt has been
# part of glibc since 2.35
linux/aarch64:
EXTRA_ARGS: RT_LIBDIR=/usr/lib/aarch64-linux-gnu
linux/x86-64:
EXTRA_ARGS: RT_LIBDIR=/usr/lib/x86_64-linux-gnu