-
-
Notifications
You must be signed in to change notification settings - Fork 19.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a script to install Linux dependencies for building [ci skip]
- Loading branch information
Showing
1 changed file
with
241 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,241 @@ | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
IFS=$'\n\t' | ||
|
||
print_info() { | ||
echo -e "\e[1m$1\e[0m" | ||
} | ||
|
||
print_success() { | ||
echo -e "\e[1;92m$1\e[0m" | ||
} | ||
|
||
print_warning() { | ||
echo -e "\e[1;93mWARNING: \e[22m$1\e[0m" | ||
} | ||
|
||
print_error() { | ||
echo -e "\e[1;91mERROR: \e[22m$1\e[0m" | ||
} | ||
|
||
# The detection below also covers derivatives such as Linux Mint and Manjaro. | ||
if [[ -f "/etc/alpine-release" ]]; then | ||
distribution="alpine" | ||
distribution_name="\e[94mAlpine" | ||
elif [[ -f "/etc/arch-release" ]]; then | ||
distribution="arch" | ||
distribution_name="\e[96mArch Linux" | ||
elif [[ -f "/etc/fedora-release" ]]; then | ||
distribution="fedora" | ||
distribution_name="\e[94mFedora" | ||
elif [[ -f "/etc/gentoo-release" ]]; then | ||
distribution="gentoo" | ||
distribution_name="\e[95mGentoo" | ||
elif [[ -f "/etc/mageia-release" ]]; then | ||
distribution="mageia" | ||
distribution_name="\e[94mMageia" | ||
elif [[ -f "/etc/SuSE-release" ]]; then | ||
distribution="opensuse" | ||
distribution_name="\e[92mopenSUSE" | ||
elif [[ -f "/etc/solus-release" ]]; then | ||
distribution="solus" | ||
distribution_name="\e[96mSolus" | ||
elif [[ -f "/etc/lsb-release" ]]; then | ||
# Check for lsb-release last as distributions like Mageia also have this file. | ||
# Ubuntu must be checked before checking for Debian as Ubuntu also has `/etc/debian_version`. | ||
distribution="ubuntu" | ||
distribution_name="\e[38;5;208mUbuntu" | ||
elif [[ -f "/etc/debian_version" ]]; then | ||
distribution="debian" | ||
distribution_name="\e[91mDebian" | ||
elif [[ "$(uname -s)" == "FreeBSD" ]]; then | ||
distribution="freebsd" | ||
distribution_name="\e[91mFreeBSD" | ||
elif [[ "$(uname -s)" == "OpenBSD" ]]; then | ||
distribution="openbsd" | ||
distribution_name="\e[93mOpenBSD" | ||
elif [[ "$(uname -s)" == "FreeBSD" ]]; then | ||
distribution="netbsd" | ||
distribution_name="\e[38;5;208mNetBSD" | ||
else | ||
print_error "Couldn't detect your Linux/*BSD distribution. No dependencies have been installed.\n You'll have to install dependencies manually using your distribution's package manager:\n\n https://docs.godotengine.org/en/latest/contributing/development/compiling/compiling_for_linuxbsd.html" | ||
exit 1 | ||
fi | ||
|
||
print_info "Detected Linux/*BSD distribution: $distribution_name" | ||
|
||
if [[ -n "$(command -v sudo)" ]]; then | ||
# Use `sudo` when needed. | ||
sudo="sudo" | ||
else | ||
# Don't use `sudo`. | ||
sudo="" | ||
fi | ||
|
||
print_info "Installing dependencies... (you may be prompted for your administrator password)" | ||
|
||
case "$distribution" in | ||
alpine) | ||
$sudo apk add \ | ||
scons \ | ||
pkgconf \ | ||
gcc \ | ||
g++ \ | ||
libx11-dev \ | ||
libxcursor-dev \ | ||
libxinerama-dev \ | ||
libxi-dev \ | ||
libxrandr-dev \ | ||
mesa-dev \ | ||
libexecinfo-dev \ | ||
eudev-dev \ | ||
alsa-lib-dev \ | ||
pulseaudio-dev | ||
;; | ||
|
||
arch) | ||
$sudo pacman -Sy --noconfirm --needed \ | ||
scons \ | ||
pkgconf \ | ||
gcc \ | ||
libxcursor \ | ||
libxinerama \ | ||
libxi \ | ||
libxrandr \ | ||
wayland-utils \ | ||
mesa \ | ||
glu \ | ||
alsa-lib \ | ||
pulseaudio | ||
;; | ||
|
||
debian | ubuntu) | ||
export DEBIAN_FRONTEND="noninteractive" | ||
$sudo apt-get update | ||
$sudo apt-get install -y \ | ||
build-essential \ | ||
scons \ | ||
pkg-config \ | ||
libx11-dev \ | ||
libxcursor-dev \ | ||
libxinerama-dev \ | ||
libgl1-mesa-dev \ | ||
libglu1-mesa-dev \ | ||
libasound2-dev \ | ||
libpulse-dev \ | ||
libudev-dev \ | ||
libxi-dev \ | ||
libxrandr-dev \ | ||
libwayland-dev | ||
;; | ||
|
||
fedora) | ||
$sudo dnf install -y \ | ||
scons \ | ||
pkgconfig \ | ||
libX11-devel \ | ||
libXcursor-devel \ | ||
libXrandr-devel \ | ||
libXinerama-devel \ | ||
libXi-devel \ | ||
wayland-devel \ | ||
mesa-libGL-devel \ | ||
mesa-libGLU-devel \ | ||
alsa-lib-devel \ | ||
pulseaudio-libs-devel \ | ||
libudev-devel \ | ||
gcc-c++ \ | ||
libstdc++-static \ | ||
libatomic-static | ||
;; | ||
|
||
freebsd) | ||
$sudo pkg install \ | ||
py37-scons \ | ||
pkgconf \ | ||
xorg-libraries \ | ||
libXcursor \ | ||
libXrandr \ | ||
libXi \ | ||
xorgproto \ | ||
libGLU \ | ||
alsa-lib \ | ||
pulseaudio | ||
;; | ||
|
||
gentoo) | ||
$sudo emerge -an \ | ||
dev-util/scons \ | ||
x11-libs/libX11 \ | ||
x11-libs/libXcursor \ | ||
x11-libs/libXinerama \ | ||
x11-libs/libXi \ | ||
media-libs/mesa \ | ||
media-libs/glu \ | ||
media-libs/alsa-lib \ | ||
media-sound/pulseaudio | ||
;; | ||
|
||
mageia) | ||
$sudo urpmi \ | ||
scons \ | ||
task-c++-devel \ | ||
pkgconfig \ | ||
"pkgconfig(alsa)" \ | ||
"pkgconfig(glu)" \ | ||
"pkgconfig(libpulse)" \ | ||
"pkgconfig(udev)" \ | ||
"pkgconfig(x11)" \ | ||
"pkgconfig(xcursor)" \ | ||
"pkgconfig(xinerama)" \ | ||
"pkgconfig(xi)" \ | ||
"pkgconfig(xrandr)" | ||
;; | ||
|
||
netbsd) | ||
$sudo pkg_add \ | ||
pkg-config \ | ||
py37-scons | ||
;; | ||
|
||
openbsd) | ||
$sudo pkg_add \ | ||
python \ | ||
scons \ | ||
llvm | ||
;; | ||
|
||
opensuse) | ||
$sudo zypper install \ | ||
scons \ | ||
pkgconfig \ | ||
libX11-devel \ | ||
libXcursor-devel \ | ||
libXrandr-devel \ | ||
libXinerama-devel \ | ||
libXi-devel \ | ||
Mesa-libGL-devel \ | ||
alsa-devel \ | ||
libpulse-devel \ | ||
libudev-devel \ | ||
gcc-c++ \ | ||
libGLU1 | ||
;; | ||
|
||
solus) | ||
$sudo eopkg install -c \ | ||
system.devel \ | ||
scons \ | ||
libxcursor-devel \ | ||
libxinerama-devel \ | ||
libxi-devel \ | ||
libxrandr-devel \ | ||
mesalib-devel \ | ||
libglu \ | ||
alsa-lib-devel \ | ||
pulseaudio-devel | ||
;; | ||
esac | ||
|
||
# shellcheck disable=SC2016 | ||
print_success 'Dependencies successfully installed! You can now build Godot using the `scons` command.' |