Update build.sh

This commit is contained in:
a-bad-dev 2026-02-01 17:49:42 -04:00 committed by GitHub
commit 8882e863ed
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,15 +1,22 @@
#!/bin/bash -e #!/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... # something similar, otherwise it's not going to work...
VERSION="5.15.0" VERSION="5.15.0"
BOLD="\033[1m" BOLD="\033[1m"
RED="\033[31m"
GREEN="\033[32m" GREEN="\033[32m"
RESET="\033[0m" 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}" echo -e "${BOLD}Downloading deps...${RESET}"
apt-get install -y --no-install-recommends \ apt-get install -y --no-install-recommends \
git \ git \
@ -39,29 +46,29 @@ apt-get install -y --no-install-recommends \
ca-certificates \ ca-certificates \
file file
# download source code
echo -e "${BOLD}Downloading LuaJIT and Luanti source code...${RESET}" echo -e "${BOLD}Downloading LuaJIT and Luanti source code...${RESET}"
git clone --depth 1 https://github.com/LuaJIT/LuaJIT.git luajit 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 curl -Lo luanti.zip https://github.com/luanti-org/luanti/archive/refs/tags/${VERSION}.zip
unzip luanti.zip unzip luanti.zip
mv luanti-${VERSION} luanti/ mv luanti-${VERSION} luanti/
# compile luajit
echo -e "${BOLD}Compiling LuaJIT...${RESET}" echo -e "${BOLD}Compiling LuaJIT...${RESET}"
cd luajit cd luajit
make amalg -j$(nproc) make amalg -j$(nproc)
cd .. cd ..
# prepare to compile luanti
cd luanti cd luanti
mkdir -p build mkdir -p build
cd build cd build
# Download appimagetool echo -e "${BOLD}Downloading AppImageTool${RESET}"
if [ ! -f appimagetool ]; then curl -Lo appimagetool https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-aarch64.AppImage
echo -e "${BOLD}Downloading AppImageTool${RESET}" chmod +x appimagetool
curl -Lo appimagetool https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-aarch64.AppImage
chmod +x appimagetool
fi
# Compile and install into AppDir # compile and install into AppDir
echo -e "${BOLD}Compiling Luanti...${RESET}" echo -e "${BOLD}Compiling Luanti...${RESET}"
cmake .. -G Ninja \ cmake .. -G Ninja \
-DCMAKE_BUILD_TYPE=Release \ -DCMAKE_BUILD_TYPE=Release \
@ -73,15 +80,16 @@ cmake .. -G Ninja \
ninja install -j$(nproc) ninja install -j$(nproc)
# build the appimage itself
cd AppDir cd AppDir
echo -e "${BOLD}Building AppImage...${RESET}" 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/applications/org.luanti.luanti.desktop luanti.desktop
ln -sf usr/share/icons/hicolor/128x128/apps/luanti.png luanti.png ln -sf usr/share/icons/hicolor/128x128/apps/luanti.png luanti.png
ln -sf luanti.png .DirIcon ln -sf luanti.png .DirIcon
# Fix locales # fix locales
mv usr/share/locale usr/share/luanti mv usr/share/locale usr/share/luanti
cat > AppRun <<'APPRUN' cat > AppRun <<'APPRUN'
@ -92,7 +100,7 @@ exec "${APP_PATH}/usr/bin/luanti" "$@"
APPRUN APPRUN
chmod +x AppRun chmod +x AppRun
# List of libraries from the system that should be bundled in the AppImage. # bundle the libraries
INCLUDE_LIBS=( INCLUDE_LIBS=(
libopenal.so.1 libopenal.so.1
libSDL2-2.0.so.0 libSDL2-2.0.so.0
@ -115,17 +123,18 @@ for i in "${INCLUDE_LIBS[@]}"; do
cp /usr/lib/aarch64-linux-gnu/$i usr/lib/ cp /usr/lib/aarch64-linux-gnu/$i usr/lib/
done done
# Actually build the appimage # finally make the appimage
cd .. cd ..
ARCH=aarch64 ./appimagetool --appimage-extract-and-run AppDir/ 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 mv Luanti-aarch64.AppImage ../../luanti-${VERSION}-aarch64.AppImage
# Clean up # clean up
cd ../.. cd ../..
rm -rf luanti{,.zip} rm -rf luanti{,.zip}
rm -rf luajit/ rm -rf luajit/
# done :D
echo -e "${BOLD}${GREEN}Done!${RESET}" echo -e "${BOLD}${GREEN}Done!${RESET}"