update build script

This commit is contained in:
a-bad-dev 2026-01-26 00:11:40 -04:00 committed by GitHub
commit 4fa2e35224
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,19 +1,27 @@
#!/bin/bash -e #!/bin/bash -e
# Builds an AppImage using appimagetool. # Builds an AppImage using appimagetool.
# You need to run this inside of a build directory in the source tree, # Run this script on an aarch64 computer, running modern debian or
# it will generate the build files and compile Minetest for you. # something similar, otherwise it's not going to work...
# This script should be run on Debian 11 Bullseye. VERSION="5.15.0"
apt-get install -y git g++ make ninja-build libc6-dev cmake libpng-dev libjpeg-dev libxi-dev libgl1-mesa-dev libsqlite3-dev libogg-dev libvorbis-dev libopenal-dev libcurl4-openssl-dev libfreetype6-dev zlib1g-dev libgmp-dev libzstd-dev libleveldb-dev gettext desktop-file-utils ca-certificates wget file --no-install-recommends BOLD="\033[1m"
GREEN="\033[32m"
RESET="\033[0m"
echo -e "${BOLD}Downloading deps...${RESET}"
apt-get install -y git g++ make ninja-build libc6-dev cmake libpng-dev libjpeg-dev libxi-dev libgl1-mesa-dev libsqlite3-dev libogg-dev libvorbis-dev libopenal-dev libcurl4-openssl-dev libfreetype6-dev zlib1g-dev libgmp-dev libsdl2-dev libzstd-dev libleveldb-dev gettext desktop-file-utils ca-certificates wget file --no-install-recommends
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
git clone --depth 1 --branch stable-5 https://github.com/luanti-org/luanti.git wget -O 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}"
pushd luajit pushd luajit
make amalg -j4 make amalg -j$(nproc)
popd popd
pushd luanti pushd luanti
@ -23,27 +31,30 @@ mkdir -p build; cd build
if [ ! -f appimagetool ]; then if [ ! -f appimagetool ]; then
# Old version of appimagetool: # Old version of appimagetool:
#wget https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-aarch64.AppImage -O appimagetool #wget https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-aarch64.AppImage -O appimagetool
echo -e "${BOLD}Downloading AppImageTool${RESET}"
wget https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-aarch64.AppImage -O appimagetool wget https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-aarch64.AppImage -O appimagetool
chmod +x appimagetool chmod +x appimagetool
fi fi
# Compile and install into AppDir # Compile and install into AppDir
echo -e "${BOLD}Compiling Luanti...${RESET}"
cmake .. -G Ninja \ cmake .. -G Ninja \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=AppDir/usr \ -DCMAKE_INSTALL_PREFIX=AppDir/usr \
-DBUILD_UNITTESTS=OFF \ -DBUILD_UNITTESTS=OFF \
-DENABLE_SYSTEM_JSONCPP=OFF \ -DENABLE_SYSTEM_JSONCPP=OFF \
-DLUA_INCLUDE_DIR=../../luajit/src/ \ -DLUA_INCLUDE_DIR=../../luajit/src/ \
-DLUA_LIBRARY=../../luajit/src/libluajit.a -DLUA_LIBRARY=../../luajit/src/libluajit.a
ninja ninja -j$(nproc)
objcopy --only-keep-debug ../bin/luanti luanti.debug objcopy --only-keep-debug ../bin/luanti luanti.debug
objcopy --strip-debug --add-gnu-debuglink=luanti.debug ../bin/luanti objcopy --strip-debug --add-gnu-debuglink=luanti.debug ../bin/luanti
ninja install ninja install -j$(nproc)
cd AppDir 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/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
@ -87,13 +98,13 @@ done
cd .. cd ..
ARCH=aarch64 ./appimagetool --appimage-extract-and-run AppDir/ ARCH=aarch64 ./appimagetool --appimage-extract-and-run AppDir/
# Move the appimage to ~ # Move the appimage to this script's folder
mv Luanti-aarch64.AppImage ../../luanti-5.15.0-aarch64.AppImage mv Luanti-aarch64.AppImage ../../luanti-5.15.0-aarch64.AppImage
# Clean up # Clean up
cd ../.. cd ../..
rm -rf luanti/ rm -rf luanti{,.zip}
rm -rf luajit/ rm -rf luajit/
echo "Done!" echo -e "${BOLD}${GREEN}Done!${RESET}"