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