-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
172 lines (156 loc) · 4.73 KB
/
build.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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
#!/bin/bash
set -e -u -E # this script will exit if any sub-command fails
########################################
# download & build depend software
########################################
WORK_DIR=`pwd`
DEPS_SOURCE=`pwd`/thirdsrc
DEPS_PREFIX=`pwd`/thirdparty
DEPS_CONFIG="--prefix=${DEPS_PREFIX} --disable-shared --with-pic"
mkdir -p $DEPS_PREFIX/lib $DEPS_PREFIX/include
export PATH=${DEPS_PREFIX}/bin:$PATH
mkdir -p ${DEPS_SOURCE} ${DEPS_PREFIX}
cd ${DEPS_SOURCE}
# boost
if [ -f "boost_succ" ]
then
echo "boost exist"
else
echo "start install boost...."
wget https://github.com/elasticlog/deps/files/621702/boost-header-only.tar.gz >/dev/null
tar zxf boost-header-only.tar.gz >/dev/null
mv boost ${DEPS_PREFIX}/include
touch boost_succ
echo "install boost done"
fi
if [ -f "gtest_succ" ]
then
echo "gtest exist"
else
echo "install gtest ...."
wget -O gtest-1.7.0.zip http://github.com/google/googletest/archive/release-1.7.0.zip >/dev/null
unzip gtest-1.7.0.zip
GTEST_DIR=$DEPS_SOURCE/googletest-release-1.7.0
cd googletest-release-1.7.0
cmake -DCMAKE_INSTALL_PREFIX=${DEPS_PREFIX} -DCMAKE_CXX_FLAGS=-fPIC >/dev/null
make -j2
cp -rf include/gtest ${DEPS_PREFIX}/include
cp libgtest.a libgtest_main.a ${DEPS_PREFIX}/lib
cd $DEPS_SOURCE
touch gtest_succ
echo "install gtest done"
fi
if [ -f "protobuf_succ" ]
then
echo "protobuf exist"
else
echo "start install protobuf ..."
# protobuf
# wget --no-check-certificate https://github.com/google/protobuf/releases/download/v2.6.1/protobuf-2.6.1.tar.gz
git clone --depth=1 https://github.com/00k/protobuf >/dev/null
mv protobuf/protobuf-2.6.1.tar.gz .
tar zxf protobuf-2.6.1.tar.gz >/dev/null
cd protobuf-2.6.1
./configure ${DEPS_CONFIG} >/dev/null
make -j2 >/dev/null
make install
cd -
touch protobuf_succ
echo "install protobuf done"
fi
if [ -f "snappy_succ" ]
then
echo "snappy exist"
else
echo "start install snappy ..."
# snappy
# wget --no-check-certificate https://snappy.googlecode.com/files/snappy-1.1.1.tar.gz
git clone --depth=1 https://github.com/00k/snappy
mv snappy/snappy-1.1.1.tar.gz .
tar zxf snappy-1.1.1.tar.gz >/dev/null
cd snappy-1.1.1
./configure ${DEPS_CONFIG} >/dev/null
make -j2 >/dev/null
make install
cd -
touch snappy_succ
echo "install snappy done"
fi
if [ -f "sofa_succ" ]
then
echo "sofa exist"
else
# sofa-pbrpc
#wget --no-check-certificate -O sofa-pbrpc-1.0.0.tar.gz https://github.com/BaiduPS/sofa-pbrpc/archive/v1.0.0.tar.gz
#tar zxf sofa-pbrpc-1.0.0.tar.gz
git clone https://github.com/baidu/sofa-pbrpc.git
cd sofa-pbrpc
echo "BOOST_HEADER_DIR=${DEPS_PREFIX}/include" >> depends.mk
echo "PROTOBUF_DIR=${DEPS_PREFIX}" >> depends.mk
echo "SNAPPY_DIR=${DEPS_PREFIX}" >> depends.mk
echo "PREFIX=${DEPS_PREFIX}" >> depends.mk
cd -
cd sofa-pbrpc/src
sh compile_proto.sh ${DEPS_PREFIX}/include
cd -
cd sofa-pbrpc
make -j2 >/dev/null
make install
cd -
touch sofa_succ
fi
if [ -f "gflags_succ" ]
then
echo "gflags-2.1.1.tar.gz exist"
else
# gflags
wget --no-check-certificate -O gflags-2.2.0.tar.gz https://github.com/elasticlog/deps/files/789206/gflags-2.2.0.tar.gz
tar zxf gflags-2.2.0.tar.gz
cd gflags-2.2.0
cmake -DCMAKE_INSTALL_PREFIX=${DEPS_PREFIX} -DGFLAGS_NAMESPACE=google -DCMAKE_CXX_FLAGS=-fPIC >/dev/null
make -j2 >/dev/null
make install
cd -
touch gflags_succ
fi
if [ -f "common_succ" ]
then
echo "common exist"
else
# common
git clone https://github.com/baidu/common.git
cd common
sed -i 's/^INCLUDE_PATH=.*/INCLUDE_PATH=-Iinclude -I..\/..\/thirdparty\/include/' Makefile
make -j2 >/dev/null
cp -rf include/* ${DEPS_PREFIX}/include
cp -rf libcommon.a ${DEPS_PREFIX}/lib
cd -
touch common_succ
fi
if [ -f "libunwind_succ" ]
then
echo "libunwind succ exist"
else
wget --no-check-certificate -O libunwind-1.2.tar.gz http://download.savannah.gnu.org/releases/libunwind/libunwind-1.2.tar.gz
tar -zxvf libunwind-1.2.tar.gz
cd libunwind-1.2
./configure --enable-shared=no --enable-static=yes --prefix=${DEPS_PREFIX}
make -j8 && make install
cd -
touch libunwind_succ
fi
if [ -f "gperf_tool" ]
then
echo "gperf_tool exist"
else
wget --no-check-certificate -O gperftools-2.5.tar.gz https://github.com/gperftools/gperftools/releases/download/gperftools-2.5/gperftools-2.5.tar.gz
tar -zxvf gperftools-2.5.tar.gz
cd gperftools-2.5
export LDFLAGS=-L${DEPS_PREFIX}/lib
export CPPFLAGS=-I${DEPS_PREFIX}/include
./configure --enable-shared=no --enable-static=yes --enable-libunwind --prefix=${DEPS_PREFIX}
make -j2 >/dev/null
make install
cd -
touch gperf_tool
fi