-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall_protobuf.sh
executable file
·30 lines (25 loc) · 1.23 KB
/
install_protobuf.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
#!/usr/bin/bash
############################################
# #
# This script builds protobuf #
# #
############################################
if [ "X$app_dir" == "X" ]; then
. $(dirname $0)/utils.sh
fi
if [ "X$PROTOBUF_HOME" == "X" ] ; then
green_echo "================================ install protobuf to $PROTOBUF_HOME ================================"
[ "X$PROTOBUF_VERSION" == "X" ] && [ $# -eq 1 ] && export PROTOBUF_VERSION=$1
PROTOBUF_HOME=$app_dir/protobuf-${PROTOBUF_VERSION}
cd $src_dir
[ -e protobuf-cpp-3.5.0.tar.gz ] || wget https://github.com/protocolbuffers/protobuf/releases/download/v3.5.0/protobuf-cpp-3.5.0.tar.gz
[ -e protobuf-3.5.0 ] || untar protobuf-cpp-3.5.0.tar.gz
cd protobuf-3.5.0
./configure CXXFLAGS=-fPIC --prefix=${PROTOBUF_HOME} && make -j $make_threads install || exit 1
export PROTOBUF_HOME
echo export PROTOBUF_HOME=$PROTOBUF_HOME >> $bashrc
echo export LD_LIBRARY_PATH=$PROTOBUF_HOME/lib:\$LD_LIBRARY_PATH >> $bashrc
else
green_echo "================================ protobuf home $PROTOBUF_HOME ================================"
fi
export CMAKE_PREFIX_PATH=$PROTOBUF_HOME:$CMAKE_PREFIX_PATH