Restored gtk-3 installation (#3472)
[platform/upstream/dldt.git] / scripts / install_dependencies / install_openvino_dependencies.sh
1 #!/bin/bash
2
3 # Copyright (c) 2018 - 2020 Intel Corporation
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 #      http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16
17 set -e
18
19 if [ $EUID -ne 0 ]; then
20     echo "ERROR: this script must be run as root to install 3rd party packages." >&2
21     echo "Please try again with \"sudo -E $0\", or as root." >&2
22     exit 1
23 fi
24
25 params=$@
26
27 yes_or_no_ffmpeg() {
28     if [ "$params" == "-y" ]; then
29         return 0
30     fi
31
32     while true; do
33         read -p "Add third-party RPM Fusion repository and install FFmpeg package (y/n): " yn
34         case $yn in
35             [Yy]*) return 0  ;;
36             [Nn]*) return  1 ;;
37         esac
38     done
39 }
40
41 yes_or_no_gst_bad_ugly() {
42     if [ "$params" == "-y" ]; then
43         return 0
44     fi
45
46     while true; do
47         read -p "Add third-party RPM Epel, Nux, Fusion, Forensics repositories and install dependencies for GStreamer Bad & Ugly Plugins (y/n): " yn
48         case $yn in
49             [Yy]*) return 0  ;;
50             [Nn]*) return  1 ;;
51         esac
52     done
53 }
54
55 if [ -f /etc/lsb-release ]; then
56     # Ubuntu
57     echo
58     echo "This script installs the following OpenVINO 3rd-party dependencies:"
59     echo "  1. GTK+, FFmpeg and GStreamer libraries used by OpenCV"
60     echo "  2. libusb library required for Myriad plugin for Inference Engine"
61     echo "  3. build dependencies for OpenVINO samples"
62     echo "  4. build dependencies for GStreamer Plugins"
63     echo
64     PKGS=(
65         cpio
66         build-essential
67         cmake
68         libusb-1.0-0-dev
69         libdrm-dev
70         libgstreamer1.0-0
71         gstreamer1.0-plugins-base
72         gstreamer1.0-plugins-good
73         gstreamer1.0-plugins-bad
74         gstreamer1.0-vaapi
75         ffmpeg
76     )
77     system_ver=$(cat /etc/lsb-release | grep -i "DISTRIB_RELEASE" | cut -d "=" -f2)
78     if [ "$system_ver" = "16.04" ]; then
79         PKGS+=( libgtk2.0-0 )
80     else
81         if [ "$system_ver" = "20.04" ]; then
82             PKGS+=( gstreamer1.0-plugins-ugly
83                     gstreamer1.0-libav
84                     libgstreamer-plugins-base1.0-dev
85                     gstreamer1.0-alsa
86                     libgstrtspserver-1.0-dev
87                     python3-gst-1.0
88                     libfluidsynth2
89                     libnettle7
90                     libopenexr24
91                     python3.8
92                     libpython3.8
93                     libglib2.0-0
94                 )
95         elif [ "$system_ver" = "18.04" ]; then
96             PKGS+=( libfluidsynth1
97                     libnettle6
98                     libopenexr22
99                     gstreamer1.0-plugins-ugly
100                     gstreamer1.0-alsa
101                     libglib2.0
102                 )
103         fi
104         PKGS+=( flex
105                 libgl-dev
106                 libtag-extras1
107                 libusb-1.0-0-dev
108                 libfaac0
109                 python3-gi
110                 libgtk-3-0
111         )
112     fi
113     apt update
114     # shellcheck disable=SC2068
115     apt install -y ${PKGS[@]}
116 else
117     # CentOS
118     echo
119     echo "This script installs the following OpenVINO 3rd-party dependencies:"
120     echo "  1. GTK+ and GStreamer libraries used by OpenCV"
121     echo "  2. libusb library required for Myriad plugin for Inference Engine"
122     echo "  3. Python 3.6 for Model Optimizer"
123     echo "  4. gcc 4.8.5 and other build dependencies for OpenVINO samples"
124     echo "  5. build dependencies for GStreamer Plugins"
125     echo
126     PKGS=(
127         libusbx-devel
128         gtk2
129         gstreamer1
130         gstreamer1-plugins-good
131         gstreamer1-plugins-bad-free
132         gcc
133         gcc-c++
134         make
135         glibc-static
136         glibc
137         libstdc++-static
138         libstdc++
139         libstdc++
140         libgcc
141         cmake
142         python36
143         python36-pip
144         glib2-devel
145         flex
146         gmp
147         gsl
148         libcap
149         libcap
150         gettext
151         libXrandr
152         libX11
153         iso-codes
154         mesa-libEGL
155         mesa-libGLES
156         mesa-libGL
157         libgudev1
158         libtheora
159         cdparanoia
160         pango
161         mesa-libgbm
162         alsa-lib
163         libjpeg-turbo
164         libvisual
165         libXv
166         opus
167         libvorbis
168         patch
169         bzip2
170         libv4l
171         flac
172         gdk-pixbuf2
173         libdv
174         mpg123
175         libraw1394
176         libavc1394
177         libiec61883
178         pulseaudio-libs
179         libsoup
180         speex
181         wavpack
182         boost-regex-1.53.0
183     )
184     yum install -y ${PKGS[@]}
185
186     # Thirdparty repositories for installing GStreamer Bad & Ugly Plugins dependencies.
187     if yes_or_no_gst_bad_ugly; then
188         GST_BAD_UGLY_PKGS=(
189             bluez-libs
190             libusb
191             libass
192             libbs2b
193             libchromaprint
194             lcms2
195             libssh2
196             libdc1394
197             libXext
198             libssh
199             libdca
200             faac
201             fdk-aac
202             flite
203             fluidsynth
204             game-music-emu
205             gsm
206             nettle
207             kate
208             liblrdf
209             libde265
210             mjpegtools
211             libmms
212             libmodplug
213             libmpcdec
214             neon
215             openal-soft
216             OpenEXR
217             openjpeg2
218             openni
219             libdvdnav
220             librtmp
221             librsvg2
222             sbc
223             libsndfile
224             soundtouch
225             spandsp
226             libsrtp
227             zvbi
228             vo-amrwbenc
229             webrtc-audio-processing
230             wildmidi
231             zbar
232             libnice
233             libxkbcommon
234             opencore-amr
235             libva
236             python36-gobject
237             python3-devel
238         )
239         yum install -y epel-release
240         rpm -Uvh https://download1.rpmfusion.org/free/el/rpmfusion-free-release-7.noarch.rpm
241         RPMFUSION_IS_INSTALLED=1
242         yum install -y https://forensics.cert.org/cert-forensics-tools-release-el7.rpm
243         yum install -y ${GST_BAD_UGLY_PKGS[@]}
244     else
245         echo "Dependencies for GStreamer Ugly & Bad plugins installation skipped."
246         echo
247     fi
248
249     echo
250     echo "Intel(R) Distribution of OpenVINO(TM) toolkit can use FFmpeg for processing video streams with OpenCV. Please select your preferred method for installing FFmpeg:"
251     echo
252     echo "Option 1: Allow installer script to add a third party repository, RPM Fusion (https://rpmfusion.org/), which contains FFmpeg. FFmpeg rpm package will be installed from this repository. "
253     echo "WARNING: This repository is NOT PROVIDED OR SUPPORTED by Intel or CentOS. Neither Intel nor CentOS has control over this repository. Terms governing your use of FFmpeg can be found here: https://www.ffmpeg.org/legal.html "
254     echo "Once added, this repository will be enabled on your operating system and can thus receive updates to all packages installed from it. "
255     echo
256     echo "Consider the following ways to prevent unintended 'updates' from this third party repository from over-writing some core part of CentOS:"
257     echo "a) Only enable these archives from time to time, and generally leave them disabled. See: man yum"
258     echo "b) Use the exclude= and includepkgs= options on a per sub-archive basis, in the matching .conf file found in /etc/yum.repos.d/ See: man yum.conf"
259     echo "c) The yum Priorities plug-in can prevent a 3rd party repository from replacing base packages, or prevent base/updates from replacing a 3rd party package."
260     echo
261     echo "Option 2: Skip FFmpeg installation."
262     echo
263
264     if yes_or_no_ffmpeg; then
265         if [[ -z $RPMFUSION_IS_INSTALLED ]]; then
266             yum install -y epel-release
267             rpm -Uvh https://download1.rpmfusion.org/free/el/rpmfusion-free-release-7.noarch.rpm
268         fi
269         yum install -y ffmpeg
270     else
271         echo "FFmpeg installation skipped. You may build FFmpeg from sources as described here: https://trac.ffmpeg.org/wiki/CompilationGuide/Centos"
272         echo
273     fi
274     exit
275 fi