Improve fb_compile_mongo.sh

Summary: If we create a new temp directory for each build, scons will recompile everything because we have different parameters. Instead, let's set up a constant path to our static lib. That way we won't have to recompile.

Test Plan: Run fb_compile_mongo.sh twice -- second time it didn't recompile everything

Reviewers: MarkCallaghan, anthony

Reviewed By: anthony

Subscribers: dhruba, leveldb

Differential Revision: https://reviews.facebook.net/D40707
main
Igor Canadi 10 years ago
parent c9cd404bcd
commit 472e64d39e
  1. 17
      build_tools/fb_compile_mongo.sh

@ -3,7 +3,7 @@
if test -z $ROCKSDB_PATH; then if test -z $ROCKSDB_PATH; then
ROCKSDB_PATH=~/rocksdb ROCKSDB_PATH=~/rocksdb
fi fi
source $ROCKSDB_PATH/build_tools/fbcode_config.sh source $ROCKSDB_PATH/build_tools/fbcode_config4.8.1.sh
EXTRA_LDFLAGS="" EXTRA_LDFLAGS=""
@ -16,11 +16,12 @@ elif [[ $ALLOC == "jemalloc" ]]; then
fi fi
# we need to force mongo to use static library, not shared # we need to force mongo to use static library, not shared
TEMP_COMPILE_DIR=`mktemp -d /tmp/tmp.mongo_compile.XXX` STATIC_LIB_DEP_DIR='build/static_library_dependencies'
ln -s $SNAPPY_LIBS $TEMP_COMPILE_DIR test -d $STATIC_LIB_DEP_DIR || mkdir $STATIC_LIB_DEP_DIR
ln -s $LZ4_LIBS $TEMP_COMPILE_DIR test -h $STATIC_LIB_DEP_DIR/`basename $SNAPPY_LIBS` || ln -s $SNAPPY_LIBS $STATIC_LIB_DEP_DIR
test -h $STATIC_LIB_DEP_DIR/`basename $LZ4_LIBS` || ln -s $LZ4_LIBS $STATIC_LIB_DEP_DIR
EXTRA_LDFLAGS+=" -L $TEMP_COMPILE_DIR" EXTRA_LDFLAGS+=" -L $STATIC_LIB_DEP_DIR"
set -x set -x
@ -37,7 +38,7 @@ fi
scons \ scons \
LINKFLAGS="$EXTRA_LDFLAGS $EXEC_LDFLAGS $PLATFORM_LDFLAGS" \ LINKFLAGS="$EXTRA_LDFLAGS $EXEC_LDFLAGS $PLATFORM_LDFLAGS" \
CCFLAGS="$CXXFLAGS -L $TEMP_COMPILE_DIR" \ CCFLAGS="$CXXFLAGS -L $STATIC_LIB_DEP_DIR" \
LIBS="lz4 gcc stdc++" \ LIBS="lz4 gcc stdc++" \
LIBPATH="$ROCKSDB_PATH" \ LIBPATH="$ROCKSDB_PATH" \
CPPPATH="$ROCKSDB_PATH/include" \ CPPPATH="$ROCKSDB_PATH/include" \
@ -45,9 +46,7 @@ scons \
--allocator=$ALLOC \ --allocator=$ALLOC \
--nostrip \ --nostrip \
--opt=on \ --opt=on \
--disable-minimum-compiler-version-enforcement \
--use-system-snappy \ --use-system-snappy \
--disable-warnings-as-errors \ --disable-warnings-as-errors \
$EXTRA_CMD $* $EXTRA_CMD $*
set +x
rm -rf $TEMP_COMPILE_DIR

Loading…
Cancel
Save