Update ANGLE
[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         libwoff-dev \
87         libxml2-dev \
88         libxslt1-dev \
89         ninja-build \
90         patch \
91         pkg-config \
92         ruby \
93         zlib1g-dev"
94
95     # These are dependencies necessary for running tests.
96     packages="$packages \
97         apache2 \
98         curl \
99         gdb \
100         libapache2-mod-bw \
101         libapache2-mod-php \
102         php-json \
103         libcgi-pm-perl \
104         psmisc \
105         pulseaudio-utils \
106         python-gi \
107         python-psutil \
108         ruby \
109         ruby-highline \
110         ruby-json"
111
112     # These are dependencies necessary for building the jhbuild.
113     packages="$packages \
114         git \
115         gsettings-desktop-schemas-dev \
116         libegl1-mesa-dev \
117         libexpat1-dev \
118         libgles2-mesa-dev \
119         libluajit-5.1-dev \
120         libmount-dev \
121         libopus-dev \
122         liborc-0.4-dev \
123         libproxy-dev \
124         libpsl-dev \
125         libpulse-dev \
126         libsrtp2-dev \
127         libtheora-dev \
128         libtool-bin \
129         libvorbis-dev \
130         libvpx-dev \
131         libxcb-xkb-dev \
132         libxkbcommon-dev \
133         libxml-libxml-perl \
134         libxrandr-dev \
135         libwayland-dev \
136         luajit \
137         python3-setuptools \
138         yasm"
139
140     # These are dependencies necessary for using webkit-patch
141     packages="$packages \
142         git-svn \
143         subversion"
144
145     apt-get install $packages
146 }
147
148 function installDependenciesWithPacman {
149     # These are dependencies necessary for building WPE.
150     packages=" \
151         alsa-lib \
152         autoconf \
153         automake \
154         bubblewrap \
155         cmake \
156         file \
157         findutils \
158         gawk \
159         gcc \
160         gnutls \
161         gperf \
162         gtk-doc \
163         grep \
164         groff \
165         gstreamer \
166         gst-plugins-bad \
167         gst-plugins-base-libs \
168         gzip \
169         icu \
170         intltool \
171         itstool \
172         libevent \
173         libjpeg-turbo \
174         libpng \
175         libseccomp \
176         libtasn1 \
177         libtool \
178         libwebp \
179         libxml2 \
180         libxslt \
181         m4 \
182         make \
183         ninja \
184         patch \
185         perl-file-copy-recursive \
186         pkg-config \
187         ruby
188         sed \
189         sqlite \
190         texinfo \
191         which \
192         zlib \
193         woff2"
194
195     # These are dependencies necessary for running tests.
196     # Note: apache-mod_bw, ruby-json and ruby-highline are available in the AUR
197     packages="$packages \
198         apache \
199         curl \
200         gdb \
201         perl-cgi \
202         php-apache \
203         psmisc \
204         pulseaudio \
205         python2 \
206         python2-gobject \
207         python2-lxml \
208         python2-psutil \
209         ruby"
210
211     # These are dependencies necessary for building the jhbuild.
212     packages="$packages \
213         expat \
214         git \
215         gsettings-desktop-schemas \
216         libproxy \
217         libpsl \
218         libpulse \
219         libsrtp \
220         libtheora \
221         libvorbis \
222         libvpx \
223         libxcb \
224         libxkbcommon \
225         luajit \
226         mesa \
227         mesa-libgl \
228         opus \
229         orc \
230         perl-xml-libxml \
231         python-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         cat <<-EOF
244
245 The following packages are available from AUR, and needed for running tests:
246
247     apache-mod_bw ruby-json ruby-highline
248
249 Instructions on how to use the AUR can be found on the Arch Wiki:
250
251     https://wiki.archlinux.org/index.php/Arch_User_Repository
252
253 You will also need to follow the instructions on the wiki to make 'python'
254 call python2 in the WebKit folder:
255
256     https://wiki.archlinux.org/index.php/Python#Dealing_with_version_problem_in_build_scripts
257
258 Alternatively, you may use a Python 2.x virtualenv while hacking on WPE:
259
260     https://wiki.archlinux.org/index.php/Python/Virtual_environment
261
262 EOF
263 }
264
265 function installDependenciesWithDnf {
266     # These are dependencies necessary for building WebKitWPE.
267     packages=" \
268         autoconf \
269         automake \
270         alsa-lib-devel \
271         bubblewrap \
272         cmake \
273         gcc-c++ \
274         gnutls-devel \
275         gperf \
276         gstreamer1-devel \
277         gstreamer1-plugins-bad-free-devel \
278         gstreamer1-plugins-base-devel \
279         gtk-doc \
280         intltool \
281         itstool \
282         libevent-devel \
283         libicu-devel \
284         libjpeg-turbo-devel \
285         libpng-devel \
286         libseccomp-devel \
287         libtasn1-devel \
288         libtool \
289         libwebp-devel \
290         libxml2-devel \
291         libxslt-devel \
292         ninja-build \
293         patch \
294         perl-File-Copy-Recursive \
295         perl-JSON-PP \
296         perl-Time-HiRes \
297         perl-version \
298         ruby \
299         sqlite-devel \
300         zlib-devel"
301
302     # These are dependencies necessary for running tests.
303     packages="$packages \
304         curl \
305         gdb \
306         httpd \
307         mod_bw \
308         mod_ssl \
309         perl-CGI \
310         php \
311         php-json \
312         psmisc \
313         pulseaudio-utils \
314         python2-psutil \
315         python-gobject-base \
316         ruby \
317         rubygem-highline \
318         rubygem-json"
319
320     # These are dependencies necessary for building the jhbuild.
321     packages="$packages \
322         expat-devel \
323         git \
324         gsettings-desktop-schemas-devel \
325         libmount-devel \
326         libproxy-devel \
327         libpsl-devel \
328         libsrtp-devel \
329         libtheora-devel \
330         libv4l-devel \
331         libvorbis-devel \
332         libvpx-devel \
333         libxcb-devel \
334         libxkbcommon-devel \
335         libXrandr-devel \
336         luajit \
337         luajit-devel \
338         mesa-libGLES-devel \
339         mesa-libEGL-devel \
340         opus-devel \
341         orc-devel \
342         perl-XML-LibXML \
343         pulseaudio-libs-devel \
344         python3-setuptools \
345         wayland-devel \
346         woff2-devel \
347         yasm"
348
349     # These are dependencies necessary for using webkit-patch
350     packages="$packages
351         git-svn \
352         subversion"
353
354     dnf install $packages
355 }
356
357 checkInstaller