anjana_sreekumar@infosys.com | 991c206 | 2020-01-08 11:42:57 +0530 | [diff] [blame^] | 1 | #!/bin/bash |
| 2 | # |
| 3 | # Copyright 2019-present Open Networking Foundation |
| 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
| 16 | # |
| 17 | |
| 18 | SUDO='' |
| 19 | [[ $EUID -ne 0 ]] && SUDO=sudo |
| 20 | |
| 21 | install_build_pkg_deps() { |
| 22 | $SUDO apt-get update && $SUDO apt-get install -y \ |
| 23 | git \ |
| 24 | build-essential \ |
| 25 | cmake \ |
| 26 | libuv-dev \ |
| 27 | libgcrypt-dev \ |
| 28 | libidn11-dev \ |
| 29 | bison \ |
| 30 | flex \ |
| 31 | libgnutls-dev \ |
| 32 | libsctp-dev \ |
| 33 | libssl-dev \ |
| 34 | autoconf \ |
| 35 | libtool \ |
| 36 | pkg-config \ |
| 37 | curl \ |
| 38 | automake \ |
| 39 | make \ |
| 40 | unzip |
| 41 | } |
| 42 | |
| 43 | install_freediameter() { |
| 44 | $SUDO rm -rf /tmp/freediameter |
| 45 | git clone -q https://github.com/omec-project/freediameter.git /tmp/freediameter |
| 46 | pushd /tmp/freediameter |
| 47 | mkdir -p build && cd build |
| 48 | cmake -DDISABLE_SCTP:BOOL=OFF .. && make -j && $SUDO make install |
| 49 | } |
| 50 | |
| 51 | install_grpc() { |
| 52 | $SUDO rm -rf /tmp/grpc |
| 53 | git clone -b $(curl -L https://grpc.io/release) \ |
| 54 | -q https://github.com/grpc/grpc /tmp/grpc |
| 55 | cd /tmp/grpc && \ |
| 56 | git submodule update --init && \ |
| 57 | CXXFLAGS='-Wno-error' make && make install && ldconfig |
| 58 | } |
| 59 | |
| 60 | install_build_deps() { |
| 61 | install_build_pkg_deps |
| 62 | install_freediameter |
| 63 | install_grpc |
| 64 | } |
| 65 | |
| 66 | (return 2>/dev/null) && echo "Sourced" && return |
| 67 | |
| 68 | set -o errexit |
| 69 | set -o pipefail |
| 70 | set -o nounset |
| 71 | |
| 72 | install_build_deps |
| 73 | echo "Dependency install completed" |