Update install_openvino_dependencies.sh for Ubuntu 20.04 (#1974)
[platform/upstream/dldt.git] / scripts / install_dependencies / install_openvino_dependencies.sh
1 #!/bin/bash
2
3 # Copyright (c) 2018 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         ffmpeg
75     )
76     system_ver=$(cat /etc/lsb-release | grep -i "DISTRIB_RELEASE" | cut -d "=" -f2)
77     if [ "$system_ver" = "16.04" ]; then
78         PKGS+=( libgtk2.0-0 )
79     else
80         if [ "$system_ver" = "20.04" ]; then
81             PKGS+=( libgstreamer1.0-0 
82                     gstreamer1.0-plugins-base 
83                     gstreamer1.0-plugins-good  
84                     gstreamer1.0-plugins-bad 
85                     gstreamer1.0-plugins-ugly 
86                     gstreamer1.0-libav 
87                     libgstreamer-plugins-base1.0-dev 
88                     gstreamer1.0-doc
89                     gstreamer1.0-tools
90                     gstreamer1.0-x
91                     gstreamer1.0-alsa 
92                     gstreamer1.0-gl 
93                     gstreamer1.0-gtk3 
94                     gstreamer1.0-qt5 
95                     gstreamer1.0-pulseaudio 
96                     libgstrtspserver-1.0-dev
97                     python3-gst-1.0
98                     libfluidsynth2
99                     libnettle7
100                     libopenexr24
101                 )
102         elif [ "$system_ver" = "18.04" ]; then
103             PKGS+=( libfluidsynth1
104                     libnettle6
105                     libopenexr22
106                 )
107         fi
108         PKGS+=( libgtk-3-0
109                 libglib2.0-0
110                 flex
111                 bison
112                 libgmp10
113                 libgsl23
114                 gobject-introspection
115                 libcap2
116                 libcap2-bin
117                 gettext
118                 libgirepository-1.0-1
119                 libx11-6
120                 iso-codes
121                 libgl1-mesa-dri
122                 libgles2
123                 libgl-dev
124                 gir1.2-gudev-1.0
125                 libtheora0
126                 libcdparanoia0
127                 libpango-1.0-0
128                 libgbm1
129                 libasound2
130                 libjpeg8
131                 libvisual-0.4-0
132                 libxv1
133                 libopus0
134                 libgraphene-1.0-0
135                 libvorbis0a
136                 libbz2-1.0
137                 libv4l-0
138                 libaa1
139                 libflac8
140                 libgdk-pixbuf2.0-0
141                 libmp3lame0
142                 libcaca0
143                 libdv4
144                 libmpg123-0
145                 libraw1394-11
146                 libavc1394-0
147                 libiec61883-0
148                 libpulse0
149                 libsoup2.4-1
150                 libspeex1
151                 libtag-extras1
152                 libtwolame0
153                 libwavpack1
154                 libbluetooth3
155                 libusb-1.0-0-dev
156                 libass9
157                 libbs2b0
158                 libchromaprint1
159                 liblcms2-2
160                 libssh2-1
161                 libdc1394-22
162                 libdirectfb-1.7-7
163                 libssh-4
164                 libdca0
165                 libfaac0
166                 libfdk-aac1
167                 libflite1
168                 libgme0
169                 libgsm1
170                 libkate1
171                 liblrdf0
172                 libde265-0
173                 libmjpegtools-dev
174                 libmms0
175                 libmodplug1
176                 libmpcdec6
177                 libneon27
178                 libopenal1
179                 libopenjp2-7
180                 libopenmpt0
181                 libopenni2-0
182                 libdvdnav4
183                 librtmp1
184                 librsvg2-2
185                 libsbc1
186                 libsndfile1
187                 libsoundtouch1
188                 libspandsp2
189                 libsrtp2-1
190                 libzvbi0
191                 libvo-aacenc0
192                 libvo-amrwbenc0
193                 libwebrtc-audio-processing1
194                 libwebp6
195                 libwildmidi2
196                 libzbar0
197                 libnice10
198                 libxkbcommon0
199                 libmpeg2-4
200                 libopencore-amrnb0
201                 libopencore-amrwb0
202                 liba52-0.7.4
203                 libva2
204                 libxrandr2
205                 libudev1
206                 python3.6
207                 libpython3.6
208                 python3-gi
209         )
210     fi
211     apt update
212     apt install -y ${PKGS[@]}
213 else
214     # CentOS
215     echo
216     echo "This script installs the following OpenVINO 3rd-party dependencies:"
217     echo "  1. GTK+ and GStreamer libraries used by OpenCV"
218     echo "  2. libusb library required for Myriad plugin for Inference Engine"
219     echo "  3. Python 3.6 for Model Optimizer"
220     echo "  4. gcc 4.8.5 and other build dependencies for OpenVINO samples"
221     echo "  5. build dependencies for GStreamer Plugins"
222     echo
223     PKGS=(
224         libusbx-devel
225         gtk2
226         gstreamer1
227         gstreamer1-plugins-good
228         gstreamer1-plugins-bad-free
229         gcc
230         gcc-c++
231         make
232         glibc-static
233         glibc
234         libstdc++-static
235         libstdc++
236         libstdc++
237         libgcc
238         cmake
239         python36
240         python36-pip
241         glib2-devel
242         flex
243         bison
244         gmp
245         gsl
246         gobject-introspection
247         libcap
248         libcap
249         gettext
250         libXrandr
251         libX11
252         iso-codes
253         mesa-libEGL
254         mesa-libGLES
255         mesa-libGL
256         libgudev1
257         libtheora
258         cdparanoia
259         pango
260         mesa-libgbm
261         alsa-lib
262         libjpeg-turbo
263         libvisual
264         libXv
265         opus
266         libvorbis
267         patch
268         bzip2
269         libv4l
270         flac
271         gdk-pixbuf2
272         libdv
273         mpg123
274         libraw1394
275         libavc1394
276         libiec61883
277         pulseaudio-libs
278         libsoup
279         speex
280         wavpack
281         boost-regex-1.53.0
282     )
283     yum install -y ${PKGS[@]}
284
285     # Thirdparty repositories for installing GStreamer Bad & Ugly Plugins dependencies.
286     if yes_or_no_gst_bad_ugly; then
287         GST_BAD_UGLY_PKGS=(
288             bluez-libs
289             libusb
290             libass
291             libbs2b
292             libchromaprint
293             lcms2
294             libssh2
295             libdc1394
296             libXext
297             libssh
298             libdca
299             faac
300             fdk-aac
301             flite
302             fluidsynth
303             game-music-emu
304             gsm
305             nettle
306             kate
307             liblrdf
308             libde265
309             mjpegtools
310             libmms
311             libmodplug
312             libmpcdec
313             neon
314             openal-soft
315             OpenEXR
316             openjpeg2
317             openni
318             libdvdnav
319             librtmp
320             librsvg2
321             sbc
322             libsndfile
323             soundtouch
324             spandsp
325             libsrtp
326             zvbi
327             vo-amrwbenc
328             webrtc-audio-processing
329             wildmidi
330             zbar
331             libnice
332             libxkbcommon
333             libmpeg2
334             libcdio
335             opencore-amr
336             libva
337             python36-gobject
338             python3-devel
339         )
340         yum install -y epel-release
341         rpm -Uvh https://download1.rpmfusion.org/free/el/rpmfusion-free-release-7.noarch.rpm
342         RPMFUSION_IS_INSTALLED=1
343         yum install -y https://forensics.cert.org/cert-forensics-tools-release-el7.rpm
344         yum install -y ${GST_BAD_UGLY_PKGS[@]}
345     else
346         echo "Dependencies for GStreamer Ugly & Bad plugins installation skipped."
347         echo
348     fi
349
350     echo
351     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:"
352     echo
353     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. "
354     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 "
355     echo "Once added, this repository will be enabled on your operating system and can thus receive updates to all packages installed from it. "
356     echo
357     echo "Consider the following ways to prevent unintended 'updates' from this third party repository from over-writing some core part of CentOS:"
358     echo "a) Only enable these archives from time to time, and generally leave them disabled. See: man yum"
359     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"
360     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."
361     echo
362     echo "Option 2: Skip FFmpeg installation."
363     echo
364
365     if yes_or_no_ffmpeg; then
366         if [[ -z $RPMFUSION_IS_INSTALLED ]]; then
367             yum install -y epel-release
368             rpm -Uvh https://download1.rpmfusion.org/free/el/rpmfusion-free-release-7.noarch.rpm
369         fi
370         yum install -y ffmpeg
371     else
372         echo "FFmpeg installation skipped. You may build FFmpeg from sources as described here: https://trac.ffmpeg.org/wiki/CompilationGuide/Centos"
373         echo
374     fi
375     exit
376 fi