[Dist/Tizen] Add a runtime dependency on the MvNCS2 firmware package
[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 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             libcairo2-dev \
44             libpango1.0-dev \
45             libglib2.0-dev \
46             libgtk2.0-dev \
47             libswscale-dev \
48             libavcodec-dev \
49             libavformat-dev \
50             libgstreamer1.0-0 \
51             gstreamer1.0-plugins-base \
52             libusb-1.0-0-dev \
53             libopenblas-dev
54     if apt-cache search --names-only '^libpng12'| grep -q libpng12; then
55         sudo -E apt-get install -y libpng12-dev
56     else
57         sudo -E apt-get install -y libpng-dev
58     fi
59 elif [ -f /etc/redhat-release ]; then
60     # CentOS 7.x
61     sudo -E yum install -y centos-release-scl epel-release
62     sudo -E yum install -y \
63             wget \
64             tar \
65             xz \
66             p7zip \
67             unzip \
68             yum-plugin-ovl \
69             which \
70             libssl-dev \
71             ca-certificates \
72             git \
73             boost-devel \
74             libtool \
75             gcc \
76             gcc-c++ \
77             make \
78             glibc-static \
79             glibc-devel \
80             libstdc++-static \
81             libstdc++-devel \
82             libstdc++ libgcc \
83             glibc-static.i686 \
84             glibc-devel.i686 \
85             libstdc++-static.i686 \
86             libstdc++.i686 \
87             libgcc.i686 \
88             libusbx-devel \
89             openblas-devel \
90             libusbx-devel \
91             gstreamer1 \
92             gstreamer1-plugins-base
93
94     # Python 3.6 for Model Optimizer
95     sudo -E yum install -y rh-python36
96     source scl_source enable rh-python36
97
98     wget https://cmake.org/files/v3.12/cmake-3.12.3.tar.gz
99     tar xf cmake-3.12.3.tar.gz
100     cd cmake-3.12.3
101     ./configure
102     make -j16
103     sudo -E make install
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             cmake \
133             curl \
134             wget \
135             libssl-dev \
136             ca-certificates \
137             git \
138             libboost-regex-dev \
139             libgtk2.0-dev \
140             pkg-config \
141             unzip \
142             automake \
143             libtool \
144             autoconf \
145             libcairo2-dev \
146             libpango1.0-dev \
147             libglib2.0-dev \
148             libgtk2.0-dev \
149             libswscale-dev \
150             libavcodec-dev \
151             libavformat-dev \
152             libgstreamer1.0-0 \
153             gstreamer1.0-plugins-base \
154             libusb-1.0-0-dev \
155             libopenblas-dev
156     if apt-cache search --names-only '^libpng12'| grep -q libpng12; then
157         sudo -E apt-get install -y libpng12-dev
158     else
159         sudo -E apt-get install -y libpng-dev
160     fi
161 else
162     echo "Unknown OS, please install build dependencies manually"
163 fi