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

99 lines
2.4 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
2024-06-15 12:52:15 +00:00
# Run APT
install_pkg() {
sudo apt-get install --no-install-recommends -y "$@"
}
2022-06-10 03:10:05 +00:00
2024-06-15 12:52:15 +00:00
# Build Dependencies
run_build() {
install_pkg \
`# Build System` \
2022-06-10 03:10:05 +00:00
git \
cmake \
2023-10-20 01:50:39 +00:00
ninja-build \
python3 \
2024-06-15 12:52:15 +00:00
python3-venv \
`# Host Dependencies Needed For Compile` \
libwayland-bin \
`# Compiler` \
"crossbuild-essential-$1" \
`# Main Dependencies` \
"libopenal-dev:$1" \
`# GLFW Dependencies` \
"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` \
"libgtk-3-dev:$1" \
"libglib2.0-dev:$1" \
`# AppStream Verification` \
2022-07-11 22:30:49 +00:00
appstream
# Install appimagetool
2024-06-15 12:52:15 +00:00
sudo rm -rf /opt/squashfs-root /opt/appimagetool /usr/local/bin/appimagetool
case "$(dpkg --print-architecture)" 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
2024-06-15 12:52:15 +00:00
sudo ./scripts/fix-appimage-for-docker.sh /opt/appimagetool
# Extract
2024-06-15 12:52:15 +00:00
cd /opt
sudo ./appimagetool --appimage-extract > /dev/null
sudo rm -f ./appimagetool
# Link
2024-06-15 12:52:15 +00:00
sudo mv ./squashfs-root ./appimagetool
sudo ln -s /opt/appimagetool/AppRun /usr/local/bin/appimagetool
2022-06-10 03:10:05 +00:00
}
2022-03-09 23:47:31 +00:00
2024-06-15 12:52:15 +00:00
# Test Dependencies
run_test() {
sudo apt-get install --no-install-recommends -y \
"libc6:$1" \
"libopenal1:$1" \
"libglib2.0-0:$1"
}
# Example Mods Dependencies
run_example_mods() {
install_pkg \
cmake \
ninja-build \
g++-arm-linux-gnueabihf \
gcc-arm-linux-gnueabihf
}
# Variables
MODE="$1"
ARCH="$(echo "$2" | tr '[:upper:]' '[:lower:]')"
# Add ARM Repository
sudo dpkg --add-architecture "${ARCH}"
# Update APT
sudo apt-get update
sudo apt-get dist-upgrade -y
# Install Packages
"run_${MODE}" "${ARCH}"