mirror of
https://github.com/a-bad-dev/luanti-appimages-aarch64.git
synced 2026-06-09 00:31:31 +00:00
Compare commits
18 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
59fd8e4532 |
||
|
|
b445356066 |
||
|
|
d9a3b03291 |
||
|
|
b43be1cba0 |
||
|
|
38781a65fe |
||
|
|
2df8b64e79 |
||
|
|
935c614f07 |
||
|
|
cfbd156583 |
||
|
|
57518baae5 |
||
|
|
360644feaf |
||
|
|
45605a703a |
||
|
|
4f071a2cba |
||
|
|
fcd2eecdfd | ||
|
|
275de7f8ee |
||
|
|
8882e863ed |
||
|
|
1c334a9b64 |
||
|
|
ceecf4d4c6 |
||
|
|
4fa2e35224 |
2 changed files with 216 additions and 46 deletions
172
build.sh
172
build.sh
|
|
@ -1,99 +1,175 @@
|
||||||
#!/bin/bash -e
|
#!/bin/bash -e
|
||||||
|
|
||||||
# Builds an AppImage using appimagetool.
|
# run this script on an aarch64 computer, running modern debian or
|
||||||
# You need to run this inside of a build directory in the source tree,
|
# something similar, otherwise it's not going to work...
|
||||||
# it will generate the build files and compile Minetest for you.
|
|
||||||
|
|
||||||
# This script should be run on Debian 11 Bullseye.
|
VERSION="5.16.1"
|
||||||
|
SDL_VERSION="2.32.10"
|
||||||
|
|
||||||
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="\x1b[1m"
|
||||||
|
RED="\x1b[31m"
|
||||||
|
GREEN="\x1b[32m"
|
||||||
|
RESET="\x1b[0m"
|
||||||
|
|
||||||
git clone --depth 1 https://github.com/LuaJIT/LuaJIT.git luajit
|
# make sure we are root
|
||||||
git clone --depth 1 --branch stable-5 https://github.com/luanti-org/luanti.git
|
if [ "$(id -u)" != "0" ]; then
|
||||||
|
echo -e "${BOLD}${RED}This script must be run as root!${RESET}"
|
||||||
# COMPILE LUAJIT
|
exit 1
|
||||||
pushd luajit
|
|
||||||
make amalg -j4
|
|
||||||
popd
|
|
||||||
|
|
||||||
pushd luanti
|
|
||||||
mkdir -p build; cd build
|
|
||||||
|
|
||||||
# Download appimagetool
|
|
||||||
if [ ! -f appimagetool ]; then
|
|
||||||
# Old version of appimagetool:
|
|
||||||
#wget https://github.com/AppImage/AppImageKit/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
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Compile and install into AppDir
|
# install deps
|
||||||
|
echo -e "${BOLD}Downloading deps...${RESET}"
|
||||||
|
|
||||||
|
apt-get install -y --no-install-recommends \
|
||||||
|
git \
|
||||||
|
g++ \
|
||||||
|
make \
|
||||||
|
ninja-build \
|
||||||
|
libc6-dev \
|
||||||
|
cmake \
|
||||||
|
curl \
|
||||||
|
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 \
|
||||||
|
file
|
||||||
|
|
||||||
|
# download luajit, SDL2, and luanti source code
|
||||||
|
echo -e "${BOLD}Downloading LuaJIT, SDL2, 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
|
||||||
|
curl -Lo sdl2.zip https://github.com/libsdl-org/SDL/releases/download/release-${SDL_VERSION}/SDL2-${SDL_VERSION}.zip
|
||||||
|
|
||||||
|
unzip luanti.zip
|
||||||
|
mv luanti-${VERSION} luanti/
|
||||||
|
rm luanti.zip
|
||||||
|
|
||||||
|
unzip sdl2.zip
|
||||||
|
mv SDL2-${SDL_VERSION} sdl2
|
||||||
|
rm sdl2.zip
|
||||||
|
|
||||||
|
# compile luajit
|
||||||
|
echo -e "${BOLD}Compiling LuaJIT...${RESET}"
|
||||||
|
cd luajit
|
||||||
|
make amalg -j$(nproc)
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
# compile sdl2
|
||||||
|
echo -e "${BOLD}Compiling SDL2...${RESET}"
|
||||||
|
cd sdl2
|
||||||
|
|
||||||
|
mkdir build
|
||||||
|
cd build
|
||||||
|
|
||||||
cmake .. -G Ninja \
|
cmake .. -G Ninja \
|
||||||
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
-DSDL_INSTALL_CMAKEDIR=usr/lib/cmake/SDL2 \
|
||||||
|
-DCMAKE_BUILD_TYPE=Release \
|
||||||
|
-DCMAKE_INSTALL_PREFIX=/ \
|
||||||
|
-DCMAKE_C_FLAGS="-DSDL_LEAN_AND_MEAN=1" \
|
||||||
|
-DSDL_{AUDIO,RENDER,VULKAN,TEST,STATIC}=OFF
|
||||||
|
|
||||||
|
ninja -j$(nproc)
|
||||||
|
strip -s *.so
|
||||||
|
DESTDIR="../../" ninja install -j$(nproc)
|
||||||
|
|
||||||
|
cd ../..
|
||||||
|
|
||||||
|
# prepare to compile luanti
|
||||||
|
cd luanti
|
||||||
|
mkdir -p build
|
||||||
|
cd build
|
||||||
|
|
||||||
|
echo -e "${BOLD}Downloading AppImageTool${RESET}"
|
||||||
|
curl -Lo appimagetool https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-aarch64.AppImage
|
||||||
|
chmod +x appimagetool
|
||||||
|
|
||||||
|
# compile luanti
|
||||||
|
echo -e "${BOLD}Compiling Luanti...${RESET}"
|
||||||
|
cmake .. -G Ninja \
|
||||||
|
-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
|
|
||||||
|
|
||||||
objcopy --only-keep-debug ../bin/luanti luanti.debug
|
# install into the AppDir folder
|
||||||
objcopy --strip-debug --add-gnu-debuglink=luanti.debug ../bin/luanti
|
ninja install -j$(nproc)
|
||||||
|
|
||||||
ninja install
|
|
||||||
|
|
||||||
|
# build the appimage itself
|
||||||
cd AppDir
|
cd AppDir
|
||||||
|
|
||||||
# Put desktop and icon at root
|
echo -e "${BOLD}Building AppImage...${RESET}"
|
||||||
|
# put desktop and icon at root of AppDir
|
||||||
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 <<'EOF'
|
||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
APP_PATH="$(dirname "$(readlink -f "${0}")")"
|
APP_PATH="$(dirname "$(readlink -f "${0}")")"
|
||||||
export LD_LIBRARY_PATH="${APP_PATH}"/usr/lib/:"${LD_LIBRARY_PATH}"
|
export LD_LIBRARY_PATH="${APP_PATH}"/usr/lib/:"${LD_LIBRARY_PATH}"
|
||||||
exec "${APP_PATH}/usr/bin/luanti" "$@"
|
exec "${APP_PATH}/usr/bin/luanti" "$@"
|
||||||
APPRUN
|
EOF
|
||||||
|
|
||||||
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
|
libsndio.so.7.0
|
||||||
libsndio.so.7.0
|
libbsd.so.0
|
||||||
libbsd.so.0
|
libmd.so.0
|
||||||
libmd.so.0
|
|
||||||
libjpeg.so.62
|
libjpeg.so.62
|
||||||
libpng16.so.16
|
libpng16.so.16
|
||||||
libvorbisfile.so.3
|
libvorbisfile.so.3
|
||||||
libogg.so.0
|
libogg.so.0
|
||||||
libvorbis.so.0
|
libvorbis.so.0
|
||||||
libzstd.so.1
|
libzstd.so.1
|
||||||
libsqlite3.so.0
|
libsqlite3.so.0
|
||||||
libleveldb.so.1d
|
libleveldb.so.1d
|
||||||
libsnappy.so.1
|
libsnappy.so.1
|
||||||
)
|
)
|
||||||
|
|
||||||
mkdir -p usr/lib/
|
mkdir -p usr/lib/
|
||||||
for i in "${INCLUDE_LIBS[@]}"; do
|
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
|
# copy our SDL2 into place
|
||||||
|
cp ../../../usr/lib/libSDL2-2.0.so.0 usr/lib/
|
||||||
|
|
||||||
|
# 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 ~
|
# move the appimage to this script's folder
|
||||||
mv Luanti-aarch64.AppImage ../../luanti-5.15.0-aarch64.AppImage
|
mv Luanti-aarch64.AppImage ../../luanti-${VERSION}-aarch64.AppImage
|
||||||
|
|
||||||
# Clean up
|
# clean up
|
||||||
cd ../..
|
cd ../..
|
||||||
|
|
||||||
rm -rf luanti/
|
rm -rf luanti/
|
||||||
|
rm -rf sdl2/
|
||||||
|
rm -rf usr/
|
||||||
rm -rf luajit/
|
rm -rf luajit/
|
||||||
|
|
||||||
echo "Done!"
|
# done :D
|
||||||
|
echo -e "${BOLD}${GREEN}Done!${RESET}"
|
||||||
|
|
|
||||||
94
test.sh
Normal file
94
test.sh
Normal file
|
|
@ -0,0 +1,94 @@
|
||||||
|
#!/bin/bash -e
|
||||||
|
|
||||||
|
# test the AppImage built with build.sh
|
||||||
|
# again, this only works on aarch64
|
||||||
|
|
||||||
|
VERSION="5.16.1"
|
||||||
|
|
||||||
|
BOLD="\x1b[1m"
|
||||||
|
RED="\x1b[31m"
|
||||||
|
GREEN="\x1b[32m"
|
||||||
|
RESET="\x1b[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
|
||||||
|
|
||||||
|
# make sure no other luanti processes are running
|
||||||
|
if [ "$(ps aux | grep luanti | wc -l)" != 1 ]; then
|
||||||
|
echo -e "${BOLD}${RED}No Luanti processes may be running while this script is run.${RESET}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# check if the AppImage even exists
|
||||||
|
echo -e "${BOLD}Checking if AppImage exists...${RESET}"
|
||||||
|
|
||||||
|
if [ ! -f luanti-${VERSION}-aarch64.AppImage ]; then
|
||||||
|
echo -e "${BOLD}${RED}AppImage not found, have you run build.sh?${RESET}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# list of dependencies needed to make the AppImage
|
||||||
|
DEPS=(
|
||||||
|
git
|
||||||
|
g++
|
||||||
|
make
|
||||||
|
ninja-build
|
||||||
|
libc6-dev
|
||||||
|
cmake
|
||||||
|
curl
|
||||||
|
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
|
||||||
|
file
|
||||||
|
)
|
||||||
|
|
||||||
|
# remove the dependencies
|
||||||
|
echo -e "${BOLD}Removing dependencies...${RESET}"
|
||||||
|
|
||||||
|
for d in "${DEPS[@]}"; do
|
||||||
|
apt remove ${d} -y
|
||||||
|
done
|
||||||
|
|
||||||
|
# test the AppImage
|
||||||
|
echo -e "${BOLD}${GREEN}Testing AppImage in 5 seconds${RESET}"
|
||||||
|
sleep 5
|
||||||
|
|
||||||
|
./luanti-${VERSION}-aarch64.AppImage &
|
||||||
|
|
||||||
|
sleep 10
|
||||||
|
|
||||||
|
if [ "$(ps | grep luanti | wc -l)" == 0 ]; then
|
||||||
|
echo -e "${BOLD}${RED}AppImage test failed.${RESET}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# kill luanti
|
||||||
|
pkill -9 luanti
|
||||||
|
|
||||||
|
echo -e "${BOLD}${GREEN}AppImage test sucessful.${RESET}"
|
||||||
|
echo -e "${BOLD}Reinstalling dependencies...${RESET}"
|
||||||
|
|
||||||
|
# reinstall the dependencies
|
||||||
|
for d in "${DEPS[@]}"; do
|
||||||
|
apt-get install -y ${d}
|
||||||
|
done
|
||||||
|
|
||||||
|
exit 0
|
||||||
Loading…
Add table
Add a link
Reference in a new issue