-
-
Notifications
You must be signed in to change notification settings - Fork 531
/
get-dependencies_linux.sh
executable file
·134 lines (106 loc) · 4.9 KB
/
get-dependencies_linux.sh
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
#!/bin/bash
# USAGE:
# Execute get-dependencies_linux.sh with 1-2 parameters
# 1.) Specify one of the supported linux distros: ("ubuntu", "fedora", "alpine", "archlinux") REQUIRED
# 2.) Specify a mode: ("build-all" (default), "build-dependencies") OPTIONAL
#
# Example:
# get-dependencies_linux.sh ubuntu build-all
#
if [ -z "$1" ]; then
echo "get-dependencies_linux.sh requires an argument specifying a linux distro: (\"ubuntu\", \"fedora\", \"alpine\", \"archlinux\", \"opensuse-tumbleweed\")"
exit 1
fi
DISTRO="$1"
if ! [[ "$1" =~ ^(ubuntu|fedora|alpine|archlinux|opensuse-tumbleweed)$ ]]; 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
##################
# 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 libsdl2-dev 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
elif [ "${VERSION_PARTS[0]}" -ge "20" ]; then
echo "Installing build-dependencies for Ubuntu 20.x+"
DEBIAN_FRONTEND=noninteractive apt-get -y install cmake git zip unzip gettext asciidoctor libsdl2-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
else
echo "Script does not currently support Ubuntu ${VERSION_PARTS[0]} (${VERSION})"
exit 1
fi
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 SDL2-devel physfs-devel libpng-devel openal-soft-devel libvorbis-devel libogg-devel opus-devel libtheora-devel freetype-devel fribidi-devel harfbuzz-devel libcurl-devel openssl-devel libsodium-devel sqlite-devel
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 sdl2-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
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 sdl2 physfs libpng openal libvorbis libogg opus libtheora xorg-xrandr freetype2 fribidi harfbuzz curl libsodium sqlite
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 libtinygettext0 ruby3.0-rubygem-asciidoctor vulkan-devel
fi
##################
echo "get-dependencies_linux.sh: Done."