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-11-15 20:26:33 +00:00
|
|
|
# Setup Backports
|
|
|
|
CODENAME="$(. /etc/os-release && echo "${VERSION_CODENAME}")"
|
|
|
|
BACKPORTS=''
|
|
|
|
if [ "${CODENAME}" = 'bullseye' ]; then
|
|
|
|
BACKPORTS="${CODENAME}-backports"
|
|
|
|
echo "deb http://deb.debian.org/debian ${BACKPORTS} main" | sudo tee "/etc/apt/sources.list.d/${BACKPORTS}.list" > /dev/null
|
|
|
|
BACKPORTS="/${BACKPORTS}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# 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
|
|
|
|
|
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 \
|
2024-11-15 20:26:33 +00:00
|
|
|
"cmake${BACKPORTS}" \
|
2023-10-20 01:50:39 +00:00
|
|
|
ninja-build \
|
|
|
|
python3 \
|
2024-06-15 12:52:15 +00:00
|
|
|
python3-venv \
|
2024-11-15 20:26:33 +00:00
|
|
|
"python3-tomli${BACKPORTS}" \
|
2024-06-15 12:52:15 +00:00
|
|
|
`# 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" \
|
2024-11-22 02:45:57 +00:00
|
|
|
`# QEMU Dependencies` \
|
2024-06-15 12:52:15 +00:00
|
|
|
"libglib2.0-dev:$1" \
|
2024-11-22 09:32:06 +00:00
|
|
|
`# ImGui Dependencies` \
|
|
|
|
"libopengl-dev:$1" \
|
2024-06-15 12:52:15 +00:00
|
|
|
`# AppStream Verification` \
|
2022-07-11 22:30:49 +00:00
|
|
|
appstream
|
|
|
|
|
2022-07-04 20:44:00 +00:00
|
|
|
# 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
|
2022-07-04 20:44:00 +00:00
|
|
|
'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
|
2022-07-04 20:44:00 +00:00
|
|
|
# Extract
|
2024-06-15 12:52:15 +00:00
|
|
|
cd /opt
|
|
|
|
sudo ./appimagetool --appimage-extract > /dev/null
|
2022-07-04 20:44:00 +00:00
|
|
|
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() {
|
2024-10-20 21:09:15 +00:00
|
|
|
install_pkg \
|
2024-06-15 12:52:15 +00:00
|
|
|
"libc6:$1" \
|
2024-06-15 14:19:18 +00:00
|
|
|
"libstdc++6:$1" \
|
2024-06-15 12:52:15 +00:00
|
|
|
"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
|
|
|
|
}
|
|
|
|
|
|
|
|
# Install Packages
|
|
|
|
"run_${MODE}" "${ARCH}"
|