b5c436ec67f35411f17fec6ae54b1681efae3258
[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 22 and above
26     dnf --version &> /dev/null
27     if [ $? -eq 0 ]; then
28         installFedoraDependencies dnf
29         exit 0
30     fi
31
32     # yum - Fedora 21 and below
33     yum --version &> /dev/null
34     if [ $? -eq 0 ]; then
35         installFedoraDependencies yum
36         exit 0
37     fi
38
39     # pacman - Arch Linux
40     # pacman --version and pacman --help both return non-0
41     pacman -Ss &> /dev/null
42     if [ $? -eq 0 ]; then
43         installDependenciesWithPacman
44         exit 0
45     fi
46
47     printNotSupportedMessageAndExit
48 }
49
50 function installDependenciesWithApt {
51     # These are dependencies necessary for building WebKitGTK+.
52     apt-get install \
53         autoconf \
54         automake \
55         autopoint \
56         autotools-dev \
57         bison \
58         cmake \
59         flex \
60         gawk \
61         gnome-common \
62         gperf \
63         gtk-doc-tools \
64         intltool \
65         itstool \
66         libatk1.0-dev \
67         libenchant-dev \
68         libfaad-dev \
69         libgeoclue-dev \
70         libgirepository1.0-dev \
71         libgl1-mesa-dev \
72         libgl1-mesa-glx \
73         libgnutls28-dev \
74         libgtk2.0-dev \
75         libgtk-3-dev \
76         libgudev-1.0-dev \
77         libharfbuzz-dev \
78         libhyphen-dev \
79         libicu-dev \
80         libjpeg-dev \
81         libmpg123-dev \
82         libnotify-dev \
83         libopus-dev \
84         liborc-0.4-dev \
85         libpango1.0-dev \
86         libpng12-dev \
87         libpulse-dev \
88         librsvg2-dev \
89         libsecret-1-dev \
90         libsoup2.4-dev \
91         libsqlite3-dev \
92         libtheora-dev \
93         libtool \
94         libvorbis-dev \
95         libwebp-dev \
96         libxcomposite-dev \
97         libxslt1-dev \
98         libxt-dev \
99         libxtst-dev \
100         ruby \
101         xfonts-utils
102
103     # These are dependencies necessary for running tests.
104     apt-get install \
105         apache2 \
106         curl \
107         dbus-x11 \
108         libapache2-mod-bw \
109         libapache2-mod-php5 \
110         libgpg-error-dev \
111         pulseaudio-utils \
112         python-gi \
113         ruby \
114         ruby-json \
115         ruby-highline \
116         xvfb
117
118     # These are dependencies necessary for building the jhbuild.
119     apt-get install \
120         git \
121         gobject-introspection \
122         icon-naming-utils \
123         libcroco3-dev \
124         libegl1-mesa-dev \
125         libgcrypt11-dev \
126         libgpg-error-dev \
127         libjson-glib-dev \
128         liborc-0.4-dev \
129         libp11-kit-dev \
130         libpciaccess-dev \
131         libssl-dev \
132         libtiff5-dev \
133         libv4l-dev \
134         libxcb-xfixes0-dev \
135         libxfont-dev \
136         libxkbfile-dev \
137         llvm \
138         llvm-dev \
139         python-dev \
140         ragel \
141         x11proto-bigreqs-dev \
142         x11proto-composite-dev \
143         x11proto-gl-dev \
144         x11proto-input-dev \
145         x11proto-randr-dev \
146         x11proto-resource-dev \
147         x11proto-scrnsaver-dev \
148         x11proto-video-dev \
149         x11proto-xcmisc-dev \
150         x11proto-xf86dri-dev \
151         xfonts-utils \
152         xtrans-dev \
153         xutils-dev
154
155     # These are dependencies necessary for using webkit-patch
156     apt-get install \
157         git-svn \
158         subversion
159
160     # ninja is a faster build system than GNU make, but it doesn't
161     # exist on Ubuntu 12.04
162     apt-get install ninja-build || true
163 }
164
165 function installDependenciesWithPacman {
166     # These are dependencies necessary for building WebKitGTK+.
167     packages=" \
168         autoconf \
169         automake \
170         bison \
171         cmake \
172         file \
173         findutils \
174         flex \
175         gawk \
176         gcc \
177         gettext \
178         gnome-common \
179         gperf \
180         grep \
181         groff \
182         gzip \
183         hyphen \
184         libtool \
185         m4 \
186         make \
187         patch \
188         pkg-config \
189         sed \
190         texinfo \
191         util-linux \
192         which \
193         gtk-doc \
194         intltool \
195         itstool \
196         atk \
197         enchant \
198         faad2 \
199         geoclue \
200         gobject-introspection \
201         mesa \
202         mesa-libgl \
203         gnutls \
204         gtk2 \
205         gtk3 \
206         libsystemd \
207         harfbuzz \
208         harfbuzz-icu \
209         icu \
210         libjpeg-turbo \
211         mpg123 \
212         opus \
213         pango \
214         libpng \
215         libpulse \
216         librsvg \
217         libsecret \
218         libsoup \
219         sqlite \
220         libtheora \
221         libtool \
222         libvorbis \
223         libwebp \
224         libxcomposite \
225         libxslt \
226         libxt \
227         libxtst \
228         ninja \
229         ruby \
230         xorg-font-utils \
231         orc"
232
233     # These are dependencies necessary for running tests.
234     # Note: apache-mod_bw is available in the AUR, but the main repos
235     #       could not find ruby-json
236     packages="$packages \
237         apache \
238         curl \
239         hunspell \
240         hunspell-en \
241         php-apache \
242         libgpg-error \
243         pulseaudio \
244         python-gobject \
245         ruby \
246         ruby-highline \
247         xorg-server-xvfb"
248
249     # These are dependencies necessary for building the jhbuild.
250     # Note: Could not find libegl-mesa
251     packages="$packages \
252         git \
253         gobject-introspection \
254         icon-naming-utils \
255         libcroco \
256         libgcrypt \
257         libgpg-error \
258         p11-kit \
259         libpciaccess \
260         libtiff \
261         libxfixes \
262         libxfont \
263         libxkbfile \
264         llvm \
265         python2 \
266         python2-lxml \
267         ragel \
268         bigreqsproto \
269         compositeproto \
270         glproto \
271         inputproto \
272         randrproto \
273         resourceproto \
274         scrnsaverproto \
275         videoproto \
276         xcmiscproto \
277         xf86driproto \
278         xorg-font-utils \
279         xorg-util-macros \
280         xtrans \
281         xorg-utils"
282
283     # These are dependencies necessary for using webkit-patch
284     packages="$packages \
285         svn"
286     pacman -S --needed $packages
287
288     echo "You will also need to follow the instructions on the Arch Wiki to make"
289     echo "'python' call python2 in the webkit folder"
290     echo "https://wiki.archlinux.org/index.php/Python#Dealing_with_version_problem_in_build_scripts"
291 }
292
293 function installFedoraDependencies {
294     # These are dependencies necessary for building WebKitGTK+.
295     $1 install \
296         atk-devel \
297         autoconf \
298         automake \
299         bison \
300         cairo-devel \
301         cmake \
302         enchant-devel \
303         flex \
304         fontconfig-devel \
305         freetype-devel \
306         gcc-c++ \
307         geoclue-devel \
308         gettext-devel \
309         gobject-introspection-devel \
310         gperf \
311         gstreamer1-devel \
312         gstreamer1-plugins-base-devel \
313         gtk-doc \
314         gtk2-devel \
315         gtk3-devel \
316         harfbuzz-devel \
317         hyphen-devel \
318         json-glib-devel \
319         libXt-devel \
320         libXtst-devel \
321         libgudev1-devel \
322         libicu-devel \
323         libjpeg-turbo-devel \
324         libpng-devel \
325         libsecret-devel \
326         libsoup-devel \
327         libv4l-devel \
328         libwebp-devel \
329         libxslt-devel \
330         mesa-libGL-devel \
331         ninja-build \
332         openssl-devel \
333         pcre-devel \
334         perl-Switch \
335         perl-version \
336         pulseaudio-libs-devel \
337         python-devel \
338         orc-devel \
339         ruby \
340         sqlite-devel
341
342     # These are dependencies necessary for running tests.
343     $1 install \
344         curl \
345         dbus-x11 \
346         hunspell-en \
347         httpd \
348         libgpg-error-devel \
349         mod_bw \
350         mod_ssl \
351         perl-CGI \
352         php \
353         pulseaudio-utils \
354         pygobject3-base \
355         ruby \
356         rubygem-json \
357         rubygem-highline \
358         xorg-x11-server-Xvfb
359
360     # These are dependencies necessary for building the jhbuild.
361     $1 install \
362         docbook-utils \
363         docbook-utils-pdf \
364         git \
365         gobject-introspection \
366         icon-naming-utils \
367         itstool \
368         libXfont-devel \
369         libcroco-devel \
370         libgcrypt-devel \
371         libgpg-error-devel \
372         libp11-devel \
373         libpciaccess-devel \
374         libtiff-devel \
375         libxkbfile-devel \
376         llvm \
377         llvm-devel \
378         mesa-libEGL-devel \
379         ragel \
380         xorg-x11-font-utils \
381         xorg-x11-proto-devel \
382         xorg-x11-util-macros \
383         xorg-x11-xtrans-devel
384
385     # These are dependencies necessary for using webkit-patch
386     $1 install \
387         git-svn \
388         subversion
389 }
390
391 checkInstaller
392