Commit ab4bea5d authored by gejun's avatar gejun

find accurate incpaths from --incs

Change-Id: I0dcd814d3671a5284442749578a5b4f2da5cbc2a
parent 6b00d0bf
The opensource version of baidu-rpc
BUILD
[ubuntu]
Must: sudo apt-get install libgflags-dev libprotobuf-dev libprotoc-dev libleveldb-dev libsnappy-dev
sh config_brpc.sh --incs=/usr/include --libs=/usr/lib
Enable cpu/heap profiler in some examples (not working yet)
sudo apt-get install libgoogle-perftools-dev libunwind-dev liblzma-dev
Rerun config_brpc.sh
set LINK_PERFTOOLS to 1 in the Makefile
[baidu internal]
Deps: third-64/gflags@gflags_2-0-0-100_PD_BL
third-64/protobuf@protobuf_2-4-1-1100_PD_BL
third-64/leveldb@leveldb_1-0-0-0_PD_BL
sh config_brpc.sh --incs=../../../third-64 --libs=../../../third-64
Enable cpu/heap profiler in some examples
Deps: third-64/tcmalloc@tcmalloc_1-7-0-200_PD_BL
Rerun config_brpc.sh
set LINK_PERFTOOLS to 1 in the Makefile
......@@ -41,20 +41,33 @@ find_lib_or_die() {
find_dir_of_header() {
find ${INCS} -path "*/$1" | sed "s|$1||g"
}
find_dir_of_header_or_die() {
local dir=$(find_dir_of_header $1)
if [ -z "$dir" ]; then
>&2 echo "fail to find $1 from -incs"
exit 1
else
echo $dir
fi
}
GFLAGS_LIB=$(find_lib_or_die libgflags.a)
PROTOBUF_LIB=$(find_lib_or_die libprotobuf.a)
PROTOC_LIB=$(find_lib_or_die libprotoc.a)
PROTOC=$(which protoc)
PROTOC=$(which protoc 2>/dev/null)
if [ -z "$PROTOC" ]; then
PROTOC=$(find_lib_or_die protoc)
fi
PROTOBUF_INC=$(find_dir_of_header google/protobuf/message.h)
LEVELDB_LIB=$(find_lib_or_die libleveldb.a)
SNAPPY_LIB=$(find_lib_or_die libsnappy.a)
SNAPPY_LIB=$(find_lib libsnappy.a)
GFLAGS_INC=$(find_dir_of_header gflags/gflags.h)
PROTOBUF_INC=$(find_dir_of_header google/protobuf/message.h)
LEVELDB_INC=$(find_dir_of_header leveldb/db.h)
NEW_INCS=$(echo $GFLAGS_INC $PROTOBUF_INC $LEVELDB_INC | sort | uniq)
#can't use \n in texts because sh does not support -e
echo "INCS=$INCS" > config.mk
echo "INCS=$NEW_INCS" > config.mk
echo "LIBS=$GFLAGS_LIB $PROTOBUF_LIB $LEVELDB_LIB $SNAPPY_LIB" >> config.mk
echo "PROTOC_LIB=$PROTOC_LIB" >> config.mk
echo "PROTOC=$PROTOC" >> config.mk
......@@ -65,6 +78,10 @@ echo "ifeq (\$(LINK_PERFTOOLS), 1)" >> config.mk
TCMALLOC_LIB=$(find_lib libtcmalloc_and_profiler.a)
if [ ! -z "$TCMALLOC_LIB" ]; then
echo " LIBS+=$TCMALLOC_LIB" >> config.mk
TCMALLOC_INC=$(find_dir_of_header google/tcmalloc.h)
if [ ! -z "$TCMALLOC_INC" ] && [ "$TCMALLOC_INC" != "$INCS" ]; then
echo " INCS+=$TCMALLOC_INC" >> config.mk
fi
fi
UNWIND_LIB=$(find_lib libunwind.a)
if [ ! -z "$UNWIND_LIB" ]; then
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment