2015-06-24 22:09:55 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2015-06-29 18:43:25 +00:00
|
|
|
# fail early
|
|
|
|
set -e
|
|
|
|
|
2015-06-24 22:09:55 +00:00
|
|
|
if test -z $ROCKSDB_PATH; then
|
|
|
|
ROCKSDB_PATH=~/rocksdb
|
|
|
|
fi
|
2015-06-26 17:24:08 +00:00
|
|
|
source $ROCKSDB_PATH/build_tools/fbcode_config4.8.1.sh
|
2015-06-24 22:09:55 +00:00
|
|
|
|
|
|
|
EXTRA_LDFLAGS=""
|
|
|
|
|
|
|
|
if test -z $ALLOC; then
|
|
|
|
# default
|
|
|
|
ALLOC=tcmalloc
|
|
|
|
elif [[ $ALLOC == "jemalloc" ]]; then
|
|
|
|
ALLOC=system
|
|
|
|
EXTRA_LDFLAGS+=" -Wl,--whole-archive $JEMALLOC_LIB -Wl,--no-whole-archive"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# we need to force mongo to use static library, not shared
|
2015-06-26 17:24:08 +00:00
|
|
|
STATIC_LIB_DEP_DIR='build/static_library_dependencies'
|
|
|
|
test -d $STATIC_LIB_DEP_DIR || mkdir $STATIC_LIB_DEP_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
|
2015-06-24 22:09:55 +00:00
|
|
|
|
2015-06-26 17:24:08 +00:00
|
|
|
EXTRA_LDFLAGS+=" -L $STATIC_LIB_DEP_DIR"
|
2015-06-24 22:09:55 +00:00
|
|
|
|
|
|
|
set -x
|
|
|
|
|
|
|
|
EXTRA_CMD=""
|
|
|
|
if ! test -e version.json; then
|
|
|
|
# this is Mongo 3.0
|
|
|
|
EXTRA_CMD="--rocksdb \
|
|
|
|
--variant-dir=linux2/norm
|
|
|
|
--cxx=${CXX} \
|
|
|
|
--cc=${CC} \
|
|
|
|
--use-system-zlib" # add this line back to normal code path
|
|
|
|
# when https://jira.mongodb.org/browse/SERVER-19123 is resolved
|
|
|
|
fi
|
|
|
|
|
|
|
|
scons \
|
|
|
|
LINKFLAGS="$EXTRA_LDFLAGS $EXEC_LDFLAGS $PLATFORM_LDFLAGS" \
|
2015-06-26 17:24:08 +00:00
|
|
|
CCFLAGS="$CXXFLAGS -L $STATIC_LIB_DEP_DIR" \
|
2015-06-24 22:09:55 +00:00
|
|
|
LIBS="lz4 gcc stdc++" \
|
|
|
|
LIBPATH="$ROCKSDB_PATH" \
|
|
|
|
CPPPATH="$ROCKSDB_PATH/include" \
|
|
|
|
-j32 \
|
|
|
|
--allocator=$ALLOC \
|
|
|
|
--nostrip \
|
|
|
|
--opt=on \
|
2015-06-26 17:24:08 +00:00
|
|
|
--disable-minimum-compiler-version-enforcement \
|
2015-06-24 22:09:55 +00:00
|
|
|
--use-system-snappy \
|
|
|
|
--disable-warnings-as-errors \
|
|
|
|
$EXTRA_CMD $*
|