[GTK][WPE] install-dependencies should install the required gstreamer packages needed...
[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         luajit"
124
125     # These are dependencies necessary for using webkit-patch
126     packages="$packages \
127         git-svn \
128         subversion"
129
130     apt-get install $packages
131 }
132
133 function installDependenciesWithPacman {
134     # These are dependencies necessary for building WebKitGTK+.
135     packages=" \
136         autoconf \
137         automake \
138         bison \
139         cmake \
140         file \
141         findutils \
142         flex \
143         gawk \
144         gcc \
145         gnutls \
146         gperf \
147         grep \
148         groff \
149         gstreamer \
150         gst-plugins-bad \
151         gst-plugins-base-libs \
152         gzip \
153         icu \
154         intltool \
155         itstool \
156         libjpeg-turbo \
157         libpng \
158         libtasn1 \
159         libtool \
160         libwebp \
161         libxml2 \
162         libxslt \
163         m4 \
164         make \
165         ninja \
166         patch \
167         pkg-config \
168         ruby
169         sed \
170         sqlite \
171         texinfo \
172         which \
173         zlib"
174
175     # These are dependencies necessary for running tests.
176     # Note: apache-mod_bw and ruby-json is available in the AUR
177     packages="$packages \
178         apache \
179         curl \
180         gdb \
181         perl-cgi \
182         php-apache \
183         psmisc \
184         pulseaudio \
185         python2 \
186         python2-gobject \
187         python2-lxml \
188         python2-psutil \
189         ruby \
190         ruby-highline"
191
192     # These are dependencies necessary for building the jhbuild.
193     packages="$packages \
194         expat \
195         git \
196         gsettings-desktop-schemas \
197         libproxy \
198         libpulse \
199         libsrtp \
200         libtheora \
201         libv4l-dev \
202         libvorbis \
203         libvpx \
204         libxcb \
205         luajit \
206         mesa \
207         mesa-libgl \
208         opus \
209         orc \
210         v4l-utils"
211
212     # These are dependencies necessary for using webkit-patch
213     packages="$packages \
214         svn"
215     pacman -S --needed $packages
216
217     echo "You will also need to follow the instructions on the Arch Wiki to make"
218     echo "'python' call python2 in the webkit folder"
219     echo "https://wiki.archlinux.org/index.php/Python#Dealing_with_version_problem_in_build_scripts"
220 }
221
222 function installDependenciesWithDnf {
223     # These are dependencies necessary for building WebKitGTK+.
224     packages=" \
225         autoconf \
226         automake \
227         bison \
228         cmake \
229         flex \
230         gcc-c++ \
231         gnutls-devel \
232         gperf \
233         gstreamer1-devel \
234         gstreamer1-plugins-bad-free-devel \
235         gstreamer1-plugins-base-devel \
236         intltool \
237         itstool \
238         libicu-devel \
239         libjpeg-turbo-devel \
240         libpng-devel \
241         libtasn1-devel \
242         libtool \
243         libwebp-devel \
244         libxml2-devel \
245         libxslt-devel \
246         ninja-build \
247         patch \
248         ruby
249         sqlite-devel \
250         zlib-devel"
251
252     # These are dependencies necessary for running tests.
253     packages="$packages \
254         curl \
255         gdb \
256         httpd \
257         mod_bw \
258         mod_ssl \
259         perl-CGI \
260         php \
261         psmisc \
262         pulseaudio-utils \
263         python2-psutil \
264         python-gobject-base
265         ruby \
266         rubygem-highline \
267         rubygem-json"
268
269     # These are dependencies necessary for building the jhbuild.
270     packages="$packages \
271         expat-devel \
272         git \
273         gsettings-desktop-schemas-devel \
274         libproxy-devel \
275         libsrtp-devel \
276         libtheora-devel \
277         libv4l-devel \
278         libvorbis-devel \
279         libvpx-devel \
280         libxcb-devel \
281         luajit \
282         luajit-devel \
283         mesa-libgbm-devel \
284         mesa-libGLES-devel \
285         opus-devel \
286         orc-devel \
287         pulseaudio-libs-devel"
288
289     # These are dependencies necessary for using webkit-patch
290     packages="$packages
291         git-svn \
292         subversion"
293
294     dnf install $packages
295 }
296
297 checkInstaller