[GLib] Let WebCore know of low power situations
[WebKit-https.git] / Tools / gtk / install-dependencies
1 #!/bin/bash
2
3 # This script needs to be run with root rights.
4 if [ $UID -ne 0 ]; then
5     sudo $0
6     exit 0
7 fi
8
9 function printNotSupportedMessageAndExit() {
10     echo
11     echo "Currently this script only works for distributions supporting apt-get and yum."
12     echo "Please add support for your distribution: http://webkit.org/b/110693"
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     if [ `uname` = "Darwin" ]; then
41        installDependenciesWithBrew
42        exit 0
43     fi
44
45     printNotSupportedMessageAndExit
46 }
47
48 function installDependenciesWithBrew {
49     brew &> /dev/null
50     if [ $? -gt 1 ]; then
51         echo "Please install HomeBrew. Instructions on http://brew.sh"
52         exit 1
53     fi
54
55     brew install autoconf \
56          automake \
57          bison \
58          cmake \
59          enchant \
60          flex \
61          gettext \
62          gobject-introspection \
63          intltool \
64          itstool \
65          libcroco \
66          libgcrypt \
67          libgpg-error \
68          libtasn1 \
69          libtiff \
70          libtool \
71          ninja \
72          pango \
73          pkg-config \
74          sqlite \
75          webp \
76          xz
77 }
78
79 # If the package $1 is available, prints it. Otherwise prints $2.
80 # Useful for handling when a package is renamed on new versions of Debian/Ubuntu.
81 function aptIfElse {
82     if apt-cache show $1 &>/dev/null; then
83         echo $1
84     else
85         echo $2
86     fi
87 }
88
89 function installDependenciesWithApt {
90     # These are dependencies necessary for building WebKitGTK+.
91     packages=" \
92         autoconf \
93         automake \
94         autopoint \
95         autotools-dev \
96         bison \
97         cmake \
98         flex \
99         gawk \
100         geoclue-2.0 \
101         gnome-common \
102         gperf \
103         gtk-doc-tools \
104         intltool \
105         itstool \
106         libatk1.0-dev \
107         libedit-dev \
108         libenchant-dev \
109         libfaad-dev \
110         libffi-dev \
111         $(aptIfElse libgcrypt20-dev libgcrypt11-dev) \
112         libgirepository1.0-dev \
113         libgl1-mesa-dev \
114         libgl1-mesa-glx \
115         libgtk2.0-dev \
116         libgtk-3-dev \
117         libgstreamer1.0-dev \
118         libgstreamer-plugins-bad1.0-dev \
119         libgstreamer-plugins-base1.0-dev \
120         libgudev-1.0-dev \
121         libhyphen-dev \
122         libjpeg-dev \
123         libmount-dev \
124         libmpg123-dev \
125         libnotify-dev \
126         libopus-dev \
127         libpango1.0-dev \
128         $(aptIfElse libpng-dev libpng12-dev) \
129         libpulse-dev \
130         librsvg2-dev \
131         libsecret-1-dev \
132         libsoup2.4-dev \
133         libsqlite3-dev \
134         libsrtp0-dev \
135         libtasn1-6-dev \
136         libtheora-dev \
137         libtool \
138         libvorbis-dev \
139         libvpx-dev \
140         libupower-glib-dev \
141         libwebp-dev \
142         libxcomposite-dev \
143         libxt-dev \
144         libxtst-dev \
145         libxslt1-dev \
146         libwayland-dev \
147         ninja-build \
148         patch \
149         ruby \
150         xfonts-utils"
151
152     # These are dependencies necessary for running tests.
153     packages="$packages \
154         apache2 \
155         curl \
156         dbus-x11 \
157         gdb \
158         libapache2-mod-bw \
159         $(aptIfElse libapache2-mod-php7.0 libapache2-mod-php5) \
160         libcgi-pm-perl \
161         libgpg-error-dev \
162         psmisc \
163         pulseaudio-utils \
164         python-gi \
165         python-psutil \
166         ruby \
167         ruby-json \
168         ruby-highline \
169         weston \
170         xvfb"
171
172     # These are dependencies necessary for building the jhbuild.
173     packages="$packages \
174         git \
175         gobject-introspection \
176         gsettings-desktop-schemas-dev \
177         icon-naming-utils \
178         libcroco3-dev \
179         libcups2-dev \
180         libdrm-dev \
181         libegl1-mesa-dev \
182         libepoxy-dev \
183         libevdev-dev \
184         libexpat1-dev \
185         libgbm-dev \
186         libgles2-mesa-dev \
187         libgnutls28-dev \
188         libgpg-error-dev \
189         libjson-glib-dev \
190         libinput-dev \
191         libmtdev-dev \
192         liborc-0.4-dev \
193         libp11-kit-dev \
194         libpciaccess-dev \
195         libproxy-dev \
196         libssl-dev \
197         libtiff5-dev \
198         libv4l-dev \
199         libxcb-composite0-dev \
200         libxcb-xfixes0-dev \
201         $(aptIfElse libxfont1-dev libxfont-dev) \
202         libxkbfile-dev \
203         libxkbcommon-x11-dev \
204         libtool-bin \
205         libudev-dev \
206         python-dev \
207         ragel \
208         x11proto-bigreqs-dev \
209         x11proto-composite-dev \
210         x11proto-gl-dev \
211         x11proto-input-dev \
212         x11proto-randr-dev \
213         x11proto-resource-dev \
214         x11proto-scrnsaver-dev \
215         x11proto-video-dev \
216         x11proto-xcmisc-dev \
217         x11proto-xf86dri-dev \
218         xfonts-utils \
219         xtrans-dev \
220         xutils-dev \
221         yasm"
222
223     # These are dependencies necessary for using webkit-patch
224     packages="$packages \
225         git-svn \
226         subversion"
227
228     apt-get install $packages
229 }
230
231 function installDependenciesWithPacman {
232     # These are dependencies necessary for building WebKitGTK+.
233     packages=" \
234         autoconf \
235         automake \
236         bison \
237         cmake \
238         libedit \
239         libffi \
240         file \
241         findutils \
242         flex \
243         gawk \
244         gcc \
245         gettext \
246         gnome-common \
247         gperf \
248         grep \
249         groff \
250         gstreamer \
251         gst-plugins-bad \
252         gst-plugins-base-libs \
253         gzip \
254         hyphen \
255         libtool \
256         m4 \
257         make \
258         patch \
259         pkg-config \
260         sed \
261         texinfo \
262         util-linux \
263         which \
264         gtk-doc \
265         intltool \
266         itstool \
267         atk \
268         enchant \
269         faad2 \
270         geoclue \
271         gobject-introspection \
272         mesa \
273         mesa-libgl \
274         gtk2 \
275         gtk3 \
276         libsystemd \
277         libjpeg-turbo \
278         mpg123 \
279         opus \
280         pango \
281         libgcrypt \
282         libnotify \
283         libpng \
284         libpulse \
285         librsvg \
286         libsecret \
287         libsoup \
288         libsrtp \
289         sqlite \
290         libtasn1 \
291         libtheora \
292         libtool \
293         libvorbis \
294         libvpx \
295         libwebp \
296         libxcomposite \
297         libxt \
298         libxslt \
299         libxtst \
300         upower \
301         ninja \
302         ruby \
303         util-linux \
304         xorg-font-utils \
305         wayland"
306
307     # These are dependencies necessary for running tests.
308     # Note: apache-mod_bw is available in the AUR, but the main repos
309     #       could not find ruby-json
310     packages="$packages \
311         apache \
312         curl \
313         gdb \
314         hunspell \
315         hunspell-en \
316         php-apache \
317         libgpg-error \
318         psmisc \
319         pulseaudio \
320         python-gobject \
321         python2-psutil \
322         ruby \
323         ruby-highline \
324         weston \
325         xorg-server-xvfb"
326
327     # These are dependencies necessary for building the jhbuild.
328     # Note: Could not find libegl-mesa
329     packages="$packages \
330         expat \
331         git \
332         gnutls \
333         gobject-introspection \
334         gsettings-desktop-schemas \
335         icon-naming-utils \
336         libcroco \
337         libcups \
338         libdrm \
339         libepoxy \
340         libevdev \
341         libgpg-error \
342         libinput \
343         p11-kit \
344         libpciaccess \
345         libproxy \
346         libtiff \
347         libxfixes \
348         libxfont \
349         libxcb \
350         libxkbfile \
351         libxkbcommon-x11 \
352         mtdev \
353         orc \
354         python2 \
355         python2-lxml \
356         ragel \
357         bigreqsproto \
358         compositeproto \
359         glproto \
360         inputproto \
361         randrproto \
362         resourceproto \
363         scrnsaverproto \
364         videoproto \
365         xcmiscproto \
366         xf86driproto \
367         xorg-font-utils \
368         xorg-util-macros \
369         xtrans \
370         xorg-utils \
371         yasm"
372
373     # These are dependencies necessary for using webkit-patch
374     packages="$packages \
375         svn"
376     pacman -S --needed $packages
377
378     echo "You will also need to follow the instructions on the Arch Wiki to make"
379     echo "'python' call python2 in the webkit folder"
380     echo "https://wiki.archlinux.org/index.php/Python#Dealing_with_version_problem_in_build_scripts"
381 }
382
383 function installDependenciesWithDnf {
384     # These are dependencies necessary for building WebKitGTK+.
385     packages=" \
386         atk-devel \
387         autoconf \
388         automake \
389         bison \
390         cairo-devel \
391         cmake \
392         enchant-devel \
393         flex \
394         gcc-c++ \
395         geoclue2-devel \
396         gettext-devel \
397         gobject-introspection-devel \
398         gperf \
399         gstreamer1-devel \
400         gstreamer1-plugins-bad-free-devel \
401         gstreamer1-plugins-base-devel \
402         gtk-doc \
403         gtk2-devel \
404         gtk3-devel \
405         hyphen-devel \
406         intltool \
407         json-glib-devel \
408         libXt-devel \
409         libXtst-devel \
410         libxslt-devel \
411         libedit-devel \
412         libffi-devel \
413         libgcrypt-devel \
414         libgudev1-devel \
415         libjpeg-turbo-devel \
416         libmount-devel \
417         libnotify-devel \
418         libpng-devel \
419         libsecret-devel \
420         libsoup-devel \
421         libsrtp-devel \
422         libtasn1-devel \
423         libtheora-devel \
424         libv4l-devel \
425         libvorbis-devel \
426         libvpx-devel \
427         libwebp-devel \
428         libwayland-client-devel \
429         libwayland-server-devel \
430         mesa-libGL-devel \
431         ninja-build \
432         openssl-devel \
433         opus-devel \
434         patch \
435         pcre-devel \
436         perl-JSON-PP \
437         perl-Switch \
438         perl-Time-HiRes \
439         perl-version \
440         pulseaudio-libs-devel \
441         python-devel \
442         redhat-rpm-config \
443         ruby \
444         sqlite-devel \
445         upower-devel"
446
447     # These are dependencies necessary for running tests.
448     packages="$packages \
449         curl \
450         dbus-x11 \
451         gdb \
452         hunspell-en \
453         httpd \
454         libgpg-error-devel \
455         mod_bw \
456         mod_ssl \
457         perl-CGI \
458         php \
459         psmisc \
460         pulseaudio-utils \
461         pygobject3-base \
462         python2-psutil \
463         ruby \
464         rubygem-json \
465         rubygem-highline \
466         weston-devel \
467         xorg-x11-server-Xvfb"
468
469     # These are dependencies necessary for building the jhbuild.
470     packages="$packages \
471         cups-devel \
472         docbook-utils \
473         expat-devel \
474         git \
475         gnutls-devel \
476         gobject-introspection \
477         gsettings-desktop-schemas-devel \
478         icon-naming-utils \
479         itstool \
480         libXfont-devel \
481         libcroco-devel \
482         libdrm-devel \
483         libepoxy-devel \
484         libevdev-devel
485         libgpg-error-devel \
486         libinput-devel \
487         libp11-devel \
488         libpciaccess-devel \
489         libproxy-devel \
490         libtiff-devel \
491         libxcb-devel \
492         libxkbfile-devel \
493         libxkbcommon-x11-devel \
494         mesa-libEGL-devel \
495         mtdev-devel \
496         orc-devel \
497         ragel \
498         systemd-devel \
499         xorg-x11-font-utils \
500         xorg-x11-proto-devel \
501         xorg-x11-util-macros \
502         xorg-x11-xtrans-devel \
503         yasm"
504
505     # These are dependencies necessary for using webkit-patch
506     packages="$packages
507         git-svn \
508         subversion"
509
510     dnf install $packages
511 }
512
513 checkInstaller
514