-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_e2sim.sh
executable file
·110 lines (92 loc) · 1.88 KB
/
build_e2sim.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
#!/bin/bash
## dependencies
#set -x
root_folder=$(pwd)
cmake_build_type="Release"
function build_json_from_source(){
git submodule init && git submodule update
cd $root_folder/e2sm_examples/kpm_e2sm/nlohmann_json_release
mkdir build || true
cd build/
cmake ..
make -j ${nproc}
make install
ldconfig
}
function clean_build(){
rm -rf $root_folder/build
}
function install_dependencies(){
apt-get update && apt-get install -y \
build-essential \
git \
cmake \
libsctp-dev \
lksctp-tools \
autoconf \
automake \
libtool \
bison \
flex \
libboost-all-dev
#build_json_from_source
}
function print_help(){
echo "Usage:"
echo "-h: print this message"
echo "-i: install required dependencies"
echo "-c: clean build files"
echo "-g: debug build"
exit 1
}
until [ -z "$1" ]
do
case "$1" in
-h)
print_help
shift;;
-i)
install_dependencies
shift;;
-c)
clean_build
shift;;
-g)
cmake_build_type="Debug"
shift;;
*)
print_help
break;;
esac
done
# this is the main code
# reset to root folder
cd $root_folder
CURR_DIR=$(pwd)
DEBUG=1
# build e2sim
rm -Rf build
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=cmake_build_type ..
make -j ${nproc} package
cmake .. -DDEV_PKG=1
make -j ${nproc} package
make -j ${nproc} install
ldconfig
# unistall old versions
apt-get remove --purge -y e2sim-dev
apt-get remove --purge -y e2sim
# install new ones
dpkg --install $(pwd)/e2sim*
#dpkg --install ./e2sim-dev_?.?.?_amd64.deb
# setup debug field
echo -e "\n[`date`] Setting metrics DEBUG field to ${DEBUG}\n"
sed -i "s/^#define DEBUG.*/#define DEBUG ${DEBUG}/g" ${CURR_DIR}/e2sm_examples/kpm_e2sm/src/kpm/bs_connector.hpp
# build example
cd ${CURR_DIR}/e2sm_examples/kpm_e2sm/
rm -Rf build
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=cmake_build_type ..
make -j ${nproc}