aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/build.sh
blob: eaa0f0ef2ee969023f6aafe16432cc26b149f846 (plain)
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
#!/bin/bash -x
#########################################################################
# Copyright (c) 2018 Huawei Technologies Co.,Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#########################################################################

set -x

TIMESTAMP=$(date +%Y-%m-%d_%H-%M-%S)
log_file="/tmp/build_log.txt-$TIMESTAMP"
exec 1> >(tee -a "$log_file")  2>&1

# Get Command Line arguements if present
DMM_DIR=$1
if [ "$1" == "all" ]; then
    BUILD_ALL="YES"
fi

if [ "x$1" != "x" ] && [ "$1" != "all" ]; then
    DMM_DIR=$1
else
    DMM_DIR=`dirname $(readlink -f $0)`/../
fi

echo 0:$0
echo 1:$1
echo 2:$2
echo DMM_DIR: $DMM_DIR

BUILD_DIR=${DMM_DIR}/build

#print os information
bash -x $DMM_DIR/scripts/print_os_info.sh

# add inherited proxy for sudo user
LINE='Defaults env_keep += "ftp_proxy http_proxy https_proxy no_proxy"'
FILE=/etc/sudoers
grep -qF -- "$LINE" "$FILE" || sudo echo "$LINE" >> "$FILE"

#set and check the environment for Linux
bash -x $DMM_DIR/scripts/build_dmm_dep.sh || exit 1

#===========build DPDK================
bash -x $DMM_DIR/scripts/build_dpdk.sh || exit 1

#===========build DMM=================
bash -x $DMM_DIR/scripts/compile_dmm.sh || exit 1

if [ "${BUILD_ALL}" == "YES" ]; then
    #===========build LWIP================
    bash -x $DMM_DIR/stacks/lwip_stack/vagrant/build.sh "from-base-build" || exit 1
    #============build rsocket============================
    bash -x $DMM_DIR/scripts/build_rsocket.sh || exit 1
    #=======other new stacks build can be called from here
    echo "SUCCESSFULLY built all the stacks"
fi