-
Notifications
You must be signed in to change notification settings - Fork 57
/
build-all.sh
executable file
·132 lines (109 loc) · 2.99 KB
/
build-all.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
128
129
130
131
132
#!/bin/sh
ROOTDIR=`pwd`
DPDK_DIR=$ROOTDIR/dpdk
ODP_DPDK_DIR=$ROOTDIR/odp-dpdk
ODP_DPDK_INSTALL_DIR=$ROOTDIR/odp-dpdk/install
OFP_DIR=$ROOTDIR/ofp
OFP_VS_INSTALL_DIR=$ROOTDIR/ofp_vs
RTE_TARGET=x86_64-native-linuxapp-gcc
echo '#include "pcap.h"' | cpp -H -o /dev/null 2>&1
if [ "$?" != "0" ]; then
echo "Error: pcap is not installed. You may need to install libpcap-dev"
fi
#Fetch and build dpdk
if [ ! -d $DPDK_DIR ]; then
#git clone git://dpdk.org/dpdk $DPDK_DIR
git -c advice.detachedHead=false clone -q --depth=1 --single-branch --branch=v17.02 http://dpdk.org/git/dpdk $DPDK_DIR
fi
if [ ! -d $DPDK_DIR/$RTE_TARGET ]; then
cd $DPDK_DIR
make config T=$RTE_TARGET O=$RTE_TARGET
cd $DPDK_DIR/$RTE_TARGET
sed -ri 's,(CONFIG_RTE_LIBRTE_PMD_PCAP=).*,\1y,' .config
#sed -ri 's,(CONFIG_RTE_LIBRTE_PMD_OPENSSL=).*,\1y,' .config
cd $DPDK_DIR
make install T=$RTE_TARGET EXTRA_CFLAGS="-fPIC"
fi
if [ "$?" != "0" ]; then
echo "Build dpdk error!"
exit $?
fi
export RTE_SDK=$DPDK_DIR
export RTE_TARGET=$RTE_TARGET
#Fetch and build odp-dpdk
if [ ! -d $ODP_DPDK_DIR ]; then
git clone https://github.com/lvsgate/odp-dpdk.git $ODP_DPDK_DIR
fi
cd $ODP_DPDK_DIR
git pull
if [ ! -d $ODP_DPDK_INSTALL_DIR ]; then
mkdir $ODP_DPDK_INSTALL_DIR
fi
./bootstrap
./configure --enable-shared --with-platform=linux-dpdk --enable-helper-linux --with-sdk-install-path=$DPDK_DIR/$RTE_TARGET --prefix=$ODP_DPDK_INSTALL_DIR
if [ "$?" != "0" ]; then
echo "Configure odp-dpdk error!"
exit $?
fi
make
if [ "$?" != "0" ]; then
echo "Build odp-dpdk error!"
exit $?
fi
make install
if [ "$?" != "0" ]; then
echo "Build odp-dpdk error!"
exit $?
fi
#Fetch and build ofp
yum install libnl3 libnl3-cli libnl3-devel
if [ ! -d $OFP_DIR ]; then
git clone https://github.com/lvsgate/ofp.git $OFP_DIR
fi
cd $OFP_DIR
git pull
./bootstrap
./configure --disable-libconfig --with-odp-lib=odp-dpdk --with-odp=$ODP_DPDK_INSTALL_DIR --enable-shared=no --enable-sp=yes --disable-mtrie CPPFLAGS=-I$ODP_DPDK_INSTALL_DIR/include/odp/arch/x86_64-linux/
if [ "$?" != "0" ]; then
echo "Configure ofp error!"
exit $?
fi
make
if [ "$?" != "0" ]; then
echo "Build ofp error!"
exit $?
fi
if [ ! -d $OFP_VS_INSTALL_DIR ]; then
mkdir $OFP_VS_INSTALL_DIR
fi
cp $OFP_DIR/example/ofp_vs/ofp_vs $OFP_VS_INSTALL_DIR
cp $OFP_DIR/example/ofp_vs/ofp.conf $OFP_VS_INSTALL_DIR
cp $OFP_DIR/example/ofp_vs/start.sh $OFP_VS_INSTALL_DIR
if [ "$?" != "0" ]; then
echo "Build ofp error!"
exit $?
fi
#Fetch and build lvs-dpdk tools
cd $ROOTDIR/tools/keepalived
sh configure --prefix=/usr --sysconfdir=/etc/ CPPFLAGS=-I/usr/include/libnl3/ LDFLAGS=-L/usr/lib64/
make
if [ "$?" != "0" ]; then
echo "Build ipvsadm error!"
exit $?
fi
make install
if [ "$?" != "0" ]; then
echo "Build keepalived error!"
exit $?
fi
cd $ROOTDIR/tools/ipvsadm
make
if [ "$?" != "0" ]; then
echo "Build ipvsadm error!"
exit $?
fi
make install
if [ "$?" != "0" ]; then
echo "Build ipvsadm error!"
exit $?
fi