Fix Mish and SoftPlus value propagation functions (#2120)
[platform/upstream/dldt.git] / 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 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     host_cpu=$(uname -m)
26     if [ $host_cpu = x86_64 ]; then
27         x86_64_specific_packages="gcc-multilib g++-multilib"
28     else
29         x86_64_specific_packages=""
30     fi
31
32     sudo -E apt update
33     sudo -E apt-get install -y \
34             build-essential \
35             cmake \
36             curl \
37             wget \
38             libssl-dev \
39             ca-certificates \
40             git \
41             libboost-regex-dev \
42             $x86_64_specific_packages \
43             libgtk2.0-dev \
44             pkg-config \
45             unzip \
46             automake \
47             libtool \
48             autoconf \
49             libcairo2-dev \
50             libpango1.0-dev \
51             libglib2.0-dev \
52             libgtk2.0-dev \
53             libswscale-dev \
54             libavcodec-dev \
55             libavformat-dev \
56             libgstreamer1.0-0 \
57             gstreamer1.0-plugins-base \
58             libusb-1.0-0-dev \
59             libopenblas-dev
60     if apt-cache search --names-only '^libpng12-dev'| grep -q libpng12; then
61         sudo -E apt-get install -y libpng12-dev
62     else
63         sudo -E apt-get install -y libpng-dev
64     fi
65 elif [ -f /etc/redhat-release ]; then
66     # CentOS 7.x
67     sudo -E yum install -y centos-release-scl epel-release
68     sudo -E yum install -y \
69             wget \
70             tar \
71             xz \
72             p7zip \
73             unzip \
74             yum-plugin-ovl \
75             which \
76             libssl-dev \
77             ca-certificates \
78             git \
79             boost-devel \
80             libtool \
81             gcc \
82             gcc-c++ \
83             make \
84             glibc-static \
85             glibc-devel \
86             libstdc++-static \
87             libstdc++-devel \
88             libstdc++ libgcc \
89             glibc-static.i686 \
90             glibc-devel.i686 \
91             libstdc++-static.i686 \
92             libstdc++.i686 \
93             libgcc.i686 \
94             libusbx-devel \
95             openblas-devel \
96             libusbx-devel \
97             gstreamer1 \
98             gstreamer1-plugins-base
99
100     # Python 3.6 for Model Optimizer
101     sudo -E yum install -y rh-python36
102     source scl_source enable rh-python36
103
104     wget https://cmake.org/files/v3.12/cmake-3.12.3.tar.gz
105     tar xf cmake-3.12.3.tar.gz
106     cd cmake-3.12.3
107     ./configure
108     make -j16
109     sudo -E make install
110
111     echo
112     echo "FFmpeg is required for processing audio and video streams with OpenCV. Please select your preferred method for installing FFmpeg:"
113     echo
114     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. "
115     echo "WARNING: This repository is NOT PROVIDED OR SUPPORTED by CentOS."
116     echo "Once added, this repository will be enabled on your operating system and can thus receive updates to all packages installed from it. "
117     echo
118     echo "Consider the following ways to prevent unintended 'updates' from this third party repository from over-writing some core part of CentOS:"
119     echo "a) Only enable these archives from time to time, and generally leave them disabled. See: man yum"
120     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"
121     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."
122     echo
123     echo "Option 2: Skip FFmpeg installation."
124     echo
125
126     if yes_or_no; then
127         sudo -E rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-1.el7.nux.noarch.rpm
128         sudo -E yum install -y ffmpeg
129     else
130         echo "FFmpeg installation skipped. You may build FFmpeg from sources as described here: https://trac.ffmpeg.org/wiki/CompilationGuide/Centos"
131         echo
132     fi
133 elif [ -f /etc/os-release ] && grep -q "raspbian" /etc/os-release; then
134     # Raspbian
135     sudo -E apt update
136     sudo -E apt-get install -y \
137             build-essential \
138             cmake \
139             curl \
140             wget \
141             libssl-dev \
142             ca-certificates \
143             git \
144             libboost-regex-dev \
145             libgtk2.0-dev \
146             pkg-config \
147             unzip \
148             automake \
149             libtool \
150             autoconf \
151             libcairo2-dev \
152             libpango1.0-dev \
153             libglib2.0-dev \
154             libgtk2.0-dev \
155             libswscale-dev \
156             libavcodec-dev \
157             libavformat-dev \
158             libgstreamer1.0-0 \
159             gstreamer1.0-plugins-base \
160             libusb-1.0-0-dev \
161             libopenblas-dev
162     if apt-cache search --names-only '^libpng12-dev'| grep -q libpng12; then
163         sudo -E apt-get install -y libpng12-dev
164     else
165         sudo -E apt-get install -y libpng-dev
166     fi
167 else
168     echo "Unknown OS, please install build dependencies manually"
169 fi