2013-11-17 22:52:55 +01:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# Set environment variables so that we can compile rocksdb using
|
|
|
|
# fbcode settings. It uses the latest g++ compiler and also
|
|
|
|
# uses jemalloc
|
|
|
|
|
|
|
|
TOOLCHAIN_REV=53dc1fe83f84e9145b9ffb81b81aa7f6a49c87cc
|
2013-11-18 20:40:16 +01:00
|
|
|
CENTOS_VERSION=`rpm -q --qf "%{VERSION}" $(rpm -q --whatprovides redhat-release)`
|
|
|
|
if [ "$CENTOS_VERSION" = "6" ]; then
|
|
|
|
TOOLCHAIN_EXECUTABLES="/mnt/gvfs/third-party/$TOOLCHAIN_REV/centos6-native"
|
|
|
|
else
|
|
|
|
TOOLCHAIN_EXECUTABLES="/mnt/gvfs/third-party/$TOOLCHAIN_REV/centos5.2-native"
|
|
|
|
fi
|
2013-11-17 22:52:55 +01:00
|
|
|
TOOLCHAIN_LIB_BASE="/mnt/gvfs/third-party/$TOOLCHAIN_REV/gcc-4.8.1-glibc-2.17"
|
|
|
|
|
|
|
|
# location of libhdfs libraries
|
|
|
|
if test "$USE_HDFS"; then
|
|
|
|
JAVA_HOME="/usr/local/jdk-6u22-64"
|
|
|
|
JINCLUDE="-I$JAVA_HOME/include -I$JAVA_HOME/include/linux"
|
|
|
|
GLIBC_RUNTIME_PATH="/usr/local/fbcode/gcc-4.8.1-glibc-2.17"
|
|
|
|
HDFSLIB=" -Wl,--no-whole-archive hdfs/libhdfs.a -L$JAVA_HOME/jre/lib/amd64 "
|
|
|
|
HDFSLIB+=" -L$JAVA_HOME/jre/lib/amd64/server -L$GLIBC_RUNTIME_PATH/lib "
|
|
|
|
HDFSLIB+=" -ldl -lverify -ljava -ljvm "
|
|
|
|
fi
|
|
|
|
|
2013-11-18 22:50:34 +01:00
|
|
|
# location of libgcc
|
|
|
|
LIBGCC_INCLUDE=" -I $TOOLCHAIN_LIB_BASE/libgcc/libgcc-4.8.1/8aac7fc/include"
|
|
|
|
LIBGCC_LIBS=" -L $TOOLCHAIN_LIB_BASE/libgcc/libgcc-4.8.1/8aac7fc/libs"
|
|
|
|
|
|
|
|
# location of glibc
|
|
|
|
GLIBC_INCLUDE=" -I $TOOLCHAIN_LIB_BASE/glibc/glibc-2.17/99df8fc/include"
|
|
|
|
GLIBC_LIBS=" -L $TOOLCHAIN_LIB_BASE/glibc/glibc-2.17/99df8fc/lib"
|
|
|
|
|
2013-11-17 22:52:55 +01:00
|
|
|
# location of snappy headers and libraries
|
|
|
|
SNAPPY_INCLUDE=" -I $TOOLCHAIN_LIB_BASE/snappy/snappy-1.0.3/43d84e2/include"
|
|
|
|
SNAPPY_LIBS=" $TOOLCHAIN_LIB_BASE/snappy/snappy-1.0.3/43d84e2/lib/libsnappy.a"
|
|
|
|
|
|
|
|
# location of zlib headers and libraries
|
|
|
|
ZLIB_INCLUDE=" -I $TOOLCHAIN_LIB_BASE/zlib/zlib-1.2.5/c3f970a/include"
|
|
|
|
ZLIB_LIBS=" $TOOLCHAIN_LIB_BASE/zlib/zlib-1.2.5/c3f970a/lib/libz.a"
|
|
|
|
|
2013-11-18 07:05:00 +01:00
|
|
|
# location of bzip headers and libraries
|
|
|
|
BZIP_INCLUDE=" -I $TOOLCHAIN_LIB_BASE/bzip2/bzip2-1.0.6/c3f970a/include"
|
|
|
|
BZIP_LIBS=" $TOOLCHAIN_LIB_BASE/bzip2/bzip2-1.0.6/c3f970a/lib/libbz2.a"
|
|
|
|
|
2013-11-17 22:52:55 +01:00
|
|
|
# location of gflags headers and libraries
|
|
|
|
GFLAGS_INCLUDE=" -I $TOOLCHAIN_LIB_BASE/gflags/gflags-1.6/c3f970a/include"
|
|
|
|
GFLAGS_LIBS=" $TOOLCHAIN_LIB_BASE/gflags/gflags-1.6/c3f970a/lib/libgflags.a"
|
|
|
|
|
2013-11-20 01:33:24 +01:00
|
|
|
# location of jemalloc
|
|
|
|
JEMALLOC_INCLUDE=" -I $TOOLCHAIN_LIB_BASE/jemalloc/jemalloc-3.4.1/4d53c6f/include/"
|
|
|
|
JEMALLOC_LIB=" -Wl,--whole-archive $TOOLCHAIN_LIB_BASE/jemalloc/jemalloc-3.4.1/4d53c6f/lib/libjemalloc.a"
|
|
|
|
|
2013-11-17 22:52:55 +01:00
|
|
|
# use Intel SSE support for checksum calculations
|
|
|
|
export USE_SSE=" -msse -msse4.2 "
|
|
|
|
|
|
|
|
CC="$TOOLCHAIN_EXECUTABLES/gcc/gcc-4.8.1/cc6c9dc/bin/gcc"
|
2013-11-19 06:33:16 +01:00
|
|
|
CXX="$TOOLCHAIN_EXECUTABLES/gcc/gcc-4.8.1/cc6c9dc/bin/g++ $JINCLUDE $SNAPPY_INCLUDE $ZLIB_INCLUDE $BZIP_INCLUDE $GFLAGS_INCLUDE"
|
2013-11-17 22:52:55 +01:00
|
|
|
AR=$TOOLCHAIN_EXECUTABLES/binutils/binutils-2.21.1/da39a3e/bin/ar
|
|
|
|
RANLIB=$TOOLCHAIN_EXECUTABLES/binutils/binutils-2.21.1/da39a3e/bin/ranlib
|
|
|
|
|
2013-11-26 00:49:02 +01:00
|
|
|
CFLAGS="-B$TOOLCHAIN_EXECUTABLES/binutils/binutils-2.21.1/da39a3e/bin/gold -m64 -mtune=generic"
|
2013-11-20 01:33:24 +01:00
|
|
|
CFLAGS+=" -nostdlib $LIBGCC_INCLUDE $GLIBC_INCLUDE"
|
2014-01-02 11:00:04 +01:00
|
|
|
CFLAGS+=" -DROCKSDB_PLATFORM_POSIX -DROCKSDB_ATOMIC_PRESENT -DROCKSDB_FALLOCATE_PRESENT"
|
2013-11-18 19:20:32 +01:00
|
|
|
CFLAGS+=" -DSNAPPY -DGFLAGS -DZLIB -DBZIP2"
|
2013-11-17 22:52:55 +01:00
|
|
|
|
|
|
|
EXEC_LDFLAGS="-Wl,--dynamic-linker,/usr/local/fbcode/gcc-4.8.1-glibc-2.17/lib/ld.so"
|
|
|
|
EXEC_LDFLAGS+=" -Wl,--no-whole-archive $TOOLCHAIN_LIB_BASE/libunwind/libunwind-1.0.1/675d945/lib/libunwind.a"
|
2013-11-19 06:33:16 +01:00
|
|
|
EXEC_LDFLAGS+=" $HDFSLIB $SNAPPY_LIBS $ZLIB_LIBS $BZIP_LIBS $GFLAGS_LIBS"
|
2013-11-17 22:52:55 +01:00
|
|
|
|
2013-11-18 22:50:34 +01:00
|
|
|
PLATFORM_LDFLAGS="$LIBGCC_LIBS $GLIBC_LIBS "
|
2013-11-17 22:52:55 +01:00
|
|
|
|
2013-11-18 07:05:00 +01:00
|
|
|
EXEC_LDFLAGS_SHARED="$SNAPPY_LIBS $ZLIB_LIBS $BZIP_LIBS $GFLAGS_LIBS"
|
2013-11-17 22:52:55 +01:00
|
|
|
|
|
|
|
VALGRIND_VER="$TOOLCHAIN_LIB_BASE/valgrind/valgrind-3.8.1/c3f970a/bin/"
|
|
|
|
|
2013-11-20 01:33:24 +01:00
|
|
|
export CC CXX AR RANLIB CFLAGS EXEC_LDFLAGS EXEC_LDFLAGS_SHARED VALGRIND_VER JEMALLOC_LIB JEMALLOC_INCLUDE
|