代码拉取完成,页面将自动刷新
#!/bin/sh
BASE_DIR=`pwd`
LIBEVENT_PATH="$BASE_DIR/deps/libevent2"
TCMALLOC_PATH="$BASE_DIR/deps/gperftools2"
if test -z "$TARGET_OS"; then
TARGET_OS=`uname -s`
fi
if test -z "$MAKE"; then
MAKE=make
fi
if test -z "$CC"; then
CC=gcc
fi
if test -z "$CXX"; then
CXX=g++
fi
case "$TARGET_OS" in
Darwin)
PLATFORM_CLIBS="-ldl -pthread -std=c++0x"
;;
Linux)
PLATFORM_CLIBS="-ldl -pthread -lrt -std=c++0x"
;;
OS_ANDROID_CROSSCOMPILE)
PLATFORM_CLIBS="-ldl -pthread -lrt -std=c++0x"
;;
CYGWIN_*)
PLATFORM_CLIBS="-ldl -pthread -lrt -std=c++0x"
;;
SunOS)
PLATFORM_CLIBS="-ldl -pthread -lrt -std=c++0x"
;;
FreeBSD)
PLATFORM_CLIBS="-ldl -pthread -lrt -std=c++0x"
MAKE=gmake
;;
NetBSD)
PLATFORM_CLIBS="-ldl -pthread -lgcc_s -lrt -std=c++0x"
;;
OpenBSD)
PLATFORM_CLIBS="-ldl -pthread -lrt -std=c++0x"
;;
DragonFly)
PLATFORM_CLIBS="-ldl -pthread -lrt -std=c++0x"
;;
HP-UX)
PLATFORM_CLIBS="-ldl -pthread -lrt -std=c++0x"
;;
*)
echo "Unknown platform!" >&2
exit 1
esac
DIR=`pwd`
cd $LIBEVENT_PATH
if [ ! -f "$LIBEVENT_PATH/.libs/libevent.a" ]; then
echo ""
echo "##### building libevent... #####"
./configure
make
cp "$LIBEVENT_PATH/event.h" "$LIBEVENT_PATH/include/event.h"
cp "$LIBEVENT_PATH/evutil.h" "$LIBEVENT_PATH/include/evutil.h"
echo "##### building libevent finished #####"
echo ""
fi
cd "$DIR"
DIR=`pwd`
cd $TCMALLOC_PATH
if [ ! -f "$TCMALLOC_PATH/.libs/libtcmalloc_minimal.a" ]; then
echo ""
echo "##### building tcmalloc... #####"
./configure --disable-cpu-profiler --disable-heap-profiler --disable-heap-checker --disable-debugalloc --enable-minimal
make
echo "##### building tcmalloc finished #####"
echo ""
fi
cd "$DIR"
rm -f build_config.mk
echo CC=$CC >> build_config.mk
echo CXX=$CXX >> build_config.mk
echo "MAKE=$MAKE" >> build_config.mk
echo "LIBEVENT_PATH=$LIBEVENT_PATH" >> build_config.mk
echo "CFLAGS=" >> build_config.mk
echo "CFLAGS = -DNDEBUG -D__STDC_FORMAT_MACROS -g -O2 -Wno-sign-compare" >> build_config.mk
echo "CFLAGS += ${PLATFORM_CFLAGS}" >> build_config.mk
echo "CFLAGS += -I \"$LIBEVENT_PATH/include\"" >> build_config.mk
echo "CLIBS=" >> build_config.mk
echo "CLIBS += ${PLATFORM_CLIBS}" >> build_config.mk
echo "CLIBS += \"$LIBEVENT_PATH/.libs/libevent.a\"" >> build_config.mk
if [ -f "$TCMALLOC_PATH/.libs/libtcmalloc_minimal.a" ]; then
echo "CLIBS += \"$TCMALLOC_PATH/.libs/libtcmalloc_minimal.a\"" >> build_config.mk
fi
echo "##tips: if stoped, please run command [make] again ##"
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。