Publishing 2019 R1 content
[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     system_ver=`cat /etc/lsb-release | grep -i "DISTRIB_RELEASE" | cut -d "=" -f2`
26     sudo -E apt update
27     sudo -E apt-get install -y \
28             build-essential \
29             cmake \
30             curl \
31             wget \
32             libssl-dev \
33             ca-certificates \
34             git \
35             libboost-regex-dev \
36             gcc-multilib \
37             g++-multilib \
38             libgtk2.0-dev \
39             pkg-config \
40             unzip \
41             automake \
42             libtool \
43             autoconf \
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     if [ $system_ver = "18.04" ]; then
56             sudo -E apt-get install -y libpng-dev
57     else
58             sudo -E apt-get install -y libpng12-dev
59     fi
60 else
61     # CentOS 7.x
62     sudo -E yum install -y centos-release-scl epel-release
63     sudo -E yum install -y \
64             wget \
65             tar \
66             xz \
67             p7zip \
68             unzip \
69             yum-plugin-ovl \
70             which \
71             libssl-dev \
72             ca-certificates \
73             git \
74             boost-devel \
75             libtool \
76             gcc \
77             gcc-c++ \
78             make \
79             glibc-static \
80             glibc-devel \
81             libstdc++-static \
82             libstdc++-devel \
83             libstdc++ libgcc \
84             glibc-static.i686 \
85             glibc-devel.i686 \
86             libstdc++-static.i686 \
87             libstdc++.i686 \
88             libgcc.i686 \
89             libusbx-devel \
90             openblas-devel \
91             libusbx-devel \
92             gstreamer1 \
93             gstreamer1-plugins-base
94
95     # Python 3.6 for Model Optimizer
96     sudo -E yum install -y rh-python36
97     source scl_source enable rh-python36
98
99     wget https://cmake.org/files/v3.12/cmake-3.12.3.tar.gz
100     tar xf cmake-3.12.3.tar.gz
101     cd cmake-3.12.3
102     ./configure
103     make -j16
104     sudo -E make install
105
106     echo
107     echo "FFmpeg is required for processing audio and video streams with OpenCV. Please select your preferred method for installing FFmpeg:"
108     echo
109     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. "
110     echo "WARNING: This repository is NOT PROVIDED OR SUPPORTED by CentOS."
111     echo "Once added, this repository will be enabled on your operating system and can thus receive updates to all packages installed from it. "
112     echo
113     echo "Consider the following ways to prevent unintended 'updates' from this third party repository from over-writing some core part of CentOS:"
114     echo "a) Only enable these archives from time to time, and generally leave them disabled. See: man yum"
115     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"
116     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."
117     echo
118     echo "Option 2: Skip FFmpeg installation."
119     echo
120
121     if yes_or_no; then
122         sudo -E rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-1.el7.nux.noarch.rpm
123         sudo -E yum install -y ffmpeg
124     else
125         echo "FFmpeg installation skipped. You may build FFmpeg from sources as described here: https://trac.ffmpeg.org/wiki/CompilationGuide/Centos"
126         echo
127     fi
128
129 fi