Disable test ExecGraphSerializationTest.ExecutionGraph_CPU (#3097)
[platform/upstream/dldt.git] / install_build_dependencies.sh
1 #!/bin/bash
2 # Copyright (C) 2018 Intel Corporation
3 # SPDX-License-Identifier: Apache-2.0
4 #
5
6 params=$1
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             curl \
36             wget \
37             libssl-dev \
38             ca-certificates \
39             git \
40             libboost-regex-dev \
41             $x86_64_specific_packages \
42             libgtk2.0-dev \
43             pkg-config \
44             unzip \
45             automake \
46             libtool \
47             autoconf \
48             shellcheck \
49             python \
50             libcairo2-dev \
51             libpango1.0-dev \
52             libglib2.0-dev \
53             libgtk2.0-dev \
54             libswscale-dev \
55             libavcodec-dev \
56             libavformat-dev \
57             libgstreamer1.0-0 \
58             gstreamer1.0-plugins-base \
59             libusb-1.0-0-dev \
60             libopenblas-dev
61     if apt-cache search --names-only '^libpng12-dev'| grep -q libpng12; then
62         sudo -E apt-get install -y libpng12-dev
63     else
64         sudo -E apt-get install -y libpng-dev
65     fi
66 elif [ -f /etc/redhat-release ]; then
67     # CentOS 7.x
68     sudo -E yum install -y centos-release-scl epel-release
69     sudo -E yum install -y \
70             wget \
71             tar \
72             xz \
73             p7zip \
74             unzip \
75             yum-plugin-ovl \
76             which \
77             libssl-dev \
78             ca-certificates \
79             git \
80             boost-devel \
81             libtool \
82             gcc \
83             gcc-c++ \
84             make \
85             glibc-static \
86             glibc-devel \
87             libstdc++-static \
88             libstdc++-devel \
89             libstdc++ libgcc \
90             glibc-static.i686 \
91             glibc-devel.i686 \
92             libstdc++-static.i686 \
93             libstdc++.i686 \
94             libgcc.i686 \
95             libusbx-devel \
96             openblas-devel \
97             libusbx-devel \
98             gstreamer1 \
99             gstreamer1-plugins-base
100
101     # Python 3.6 for Model Optimizer
102     sudo -E yum install -y rh-python36
103     source scl_source enable rh-python36
104
105     echo
106     echo "FFmpeg is required for processing audio and video streams with OpenCV. Please select your preferred method for installing FFmpeg:"
107     echo
108     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. "
109     echo "WARNING: This repository is NOT PROVIDED OR SUPPORTED by CentOS."
110     echo "Once added, this repository will be enabled on your operating system and can thus receive updates to all packages installed from it. "
111     echo
112     echo "Consider the following ways to prevent unintended 'updates' from this third party repository from over-writing some core part of CentOS:"
113     echo "a) Only enable these archives from time to time, and generally leave them disabled. See: man yum"
114     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"
115     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."
116     echo
117     echo "Option 2: Skip FFmpeg installation."
118     echo
119
120     if yes_or_no; then
121         sudo -E rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-1.el7.nux.noarch.rpm
122         sudo -E yum install -y ffmpeg
123     else
124         echo "FFmpeg installation skipped. You may build FFmpeg from sources as described here: https://trac.ffmpeg.org/wiki/CompilationGuide/Centos"
125         echo
126     fi
127 elif [ -f /etc/os-release ] && grep -q "raspbian" /etc/os-release; then
128     # Raspbian
129     sudo -E apt update
130     sudo -E apt-get install -y \
131             build-essential \
132             curl \
133             wget \
134             libssl-dev \
135             ca-certificates \
136             git \
137             libboost-regex-dev \
138             libgtk2.0-dev \
139             pkg-config \
140             unzip \
141             automake \
142             libtool \
143             autoconf \
144             libcairo2-dev \
145             libpango1.0-dev \
146             libglib2.0-dev \
147             libgtk2.0-dev \
148             libswscale-dev \
149             libavcodec-dev \
150             libavformat-dev \
151             libgstreamer1.0-0 \
152             gstreamer1.0-plugins-base \
153             libusb-1.0-0-dev \
154             libopenblas-dev
155     if apt-cache search --names-only '^libpng12-dev'| grep -q libpng12; then
156         sudo -E apt-get install -y libpng12-dev
157     else
158         sudo -E apt-get install -y libpng-dev
159     fi
160 else
161     echo "Unknown OS, please install build dependencies manually"
162 fi
163
164 # cmake 3.13 or higher is required to build OpenVINO
165 current_cmake_version=$(cmake --version | sed -ne 's/[^0-9]*\(\([0-9]\.\)\{0,4\}[0-9][^.]\).*/\1/p')
166 required_cmake_ver=3.13
167 if [ ! "$(printf '%s\n' "$required_cmake_ver" "$current_cmake_version" | sort -V | head -n1)" = "$required_cmake_ver" ]; then
168     wget "https://github.com/Kitware/CMake/releases/download/v3.18.4/cmake-3.18.4.tar.gz"
169     tar xf cmake-3.18.4.tar.gz
170     (cd cmake-3.18.4 && ./bootstrap --parallel="$(nproc --all)" && make --jobs="$(nproc --all)" && sudo make install)
171     rm -rf cmake-3.18.4 cmake-3.18.4.tar.gz
172 fi