006766c50cf0ecdb66778ad56cc61fc685d40050
[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          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         liborc-0.4-dev \
188         libp11-kit-dev \
189         libpciaccess-dev \
190         libproxy-dev \
191         libssl-dev \
192         libtiff5-dev \
193         libv4l-dev \
194         libxcb-composite0-dev \
195         libxcb-xfixes0-dev \
196         $(aptIfElse libxfont1-dev libxfont-dev) \
197         libxkbfile-dev \
198         libtool-bin \
199         libudev-dev \
200         python-dev \
201         ragel \
202         x11proto-bigreqs-dev \
203         x11proto-composite-dev \
204         x11proto-gl-dev \
205         x11proto-input-dev \
206         x11proto-randr-dev \
207         x11proto-resource-dev \
208         x11proto-scrnsaver-dev \
209         x11proto-video-dev \
210         x11proto-xcmisc-dev \
211         x11proto-xf86dri-dev \
212         xfonts-utils \
213         xtrans-dev \
214         xutils-dev \
215         yasm"
216
217     # These are dependencies necessary for using webkit-patch
218     packages="$packages \
219         git-svn \
220         subversion"
221
222     apt-get install $packages
223 }
224
225 function installDependenciesWithPacman {
226     # These are dependencies necessary for building WebKitGTK+.
227     packages=" \
228         autoconf \
229         automake \
230         bison \
231         cmake \
232         libedit \
233         file \
234         findutils \
235         flex \
236         gawk \
237         gcc \
238         gettext \
239         gnome-common \
240         gperf \
241         grep \
242         groff \
243         gstreamer \
244         gst-plugins-base-libs \
245         gzip \
246         hyphen \
247         libtool \
248         m4 \
249         make \
250         patch \
251         pkg-config \
252         sed \
253         texinfo \
254         util-linux \
255         which \
256         gtk-doc \
257         intltool \
258         itstool \
259         atk \
260         enchant \
261         faad2 \
262         geoclue \
263         gobject-introspection \
264         mesa \
265         mesa-libgl \
266         gtk2 \
267         gtk3 \
268         libsystemd \
269         libjpeg-turbo \
270         mpg123 \
271         opus \
272         pango \
273         libgcrypt \
274         libnotify \
275         libpng \
276         libpulse \
277         librsvg \
278         libsecret \
279         libsoup \
280         libsrtp \
281         sqlite \
282         libtheora \
283         libtool \
284         libvorbis \
285         libvpx \
286         libwebp \
287         libxcomposite \
288         libxt \
289         libxslt \
290         libxtst \
291         ninja \
292         ruby \
293         util-linux \
294         xorg-font-utils \
295         wayland"
296
297     # These are dependencies necessary for running tests.
298     # Note: apache-mod_bw is available in the AUR, but the main repos
299     #       could not find ruby-json
300     packages="$packages \
301         apache \
302         curl \
303         gdb \
304         hunspell \
305         hunspell-en \
306         php-apache \
307         libgpg-error \
308         psmisc \
309         pulseaudio \
310         python-gobject \
311         python2-psutil \
312         ruby \
313         ruby-highline \
314         weston \
315         xorg-server-xvfb"
316
317     # These are dependencies necessary for building the jhbuild.
318     # Note: Could not find libegl-mesa
319     packages="$packages \
320         expat \
321         git \
322         gnutls \
323         gobject-introspection \
324         gsettings-desktop-schemas \
325         icon-naming-utils \
326         libcroco \
327         libdrm \
328         libepoxy \
329         libevdev \
330         libgpg-error \
331         libinput \
332         p11-kit \
333         libpciaccess \
334         libproxy \
335         libtiff \
336         libxfixes \
337         libxfont \
338         libxcb \
339         libxkbfile \
340         mtdev \
341         orc \
342         python2 \
343         python2-lxml \
344         ragel \
345         bigreqsproto \
346         compositeproto \
347         glproto \
348         inputproto \
349         randrproto \
350         resourceproto \
351         scrnsaverproto \
352         videoproto \
353         xcmiscproto \
354         xf86driproto \
355         xorg-font-utils \
356         xorg-util-macros \
357         xtrans \
358         xorg-utils \
359         yasm"
360
361     # These are dependencies necessary for using webkit-patch
362     packages="$packages \
363         svn"
364     pacman -S --needed $packages
365
366     echo "You will also need to follow the instructions on the Arch Wiki to make"
367     echo "'python' call python2 in the webkit folder"
368     echo "https://wiki.archlinux.org/index.php/Python#Dealing_with_version_problem_in_build_scripts"
369 }
370
371 function installDependenciesWithDnf {
372     # These are dependencies necessary for building WebKitGTK+.
373     packages=" \
374         atk-devel \
375         autoconf \
376         automake \
377         bison \
378         cairo-devel \
379         cmake \
380         enchant-devel \
381         flex \
382         gcc-c++ \
383         geoclue2-devel \
384         gettext-devel \
385         gobject-introspection-devel \
386         gperf \
387         gstreamer1-devel \
388         gstreamer1-plugins-base-devel \
389         gtk-doc \
390         gtk2-devel \
391         gtk3-devel \
392         hyphen-devel \
393         intltool \
394         json-glib-devel \
395         libXt-devel \
396         libXtst-devel \
397         libxslt-devel \
398         libedit-devel \
399         libgcrypt-devel \
400         libgudev1-devel \
401         libjpeg-turbo-devel \
402         libmount-devel \
403         libnotify-devel \
404         libpng-devel \
405         libsecret-devel \
406         libsoup-devel \
407         libsrtp-devel \
408         libtheora-devel \
409         libv4l-devel \
410         libvorbis-devel \
411         libvpx-devel \
412         libwebp-devel \
413         libwayland-client-devel \
414         libwayland-server-devel \
415         mesa-libGL-devel \
416         ninja-build \
417         openssl-devel \
418         opus-devel \
419         patch \
420         pcre-devel \
421         perl-Switch \
422         perl-version \
423         pulseaudio-libs-devel \
424         python-devel \
425         redhat-rpm-config \
426         ruby \
427         sqlite-devel"
428
429     # These are dependencies necessary for running tests.
430     packages="$packages \
431         curl \
432         dbus-x11 \
433         gdb \
434         hunspell-en \
435         httpd \
436         libgpg-error-devel \
437         mod_bw \
438         mod_ssl \
439         perl-CGI \
440         php \
441         psmisc \
442         pulseaudio-utils \
443         pygobject3-base \
444         python2-psutil \
445         ruby \
446         rubygem-json \
447         rubygem-highline \
448         weston-devel \
449         xorg-x11-server-Xvfb"
450
451     # These are dependencies necessary for building the jhbuild.
452     packages="$packages \
453         expat-devel \
454         docbook-utils \
455         docbook-utils-pdf \
456         git \
457         gobject-introspection \
458         gnutls-devel \
459         gsettings-desktop-schemas-devel \
460         icon-naming-utils \
461         itstool \
462         libXfont-devel \
463         libcroco-devel \
464         libdrm-devel \
465         libepoxy-devel \
466         libevdev-devel
467         libgpg-error-devel \
468         libinput-devel \
469         libp11-devel \
470         libpciaccess-devel \
471         libproxy-devel \
472         libtiff-devel \
473         libxcb-devel \
474         libxkbfile-devel \
475         mesa-libEGL-devel \
476         mtdev-devel \
477         orc-devel \
478         ragel \
479         systemd-devel \
480         xorg-x11-font-utils \
481         xorg-x11-proto-devel \
482         xorg-x11-util-macros \
483         xorg-x11-xtrans-devel \
484         yasm"
485
486     # These are dependencies necessary for using webkit-patch
487     packages="$packages
488         git-svn \
489         subversion"
490
491     dnf install $packages
492 }
493
494 checkInstaller
495