[WPE] Enable web process sandbox
[WebKit-https.git] / Tools / wpe / install-dependencies
1 #!/usr/bin/env bash
2
3 # This script needs to be run with root rights.
4 if [ $UID -ne 0 ]; then
5     sudo $0
6     exit $?
7 fi
8
9 function printNotSupportedMessageAndExit() {
10     echo
11     echo "Currently this script only works for distributions supporting apt-get, dnf or pacman."
12     echo "Please add support for your distribution and submit the patch at https://bugs.webkit.org"
13     echo
14     exit 1
15 }
16
17 function checkInstaller {
18     # apt-get - Debian based distributions
19     apt-get --version &> /dev/null
20     if [ $? -eq 0 ]; then
21         installDependenciesWithApt
22         exit 0
23     fi
24
25     # dnf - Fedora
26     dnf --version &> /dev/null
27     if [ $? -eq 0 ]; then
28         installDependenciesWithDnf
29         exit 0
30     fi
31
32     # pacman - Arch Linux
33     # pacman --version and pacman --help both return non-0
34     pacman -Ss &> /dev/null
35     if [ $? -eq 0 ]; then
36         installDependenciesWithPacman
37         exit 0
38     fi
39
40     printNotSupportedMessageAndExit
41 }
42
43
44 # If the package $1 is available, prints it. Otherwise prints $2.
45 # Useful for handling when a package is renamed on new versions of Debian/Ubuntu.
46 function aptIfElse {
47     if apt-cache show $1 &>/dev/null; then
48         echo $1
49     else
50         echo $2
51     fi
52 }
53
54 function installDependenciesWithApt {
55     # These are dependencies necessary for building WPE.
56     packages=" \
57         autoconf \
58         automake \
59         autopoint \
60         autotools-dev \
61         bubblewrap \
62         cmake \
63         g++ \
64         gawk \
65         gcc \
66         gperf \
67         gtk-doc-tools \
68         intltool \
69         itstool \
70         libasound2-dev \
71         libevent-dev \
72         libgbm-dev \
73         libgnutls28-dev \
74         libgstreamer1.0-dev \
75         libgstreamer-plugins-bad1.0-dev \
76         libgstreamer-plugins-base1.0-dev \
77         libicu-dev \
78         libjpeg-dev \
79         libfile-copy-recursive-perl \
80         $(aptIfElse libpng-dev libpng12-dev) \
81         libseccomp-dev \
82         libsqlite3-dev \
83         libtasn1-6-dev \
84         libtool \
85         libwebp-dev \
86         libxml2-dev \
87         libxslt1-dev \
88         ninja-build \
89         patch \
90         pkg-config \
91         ruby \
92         zlib1g-dev"
93
94     # These are dependencies necessary for running tests.
95     packages="$packages \
96         apache2 \
97         curl \
98         gdb \
99         libapache2-mod-bw \
100         libapache2-mod-php \
101         php-json \
102         libcgi-pm-perl \
103         psmisc \
104         pulseaudio-utils \
105         python-gi \
106         python-psutil \
107         ruby \
108         ruby-highline \
109         ruby-json"
110
111     # These are dependencies necessary for building the jhbuild.
112     packages="$packages \
113         git \
114         gsettings-desktop-schemas-dev \
115         libegl1-mesa-dev \
116         libexpat1-dev \
117         libgles2-mesa-dev \
118         libluajit-5.1-dev \
119         libmount-dev \
120         libopus-dev \
121         liborc-0.4-dev \
122         libproxy-dev \
123         libpsl-dev \
124         libpulse-dev \
125         libsrtp0-dev \
126         libtheora-dev \
127         libtool-bin \
128         libvorbis-dev \
129         libvpx-dev \
130         libxcb-xkb-dev \
131         libxkbcommon-dev \
132         libxml-libxml-perl \
133         libxrandr-dev \
134         libwayland-dev \
135         luajit \
136         python3-setuptools \
137         yasm"
138
139     # These are dependencies necessary for using webkit-patch
140     packages="$packages \
141         git-svn \
142         subversion"
143
144     apt-get install $packages
145 }
146
147 function installDependenciesWithPacman {
148     # These are dependencies necessary for building WPE.
149     packages=" \
150         alsa-lib \
151         autoconf \
152         automake \
153         bubblewrap \
154         cmake \
155         file \
156         findutils \
157         gawk \
158         gcc \
159         gnutls \
160         gperf \
161         gtk-doc \
162         grep \
163         groff \
164         gstreamer \
165         gst-plugins-bad \
166         gst-plugins-base-libs \
167         gzip \
168         icu \
169         intltool \
170         itstool \
171         libevent \
172         libjpeg-turbo \
173         libpng \
174         libseccomp \
175         libtasn1 \
176         libtool \
177         libwebp \
178         libxml2 \
179         libxslt \
180         m4 \
181         make \
182         ninja \
183         patch \
184         perl-file-copy-recursive \
185         pkg-config \
186         ruby
187         sed \
188         sqlite \
189         texinfo \
190         which \
191         zlib"
192
193     # These are dependencies necessary for running tests.
194     # Note: apache-mod_bw and ruby-json is available in the AUR
195     packages="$packages \
196         apache \
197         curl \
198         gdb \
199         perl-cgi \
200         php-apache \
201         psmisc \
202         pulseaudio \
203         python2 \
204         python2-gobject \
205         python2-lxml \
206         python2-psutil \
207         ruby \
208         ruby-highline"
209
210     # These are dependencies necessary for building the jhbuild.
211     packages="$packages \
212         expat \
213         git \
214         gsettings-desktop-schemas \
215         libproxy \
216         libpsl \
217         libpulse \
218         libsrtp \
219         libtheora \
220         libv4l-dev \
221         libvorbis \
222         libvpx \
223         libxcb \
224         libxkbcommon \
225         luajit \
226         mesa \
227         mesa-libgl \
228         opus \
229         orc \
230         perl-xml-libxml \
231         python3-setuptools \
232         util-linux \
233         v4l-utils \
234         xorg-xrandr \
235         wayland \
236         yasm"
237
238     # These are dependencies necessary for using webkit-patch
239     packages="$packages \
240         svn"
241     pacman -S --needed $packages
242
243     echo "You will also need to follow the instructions on the Arch Wiki to make"
244     echo "'python' call python2 in the webkit folder"
245     echo "https://wiki.archlinux.org/index.php/Python#Dealing_with_version_problem_in_build_scripts"
246 }
247
248 function installDependenciesWithDnf {
249     # These are dependencies necessary for building WebKitWPE.
250     packages=" \
251         autoconf \
252         automake \
253         alsa-lib-devel \
254         bubblewrap \
255         cmake \
256         gcc-c++ \
257         gnutls-devel \
258         gperf \
259         gstreamer1-devel \
260         gstreamer1-plugins-bad-free-devel \
261         gstreamer1-plugins-base-devel \
262         gtk-doc \
263         intltool \
264         itstool \
265         libevent-devel \
266         libicu-devel \
267         libjpeg-turbo-devel \
268         libpng-devel \
269         libseccomp-devel \
270         libtasn1-devel \
271         libtool \
272         libwebp-devel \
273         libxml2-devel \
274         libxslt-devel \
275         ninja-build \
276         patch \
277         perl-File-Copy-Recursive \
278         perl-JSON-PP \
279         perl-Time-HiRes \
280         perl-version \
281         ruby \
282         sqlite-devel \
283         zlib-devel"
284
285     # These are dependencies necessary for running tests.
286     packages="$packages \
287         curl \
288         gdb \
289         httpd \
290         mod_bw \
291         mod_ssl \
292         perl-CGI \
293         php \
294         php-json \
295         psmisc \
296         pulseaudio-utils \
297         python2-psutil \
298         python-gobject-base \
299         ruby \
300         rubygem-highline \
301         rubygem-json"
302
303     # These are dependencies necessary for building the jhbuild.
304     packages="$packages \
305         expat-devel \
306         git \
307         gsettings-desktop-schemas-devel \
308         libmount-devel \
309         libproxy-devel \
310         libpsl-devel \
311         libsrtp-devel \
312         libtheora-devel \
313         libv4l-devel \
314         libvorbis-devel \
315         libvpx-devel \
316         libxcb-devel \
317         libxkbcommon-devel \
318         libXrandr-devel \
319         luajit \
320         luajit-devel \
321         mesa-libGLES-devel \
322         mesa-libEGL-devel \
323         opus-devel \
324         orc-devel \
325         perl-XML-LibXML \
326         pulseaudio-libs-devel \
327         python3-setuptools \
328         wayland-devel \
329         yasm"
330
331     # These are dependencies necessary for using webkit-patch
332     packages="$packages
333         git-svn \
334         subversion"
335
336     dnf install $packages
337 }
338
339 checkInstaller