Unreviewed, fix name of Perl LibXML package on Fedora
[WebKit-https.git] / Tools / wpe / 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 $?
7 fi
8
9 function printNotSupportedMessageAndExit() {
10     echo
11     echo "Currently this script only works for distributions supporting apt-get, dnf or pacman."
12     echo "Please add support for your distribution and submit the patch at https://bugs.webkit.org"
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     printNotSupportedMessageAndExit
41 }
42
43
44 # If the package $1 is available, prints it. Otherwise prints $2.
45 # Useful for handling when a package is renamed on new versions of Debian/Ubuntu.
46 function aptIfElse {
47     if apt-cache show $1 &>/dev/null; then
48         echo $1
49     else
50         echo $2
51     fi
52 }
53
54 function installDependenciesWithApt {
55     # These are dependencies necessary for building WPE+.
56     packages=" \
57         autoconf \
58         automake \
59         autopoint \
60         autotools-dev \
61         bison \
62         cmake \
63         flex \
64         g++ \
65         gawk \
66         gcc \
67         gperf \
68         intltool \
69         itstool \
70         libgnutls28-dev \
71         libgstreamer1.0-dev \
72         libgstreamer-plugins-bad1.0-dev \
73         libgstreamer-plugins-base1.0-dev \
74         libicu-dev \
75         libjpeg-dev \
76         $(aptIfElse libpng-dev libpng12-dev) \
77         libsqlite3-dev \
78         libtasn1-6-dev \
79         libtool \
80         libwebp-dev \
81         libxml2-dev \
82         libxslt1-dev \
83         ninja-build \
84         patch \
85         pkg-config \
86         ruby \
87         zlib1g-dev"
88
89     # These are dependencies necessary for running tests.
90     packages="$packages \
91         apache2 \
92         curl \
93         gdb \
94         libapache2-mod-bw \
95         $(aptIfElse libapache2-mod-php7.0 libapache2-mod-php5) \
96         libcgi-pm-perl \
97         psmisc \
98         pulseaudio-utils \
99         python-gi \
100         python-psutil \
101         ruby \
102         ruby-highline \
103         ruby-json"
104
105     # These are dependencies necessary for building the jhbuild.
106     packages="$packages \
107         git \
108         gsettings-desktop-schemas-dev \
109         libexpat1-dev \
110         libgbm-dev \
111         libgles2-mesa-dev \
112         libluajit-5.1-dev \
113         libopus-dev \
114         liborc-0.4-dev \
115         libproxy-dev \
116         libpulse-dev \
117         libsrtp0-dev \
118         libtheora-dev \
119         libtool-bin \
120         libvorbis-dev \
121         libvpx-dev \
122         libxcb-xkb-dev \
123         libxml-libxml-perl \
124         luajit"
125
126     # These are dependencies necessary for using webkit-patch
127     packages="$packages \
128         git-svn \
129         subversion"
130
131     apt-get install $packages
132 }
133
134 function installDependenciesWithPacman {
135     # These are dependencies necessary for building WebKitGTK+.
136     packages=" \
137         autoconf \
138         automake \
139         bison \
140         cmake \
141         file \
142         findutils \
143         flex \
144         gawk \
145         gcc \
146         gnutls \
147         gperf \
148         grep \
149         groff \
150         gstreamer \
151         gst-plugins-bad \
152         gst-plugins-base-libs \
153         gzip \
154         icu \
155         intltool \
156         itstool \
157         libjpeg-turbo \
158         libpng \
159         libtasn1 \
160         libtool \
161         libwebp \
162         libxml2 \
163         libxslt \
164         m4 \
165         make \
166         ninja \
167         patch \
168         pkg-config \
169         ruby
170         sed \
171         sqlite \
172         texinfo \
173         which \
174         zlib"
175
176     # These are dependencies necessary for running tests.
177     # Note: apache-mod_bw and ruby-json is available in the AUR
178     packages="$packages \
179         apache \
180         curl \
181         gdb \
182         perl-cgi \
183         php-apache \
184         psmisc \
185         pulseaudio \
186         python2 \
187         python2-gobject \
188         python2-lxml \
189         python2-psutil \
190         ruby \
191         ruby-highline"
192
193     # These are dependencies necessary for building the jhbuild.
194     packages="$packages \
195         expat \
196         git \
197         gsettings-desktop-schemas \
198         libproxy \
199         libpulse \
200         libsrtp \
201         libtheora \
202         libv4l-dev \
203         libvorbis \
204         libvpx \
205         libxcb \
206         luajit \
207         mesa \
208         mesa-libgl \
209         opus \
210         orc \
211         perl-xml-libxml\
212         v4l-utils"
213
214     # These are dependencies necessary for using webkit-patch
215     packages="$packages \
216         svn"
217     pacman -S --needed $packages
218
219     echo "You will also need to follow the instructions on the Arch Wiki to make"
220     echo "'python' call python2 in the webkit folder"
221     echo "https://wiki.archlinux.org/index.php/Python#Dealing_with_version_problem_in_build_scripts"
222 }
223
224 function installDependenciesWithDnf {
225     # These are dependencies necessary for building WebKitGTK+.
226     packages=" \
227         autoconf \
228         automake \
229         bison \
230         cmake \
231         flex \
232         gcc-c++ \
233         gnutls-devel \
234         gperf \
235         gstreamer1-devel \
236         gstreamer1-plugins-bad-free-devel \
237         gstreamer1-plugins-base-devel \
238         intltool \
239         itstool \
240         libicu-devel \
241         libjpeg-turbo-devel \
242         libpng-devel \
243         libtasn1-devel \
244         libtool \
245         libwebp-devel \
246         libxml2-devel \
247         libxslt-devel \
248         ninja-build \
249         patch \
250         perl-Time-HiRes \
251         perl-version \
252         ruby \
253         sqlite-devel \
254         zlib-devel"
255
256     # These are dependencies necessary for running tests.
257     packages="$packages \
258         curl \
259         gdb \
260         httpd \
261         mod_bw \
262         mod_ssl \
263         perl-CGI \
264         php \
265         psmisc \
266         pulseaudio-utils \
267         python2-psutil \
268         python-gobject-base \
269         ruby \
270         rubygem-highline \
271         rubygem-json"
272
273     # These are dependencies necessary for building the jhbuild.
274     packages="$packages \
275         expat-devel \
276         git \
277         gsettings-desktop-schemas-devel \
278         libproxy-devel \
279         libsrtp-devel \
280         libtheora-devel \
281         libv4l-devel \
282         libvorbis-devel \
283         libvpx-devel \
284         libxcb-devel \
285         luajit \
286         luajit-devel \
287         mesa-libgbm-devel \
288         mesa-libGLES-devel \
289         opus-devel \
290         orc-devel \
291         perl-XML-LibXML \
292         pulseaudio-libs-devel"
293
294     # These are dependencies necessary for using webkit-patch
295     packages="$packages
296         git-svn \
297         subversion"
298
299     dnf install $packages
300 }
301
302 checkInstaller