minecraft-pi-docker/scripts/install-dependencies.sh

106 lines
2.5 KiB
Bash
Raw Normal View History

2021-06-17 21:32:24 +00:00
#!/bin/sh
set -e
2023-06-04 03:48:28 +00:00
# Don't Use Sudo When Running As Root
if [ "$(id -u)" -eq 0 ]; then
sudo() {
"$@"
}
fi
2022-06-10 03:10:05 +00:00
# Main Script
run() {
# Add ARM Repository
for arch in "$@"; do
2023-11-24 23:53:16 +00:00
sudo dpkg --add-architecture "$(echo "${arch}" | tr '[:upper:]' '[:lower:]')"
2022-06-10 03:10:05 +00:00
done
# Update APT
sudo apt-get update
sudo apt-get dist-upgrade -y
# Install Everything In One Go
PKG_QUEUE=''
queue_pkg() {
PKG_QUEUE="${PKG_QUEUE} $@"
}
# Build System
2022-03-09 23:47:31 +00:00
queue_pkg \
2022-06-10 03:10:05 +00:00
git \
cmake \
2023-10-20 01:50:39 +00:00
ninja-build \
python3 \
python3-venv
2022-03-10 02:23:41 +00:00
2022-06-10 03:10:05 +00:00
# Host Dependencies Needed For Compile
2022-03-10 02:23:41 +00:00
queue_pkg \
2022-07-30 02:13:03 +00:00
libwayland-bin
2022-03-10 02:23:41 +00:00
2022-06-10 03:10:05 +00:00
# Architecture-Specific Dependencies
architecture_specific_pkg() {
# Compiler
2024-01-23 23:20:14 +00:00
queue_pkg crossbuild-essential-$1
2022-06-10 03:10:05 +00:00
# Dependencies
queue_pkg \
libopenal-dev:$1
# GLFW Dependencies
queue_pkg \
libwayland-dev:$1 \
libxkbcommon-dev:$1 \
libx11-dev:$1 \
libxcursor-dev:$1 \
libxi-dev:$1 \
libxinerama-dev:$1 \
libxrandr-dev:$1 \
libxext-dev:$1
# Zenity Dependencies
queue_pkg \
libgtk-3-dev:$1 \
libglib2.0-dev:$1
}
for arch in "$@"; do
2023-11-24 23:37:08 +00:00
architecture_specific_pkg "$(echo "${arch}" | tr '[:upper:]' '[:lower:]')"
2022-06-10 03:10:05 +00:00
done
2022-07-11 22:30:49 +00:00
# AppStream Verification
queue_pkg \
appstream
2022-06-10 03:10:05 +00:00
# Install Queue
sudo apt-get install --no-install-recommends -y ${PKG_QUEUE}
# Install appimagetool
sudo rm -rf /opt/squashfs-root /opt/appimagetool.AppDir
sudo rm -f /opt/appimagetool /usr/local/bin/appimagetool
case "$(dpkg-architecture -qDEB_BUILD_ARCH)" in
'armhf') APPIMAGE_ARCH='armhf';;
'arm64') APPIMAGE_ARCH='aarch64';;
'i386') APPIMAGE_ARCH='i686';;
'amd64') APPIMAGE_ARCH='x86_64';;
esac
sudo mkdir -p /opt
sudo wget -O /opt/appimagetool "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-${APPIMAGE_ARCH}.AppImage"
sudo chmod +x /opt/appimagetool
# Workaround AppImage Issues With Docker
cd /opt
sudo sed -i '0,/AI\x02/{s|AI\x02|\x00\x00\x00|}' ./appimagetool
# Extract
sudo ./appimagetool --appimage-extract
sudo rm -f ./appimagetool
# Link
sudo mv ./squashfs-root ./appimagetool.AppDir
sudo ln -s /opt/appimagetool.AppDir/AppRun /usr/local/bin/appimagetool
2022-06-10 03:10:05 +00:00
}
2022-03-09 23:47:31 +00:00
2022-06-10 03:10:05 +00:00
# Run
if [ "$#" -lt 1 ]; then
run "$(dpkg-architecture -qDEB_BUILD_ARCH)"
else
run "$@"
fi