From 8882e863ed046529eca44f448c1c42cf2af2d515 Mon Sep 17 00:00:00 2001 From: a-bad-dev <244852891+a-bad-dev@users.noreply.github.com> Date: Sun, 1 Feb 2026 17:49:42 -0400 Subject: [PATCH] Update build.sh --- build.sh | 39 ++++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/build.sh b/build.sh index aa53c7d..b011393 100644 --- a/build.sh +++ b/build.sh @@ -1,15 +1,22 @@ #!/bin/bash -e -# Builds an AppImage using appimagetool. -# Run this script on an aarch64 computer, running modern debian or +# run this script on an aarch64 computer, running modern debian or # something similar, otherwise it's not going to work... VERSION="5.15.0" BOLD="\033[1m" +RED="\033[31m" GREEN="\033[32m" RESET="\033[0m" +# make sure we are root +if [ "$(id -u)" != 0 ]; then + echo -e "${BOLD}${RED}This script must be run as root!${RESET}" + exit 1 +fi + +# install deps echo -e "${BOLD}Downloading deps...${RESET}" apt-get install -y --no-install-recommends \ git \ @@ -39,29 +46,29 @@ apt-get install -y --no-install-recommends \ ca-certificates \ file +# download source code echo -e "${BOLD}Downloading LuaJIT and Luanti source code...${RESET}" git clone --depth 1 https://github.com/LuaJIT/LuaJIT.git luajit curl -Lo luanti.zip https://github.com/luanti-org/luanti/archive/refs/tags/${VERSION}.zip unzip luanti.zip mv luanti-${VERSION} luanti/ +# compile luajit echo -e "${BOLD}Compiling LuaJIT...${RESET}" cd luajit make amalg -j$(nproc) cd .. +# prepare to compile luanti cd luanti mkdir -p build cd build -# Download appimagetool -if [ ! -f appimagetool ]; then - echo -e "${BOLD}Downloading AppImageTool${RESET}" - curl -Lo appimagetool https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-aarch64.AppImage - chmod +x appimagetool -fi +echo -e "${BOLD}Downloading AppImageTool${RESET}" +curl -Lo appimagetool https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-aarch64.AppImage +chmod +x appimagetool -# Compile and install into AppDir +# compile and install into AppDir echo -e "${BOLD}Compiling Luanti...${RESET}" cmake .. -G Ninja \ -DCMAKE_BUILD_TYPE=Release \ @@ -73,15 +80,16 @@ cmake .. -G Ninja \ ninja install -j$(nproc) +# build the appimage itself cd AppDir echo -e "${BOLD}Building AppImage...${RESET}" -# Put desktop and icon at root +# put desktop and icon at root ln -sf usr/share/applications/org.luanti.luanti.desktop luanti.desktop ln -sf usr/share/icons/hicolor/128x128/apps/luanti.png luanti.png ln -sf luanti.png .DirIcon -# Fix locales +# fix locales mv usr/share/locale usr/share/luanti cat > AppRun <<'APPRUN' @@ -92,7 +100,7 @@ exec "${APP_PATH}/usr/bin/luanti" "$@" APPRUN chmod +x AppRun -# List of libraries from the system that should be bundled in the AppImage. +# bundle the libraries INCLUDE_LIBS=( libopenal.so.1 libSDL2-2.0.so.0 @@ -115,17 +123,18 @@ for i in "${INCLUDE_LIBS[@]}"; do cp /usr/lib/aarch64-linux-gnu/$i usr/lib/ done -# Actually build the appimage +# finally make the appimage cd .. ARCH=aarch64 ./appimagetool --appimage-extract-and-run AppDir/ -# Move the appimage to this script's folder +# move the appimage to this script's folder mv Luanti-aarch64.AppImage ../../luanti-${VERSION}-aarch64.AppImage -# Clean up +# clean up cd ../.. rm -rf luanti{,.zip} rm -rf luajit/ +# done :D echo -e "${BOLD}${GREEN}Done!${RESET}"