[WPE] Remove libgbm dependency
[WebKit-https.git] / Tools / wpe / install-dependencies
1 #!/usr/bin/env 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         libfile-copy-recursive-perl \
77         $(aptIfElse libpng-dev libpng12-dev) \
78         libsqlite3-dev \
79         libtasn1-6-dev \
80         libtool \
81         libwebp-dev \
82         libxml2-dev \
83         libxslt1-dev \
84         ninja-build \
85         patch \
86         pkg-config \
87         ruby \
88         zlib1g-dev"
89
90     # These are dependencies necessary for running tests.
91     packages="$packages \
92         apache2 \
93         curl \
94         gdb \
95         libapache2-mod-bw \
96         libapache2-mod-php \
97         libcgi-pm-perl \
98         psmisc \
99         pulseaudio-utils \
100         python-gi \
101         python-psutil \
102         ruby \
103         ruby-highline \
104         ruby-json"
105
106     # These are dependencies necessary for building the jhbuild.
107     packages="$packages \
108         git \
109         gsettings-desktop-schemas-dev \
110         libegl1-mesa-dev \
111         libexpat1-dev \
112         libgles2-mesa-dev \
113         libluajit-5.1-dev \
114         libmount-dev \
115         libopus-dev \
116         liborc-0.4-dev \
117         libproxy-dev \
118         libpulse-dev \
119         libsrtp0-dev \
120         libtheora-dev \
121         libtool-bin \
122         libvorbis-dev \
123         libvpx-dev \
124         libxcb-xkb-dev \
125         libxkbcommon-dev \
126         libxml-libxml-perl \
127         libwayland-dev \
128         luajit \
129         yasm"
130
131     # These are dependencies necessary for using webkit-patch
132     packages="$packages \
133         git-svn \
134         subversion"
135
136     apt-get install $packages
137 }
138
139 function installDependenciesWithPacman {
140     # These are dependencies necessary for building WPE.
141     packages=" \
142         autoconf \
143         automake \
144         bison \
145         cmake \
146         file \
147         findutils \
148         flex \
149         gawk \
150         gcc \
151         gnutls \
152         gperf \
153         grep \
154         groff \
155         gstreamer \
156         gst-plugins-bad \
157         gst-plugins-base-libs \
158         gzip \
159         icu \
160         intltool \
161         itstool \
162         libjpeg-turbo \
163         libpng \
164         libtasn1 \
165         libtool \
166         libwebp \
167         libxml2 \
168         libxslt \
169         m4 \
170         make \
171         ninja \
172         patch \
173         perl-file-copy-recursive \
174         pkg-config \
175         ruby
176         sed \
177         sqlite \
178         texinfo \
179         which \
180         zlib"
181
182     # These are dependencies necessary for running tests.
183     # Note: apache-mod_bw and ruby-json is available in the AUR
184     packages="$packages \
185         apache \
186         curl \
187         gdb \
188         perl-cgi \
189         php-apache \
190         psmisc \
191         pulseaudio \
192         python2 \
193         python2-gobject \
194         python2-lxml \
195         python2-psutil \
196         ruby \
197         ruby-highline"
198
199     # These are dependencies necessary for building the jhbuild.
200     packages="$packages \
201         expat \
202         git \
203         gsettings-desktop-schemas \
204         libproxy \
205         libpulse \
206         libsrtp \
207         libtheora \
208         libv4l-dev \
209         libvorbis \
210         libvpx \
211         libxcb \
212         libxkbcommon \
213         luajit \
214         mesa \
215         mesa-libgl \
216         opus \
217         orc \
218         perl-xml-libxml \
219         util-linux \
220         v4l-utils \
221         xorg-xrandr \
222         wayland \
223         yasm"
224
225     # These are dependencies necessary for using webkit-patch
226     packages="$packages \
227         svn"
228     pacman -S --needed $packages
229
230     echo "You will also need to follow the instructions on the Arch Wiki to make"
231     echo "'python' call python2 in the webkit folder"
232     echo "https://wiki.archlinux.org/index.php/Python#Dealing_with_version_problem_in_build_scripts"
233 }
234
235 function installDependenciesWithDnf {
236     # These are dependencies necessary for building WebKitWPE.
237     packages=" \
238         autoconf \
239         automake \
240         bison \
241         cmake \
242         flex \
243         gcc-c++ \
244         gnutls-devel \
245         gperf \
246         gstreamer1-devel \
247         gstreamer1-plugins-bad-free-devel \
248         gstreamer1-plugins-base-devel \
249         intltool \
250         itstool \
251         libicu-devel \
252         libjpeg-turbo-devel \
253         libpng-devel \
254         libtasn1-devel \
255         libtool \
256         libwebp-devel \
257         libxml2-devel \
258         libxslt-devel \
259         ninja-build \
260         patch \
261         perl-File-Copy-Recursive \
262         perl-JSON-PP \
263         perl-Time-HiRes \
264         perl-version \
265         ruby \
266         sqlite-devel \
267         zlib-devel"
268
269     # These are dependencies necessary for running tests.
270     packages="$packages \
271         curl \
272         gdb \
273         httpd \
274         mod_bw \
275         mod_ssl \
276         perl-CGI \
277         php \
278         psmisc \
279         pulseaudio-utils \
280         python2-psutil \
281         python-gobject-base \
282         ruby \
283         rubygem-highline \
284         rubygem-json"
285
286     # These are dependencies necessary for building the jhbuild.
287     packages="$packages \
288         expat-devel \
289         git \
290         gsettings-desktop-schemas-devel \
291         libmount-devel \
292         libproxy-devel \
293         libsrtp-devel \
294         libtheora-devel \
295         libv4l-devel \
296         libvorbis-devel \
297         libvpx-devel \
298         libxcb-devel \
299         libxkbcommon-devel \
300         libXrandr-devel \
301         luajit \
302         luajit-devel \
303         mesa-libGLES-devel \
304         mesa-libEGL-devel \
305         opus-devel \
306         orc-devel \
307         perl-XML-LibXML \
308         pulseaudio-libs-devel \
309         wayland-devel \
310         yasm"
311
312     # These are dependencies necessary for using webkit-patch
313     packages="$packages
314         git-svn \
315         subversion"
316
317     dnf install $packages
318 }
319
320 checkInstaller