From 90af5483fae755d11a5f45173f6d1e2bde613ab8 Mon Sep 17 00:00:00 2001 From: Jeremy Baxter Date: Thu, 13 Jun 2024 10:40:07 +1200 Subject: [PATCH] scripts/install-lua.sh: init script Add a script that installs a Lua source archive into the Callisto source tree. This will ease the pain of transitioning to Lua 5.4.7. References: https://todo.sr.ht/~jeremy/callisto/8 --- scripts/install-lua.sh | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100755 scripts/install-lua.sh diff --git a/scripts/install-lua.sh b/scripts/install-lua.sh new file mode 100755 index 0000000..b89dc83 --- /dev/null +++ b/scripts/install-lua.sh @@ -0,0 +1,31 @@ +#!/usr/bin/env sh +# usage: scripts/install-lua.sh lua-x.x.x.tar.gz +# Install a Lua release into the Callisto source tree. + +set -e + +[ -z "$1" ] && (echo "usage: $0 lua-x.x.x.tar.gz"; exit 1) +! [ -d external/lua ] && (echo "not in Callisto source tree"; exit 1) || true + +# clear out existing Lua sources +cd external/lua/ +for file in $(ls -A | sed -Ee 's/^(patches|.gitignore)$//'); do + rm -fr "$file" +done +cd ../../ + +# install new Lua sources +luadir="$(tar -tf "$1" | head -n1)" +rm -rf "$luadir" +tar -xf "$1" +ls "$luadir" +mv "$luadir"/README "$luadir"/src/ +cp -R "$luadir"/src/* external/lua/ +rm -r "$luadir" + +# patch the sources +cd external/lua +for patch in $(ls patches/); do + patch -p0 -i patches/"$patch" +done +cd ../../