1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200
|
#!/bin/bash
# USAGE:
# Execute get-dependencies_linux.sh with 1-2 parameters
# 1.) Specify one of the supported linux distros: ("ubuntu", "fedora", "alpine", "archlinux", "opensuse-tumbleweed", "gentoo", "raspberrypios") REQUIRED
# 2.) Specify a mode: ("build-all" (default), "build-dependencies") OPTIONAL
#
# Example:
# get-dependencies_linux.sh ubuntu build-all
#
set -e
if [ -z "$1" ]; then
echo "get-dependencies_linux.sh requires an argument specifying a linux distro: (\"ubuntu\", \"fedora\", \"alpine\", \"archlinux\", \"opensuse-tumbleweed\", \"gentoo\", \"raspberrypios\", \"debian\")"
exit 1
fi
DISTRO="$1"
if ! [[ "$1" =~ ^(ubuntu|fedora|alpine|archlinux|opensuse-tumbleweed|gentoo|raspberrypios|debian)$ ]]; then
echo "This script does not currently support Linux distro (${DISTRO}). Please see the documentation."
exit 1
fi
MODE="build-all"
if [ -n "$2" ]; then
if ! [[ "$2" =~ ^(build-all|build-dependencies)$ ]]; then
echo "get-dependencies_linux.sh supports the following build modes: (\"build-all\", \"build-dependencies\")"
exit 1
fi
MODE="$2"
fi
##################
# Debian / Raspberry Pi OS
##################
# Package search: https://packages.debian.org/index
if [[ $DISTRO == "raspberrypios" || $DISTRO == "debian" ]]; then
# Get Debian version
VERSION=$(grep -oP '(?<=^VERSION_ID=).+' /etc/os-release | tr -d '"')
echo "Detected OS version: ${VERSION}"
# Split version into parts
VERSION_PARTS=( ${VERSION//./ } )
echo "apt-get -u update"
apt -u update
if [ "${MODE}" == "build-all" ]; then
echo "Installing build-all for Debian"
DEBIAN_FRONTEND=noninteractive apt-get -y install gcc g++ libc-dev dpkg-dev ninja-build pkg-config
fi
if [[ "${VERSION_PARTS[0]}" == "12" || "${VERSION_PARTS[0]}" == "13" ]]; then
echo "Installing build-dependencies for Debian 12 / 13"
DEBIAN_FRONTEND=noninteractive apt -y install cmake git zip unzip gettext asciidoctor libphysfs-dev libpng-dev libopenal-dev libvorbis-dev libogg-dev libopus-dev libtheora-dev libxrandr-dev libfreetype-dev libfribidi-dev libharfbuzz-dev libcurl4-gnutls-dev gnutls-dev libsodium-dev libsqlite3-dev libprotobuf-dev protobuf-compiler libzip-dev
echo "WARN: You will need to compile and install SDL3 from source!"
elif [ "${VERSION_PARTS[0]}" -ge "14" ]; then
echo "Installing build-dependencies for Debian 14+"
DEBIAN_FRONTEND=noninteractive apt -y install cmake git zip unzip gettext asciidoctor libsdl3-dev libphysfs-dev libpng-dev libopenal-dev libvorbis-dev libogg-dev libopus-dev libtheora-dev libxrandr-dev libfreetype-dev libfribidi-dev libharfbuzz-dev libcurl4-gnutls-dev gnutls-dev libsodium-dev libsqlite3-dev libprotobuf-dev protobuf-compiler libzip-dev
else
echo "Script does not currently support Debian ${VERSION_PARTS[0]} (${VERSION})"
exit 1
fi
# Required because of broken CMake config files installed by libzip-dev:
DEBIAN_FRONTEND=noninteractive apt -y install zipcmp zipmerge ziptool
fi
##################
# Ubuntu
##################
# Package search: https://packages.ubuntu.com/search
if [ "${DISTRO}" == "ubuntu" ]; then
# Get Ubuntu version
VERSION=$(grep -oP '(?<=^VERSION_ID=).+' /etc/os-release | tr -d '"')
echo "Detected OS version: ${VERSION}"
# Split version into parts
VERSION_PARTS=( ${VERSION//./ } )
echo "apt-get -u update"
apt-get -u update
if [ "${MODE}" == "build-all" ]; then
echo "Installing build-all for Ubuntu"
DEBIAN_FRONTEND=noninteractive apt-get -y install gcc g++ libc-dev dpkg-dev ninja-build pkg-config
fi
if [ "${VERSION_PARTS[0]}" -eq "18" ]; then
echo "Installing build-dependencies for Ubuntu 18.x"
DEBIAN_FRONTEND=noninteractive apt-get -y install cmake git zip unzip gettext asciidoctor libphysfs-dev libpng-dev libopenal-dev libvorbis-dev libogg-dev libopus-dev libtheora-dev libxrandr-dev libfreetype6-dev libfribidi-dev libharfbuzz-dev libcurl4-gnutls-dev gnutls-dev libsodium-dev libsqlite3-dev libprotobuf-dev protobuf-compiler libzip-dev
echo "WARN: You will need to compile and install SDL3 from source!"
elif [[ "${VERSION_PARTS[0]}" -ge 20 && "${VERSION_PARTS[0]}" -lt 25 ]]; then
echo "Installing build-dependencies for Ubuntu 20.x - 24.x"
DEBIAN_FRONTEND=noninteractive apt-get -y install cmake git zip unzip gettext asciidoctor libphysfs-dev libpng-dev libopenal-dev libvorbis-dev libogg-dev libopus-dev libtheora-dev libxrandr-dev libfreetype-dev libfribidi-dev libharfbuzz-dev libcurl4-gnutls-dev gnutls-dev libsodium-dev libsqlite3-dev libprotobuf-dev protobuf-compiler libzip-dev
echo "WARN: You will need to compile and install SDL3 from source!"
elif [ "${VERSION_PARTS[0]}" -ge "25" ]; then
echo "Installing build-dependencies for Ubuntu 25.x+"
DEBIAN_FRONTEND=noninteractive apt-get -y install cmake git zip unzip gettext asciidoctor libsdl3-dev libphysfs-dev libpng-dev libopenal-dev libvorbis-dev libogg-dev libopus-dev libtheora-dev libxrandr-dev libfreetype-dev libfribidi-dev libharfbuzz-dev libcurl4-gnutls-dev gnutls-dev libsodium-dev libsqlite3-dev libprotobuf-dev protobuf-compiler libzip-dev
else
echo "Script does not currently support Ubuntu ${VERSION_PARTS[0]} (${VERSION})"
exit 1
fi
# Required because of broken CMake config files installed by libzip-dev:
DEBIAN_FRONTEND=noninteractive apt-get -y install zipcmp zipmerge ziptool
fi
##################
# Fedora
##################
# Package search: https://packages.fedoraproject.org/search
if [ "${DISTRO}" == "fedora" ]; then
echo "dnf -y update"
dnf -y update
if [ "${MODE}" == "build-all" ]; then
echo "Installing build-all for Fedora"
dnf -y install gcc gcc-c++ ninja-build
fi
echo "Installing build-dependencies for Fedora"
dnf -y install cmake git p7zip gettext rubygem-asciidoctor SDL3-devel physfs-devel libpng-devel openal-soft-devel libvorbis-devel libogg-devel opus-devel libtheora-devel freetype-devel fribidi-devel harfbuzz-devel libcurl-devel libsodium-devel sqlite-devel protobuf-devel libzip-devel
# Required because of broken CMake config files installed by libzip-dev:
dnf -y install libzip-tools
dnf -y install vulkan-devel glslc
fi
##################
# Alpine
##################
# Package search: https://pkgs.alpinelinux.org/packages
if [ "${DISTRO}" == "alpine" ]; then
if [ "${MODE}" == "build-all" ]; then
echo "Installing build-all for Alpine"
apk add --no-cache build-base ninja gdb
fi
echo "Installing build-dependencies for Alpine"
apk add --no-cache cmake git p7zip gettext asciidoctor sdl3-dev physfs-dev libpng-dev openal-soft-dev libvorbis-dev libogg-dev opus-dev libtheora-dev freetype-dev fribidi-dev harfbuzz-dev curl-dev libsodium-dev sqlite-dev protobuf-dev libzip-dev
fi
##################
# ArchLinux
##################
# Package search: https://archlinux.org/packages/
if [ "${DISTRO}" == "archlinux" ]; then
if [ "${MODE}" == "build-all" ]; then
echo "Installing build-all for ArchLinux"
pacman -S --noconfirm base-devel ninja gdb
fi
echo "Installing build-dependencies for ArchLinux"
pacman -S --noconfirm cmake git p7zip gettext asciidoctor sdl3 physfs libpng openal libvorbis libogg opus libtheora xorg-xrandr freetype2 fribidi harfbuzz curl libsodium sqlite protobuf libzip
fi
##################
# OpenSUSE Tumbleweed
##################
# Package search: https://software.opensuse.org/search
if [ "${DISTRO}" == "opensuse-tumbleweed" ]; then
if [ "${MODE}" == "build-all" ]; then
echo "Installing build-all for OpenSUSE Tumbleweed"
zypper install -y gcc-c++ libc++-devel ninja pkgconf-pkg-config cmake zip git libcurl-devel
fi
echo "Installing build-dependencies for OpenSUSE Tumbleweed"
zypper install -y libSDL2-devel libphysfs-devel libpng16-devel libtheora-devel libvorbis-devel libogg-devel libopus-devel freetype-devel fribidi-devel harfbuzz-devel openal-soft-devel libsodium-devel sqlite3-devel libzip-devel libtinygettext0 ruby3.0-rubygem-asciidoctor vulkan-devel protobuf-devel
fi
##################
# Gentoo
##################
# Package search: https://packages.gentoo.org/
if [ "${DISTRO}" == "gentoo" ]; then
if [ "${MODE}" == "build-all" ]; then
echo "Merge build-all for Gentoo"
emerge dev-build/ninja dev-debug/gdb
fi
echo "Merge build-dependencies for Gentoo"
emerge dev-build/cmake dev-vcs/git dev-ruby/asciidoctor sys-devel/gettext media-libs/libsdl3 dev-games/physfs media-libs/libpng media-libs/libtheora media-libs/libvorbis media-libs/libogg media-libs/opus media-libs/freetype media-libs/harfbuzz dev-libs/fribidi media-libs/openal net-misc/curl dev-libs/libsodium dev-db/sqlite dev-libs/libzip dev-libs/protobuf
fi
##################
echo "get-dependencies_linux.sh: Done."
|