fdb70e266100230cdb7b15319c9942b6f093bc5a
[platform/upstream/dldt.git] / inference-engine / install_dependencies.sh
1 #!/bin/bash
2 # Copyright (C) 2018 Intel Corporation
3 # SPDX-License-Identifier: Apache-2.0
4 #
5
6 params=$@
7
8 function yes_or_no {
9     if [ "$params" == "-y" ]; then
10         return 0
11     fi
12
13     while true; do
14         read -p "Add third-party Nux Dextop repository and install FFmpeg package (y) / Skip this step (N)" yn
15         case $yn in
16             [Yy]*) return 0 ;;
17             [Nn]*) return 1 ;;
18         esac
19     done
20 }
21
22 # install dependencies
23 if [[ -f /etc/lsb-release ]]; then
24     # Ubuntu
25     sudo -E apt update
26     sudo -E apt-get install -y \
27             build-essential \
28             cmake \
29             curl \
30             wget \
31             libssl-dev \
32             ca-certificates \
33             git \
34             libboost-regex-dev \
35             gcc-multilib \
36             g++-multilib \
37             libgtk2.0-dev \
38             pkg-config \
39             unzip \
40             automake \
41             libtool \
42             autoconf \
43             libpng12-dev \
44             libcairo2-dev \
45             libpango1.0-dev \
46             libglib2.0-dev \
47             libgtk2.0-dev \
48             libswscale-dev \
49             libavcodec-dev \
50             libavformat-dev \
51             libgstreamer1.0-0 \
52             gstreamer1.0-plugins-base \
53             libusb-1.0-0-dev \
54             libopenblas-dev
55 else
56     # CentOS 7.x
57     sudo -E yum install -y centos-release-scl epel-release
58     sudo -E yum install -y \
59             wget \
60             tar \
61             xz \
62             p7zip \
63             unzip \
64             yum-plugin-ovl \
65             which \
66             libssl-dev \
67             ca-certificates \
68             git \
69             boost-devel \
70             libtool \
71             gcc \
72             gcc-c++ \
73             make \
74             glibc-static \
75             glibc-devel \
76             libstdc++-static \
77             libstdc++-devel \
78             libstdc++ libgcc \
79             glibc-static.i686 \
80             glibc-devel.i686 \
81             libstdc++-static.i686 \
82             libstdc++.i686 \
83             libgcc.i686 \
84             libusbx-devel \
85             openblas-devel \
86             libusbx-devel \
87             gstreamer1 \
88             gstreamer1-plugins-base
89
90     # Python 3.6 for Model Optimizer
91     sudo -E yum install -y rh-python36
92     source scl_source enable rh-python36
93
94     wget https://cmake.org/files/v3.12/cmake-3.12.3.tar.gz
95     tar xf cmake-3.12.3.tar.gz
96     cd cmake-3.12.3
97     ./configure
98     make -j16
99     sudo -E make install
100
101     echo
102     echo "FFmpeg is required for processing audio and video streams with OpenCV. Please select your preferred method for installing FFmpeg:"
103     echo
104     echo "Option 1: Allow installer script to add a third party repository, Nux Dextop (http://li.nux.ro/repos.html), which contains FFmpeg. FFmpeg rpm package will be installed from this repository. "
105     echo "WARNING: This repository is NOT PROVIDED OR SUPPORTED by CentOS."
106     echo "Once added, this repository will be enabled on your operating system and can thus receive updates to all packages installed from it. "
107     echo
108     echo "Consider the following ways to prevent unintended 'updates' from this third party repository from over-writing some core part of CentOS:"
109     echo "a) Only enable these archives from time to time, and generally leave them disabled. See: man yum"
110     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"
111     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."
112     echo
113     echo "Option 2: Skip FFmpeg installation."
114     echo
115
116     if yes_or_no; then
117         sudo -E rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-1.el7.nux.noarch.rpm
118         sudo -E yum install -y ffmpeg
119     else
120         echo "FFmpeg installation skipped. You may build FFmpeg from sources as described here: https://trac.ffmpeg.org/wiki/CompilationGuide/Centos"
121         echo
122     fi
123
124 fi