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