-
Notifications
You must be signed in to change notification settings - Fork 31
/
install_builddeps.sh
executable file
·127 lines (113 loc) · 2.47 KB
/
install_builddeps.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#!/usr/bin/env bash
# Copyright 2019-present Open Networking Foundation
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2019 Intel Corporation
SUDO=''
[[ $EUID -ne 0 ]] && SUDO=sudo
CUR_DIR=$PWD
function finish() {
cd $CUR_DIR
}
trap finish EXIT
install_pkg_deps() {
$SUDO apt-get update && $SUDO apt-get -y install \
automake \
autotools-dev \
bison \
cmake \
flex \
g++ \
gcc \
libgcrypt-dev \
libgnutls-dev \
libidn11-dev \
libmemcached-dev \
libsctp-dev \
libssl-dev \
libtool-bin \
libuv1-dev \
m4 \
make \
memcached \
nettle-dev \
curl \
libcurl4-openssl-dev \
wget
}
DEPS_DIR=${DEPS_DIR:-"$PWD/modules"}
CPUS=${CPUS:-''}
install_freediameter() {
echo "Installing freeDiameter"
cd $DEPS_DIR/freeDiameter
mkdir build && cd build
cmake -DDISABLE_SCTP:BOOL=ON ../
make -j $CPUS
$SUDO make install
}
install_c-ares() {
echo "Installing c-ares"
cd $DEPS_DIR/c-ares
./buildconf
./configure
make -j $CPUS
$SUDO make install
}
install_cpp-driver() {
echo "Installing cpp-driver"
cd $DEPS_DIR/cpp-driver
mkdir build && cd build
cmake ../
make -j $CPUS
$SUDO make install
}
install_rapidjson() {
echo "Installing rapidjson"
cd $DEPS_DIR/rapidjson
mkdir build && cd build
cmake ../
make -j $CPUS
$SUDO make install
}
install_pistache() {
cd /tmp
wget https://github.com/Kitware/CMake/releases/download/v3.18.0/cmake-3.18.0-Linux-x86_64.tar.gz
tar -zxvf cmake-3.18.0-Linux-x86_64.tar.gz
echo "Installing pistache"
cd $DEPS_DIR/pistache
echo $PWD
cat ../../patches/pistache.patch.1.txt
ls -l include/pistache/router.h
cat include/pistache/router.h
ls -l include/pistache/string_logger.h
cat include/pistache/string_logger.h
patch -p1 < ../../patches/pistache.patch.1.txt
mkdir build && cd build
/tmp/cmake-3.18.0-Linux-x86_64/bin/cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release ../
make -j $CPUS
$SUDO make install
}
install_prometheus() {
set -xe
pushd /tmp
pushd $DEPS_DIR/prometheus-cpp
mkdir -p _build && cd _build
/tmp/cmake-3.18.0-Linux-x86_64/bin/cmake .. -DBUILD_SHARED_LIBS=ON && make -j 4 && $SUDO make install && $SUDO make DESTDIR=`pwd`/deploy install
echo $PWD
popd
popd
}
install_build_deps() {
install_pkg_deps
install_freediameter
install_c-ares
install_cpp-driver
install_rapidjson
install_pistache
install_prometheus
}
(return 2>/dev/null) && echo "Sourced" && return
set -o errexit
set -o pipefail
set -o nounset
install_build_deps
echo "Dependency install complete"