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