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