2018-03-07 10:18:58 -08:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2018-05-24 23:35:25 -07:00
|
|
|
# Usage: by default jemalloc is used; however, if tcmalloc is installed on the
|
|
|
|
# system, credis' CMakeLists.txt will prefer it over jemalloc. To avoid build
|
|
|
|
# failures use:
|
|
|
|
#
|
|
|
|
# CREDIS_TCMALLOC=1 build_credis.sh
|
|
|
|
#
|
|
|
|
# If building all of ray from ray/python, use:
|
|
|
|
#
|
|
|
|
# env CREDIS_TCMALLOC=1 RAY_USE_NEW_GCS=on pip install -e . --verbose
|
|
|
|
|
2018-03-07 10:18:58 -08:00
|
|
|
set -x
|
|
|
|
|
|
|
|
# Cause the script to exit if a single command fails.
|
|
|
|
set -e
|
|
|
|
|
|
|
|
TP_DIR=$(cd "$(dirname "${BASH_SOURCE:-$0}")"; pwd)/../
|
|
|
|
ROOT_DIR=$TP_DIR/..
|
|
|
|
|
2018-06-20 14:40:57 -07:00
|
|
|
# For some reason, on Ubuntu/gcc toolchain linking against static libleveldb.a
|
|
|
|
# doesn't work, so we force building the shared library for non-Mac.
|
|
|
|
if [ "$(uname)" == "Darwin" ]; then
|
|
|
|
BUILD_LEVELDB_CONFIG=""
|
|
|
|
else
|
|
|
|
BUILD_LEVELDB_CONFIG="-DBUILD_SHARED_LIBS=on"
|
|
|
|
fi
|
|
|
|
|
2018-03-07 10:18:58 -08:00
|
|
|
if [[ "${RAY_USE_NEW_GCS}" = "on" ]]; then
|
2018-05-24 23:35:25 -07:00
|
|
|
pushd "$TP_DIR/pkg/"
|
2018-07-15 07:08:13 +08:00
|
|
|
if [[ ! -d "credis" ]]; then
|
2018-08-16 13:54:35 +08:00
|
|
|
git clone -q --recursive https://github.com/ray-project/credis
|
2018-07-15 07:08:13 +08:00
|
|
|
fi
|
2018-05-24 23:35:25 -07:00
|
|
|
popd
|
|
|
|
|
|
|
|
pushd "$TP_DIR/pkg/credis"
|
2018-07-15 07:08:13 +08:00
|
|
|
git fetch origin master
|
2018-06-20 14:40:57 -07:00
|
|
|
git checkout 273d667e5126c246b45f5dcf030b651a653136c3
|
2018-05-24 23:35:25 -07:00
|
|
|
|
|
|
|
# If the above commit points to different submodules' commits than
|
|
|
|
# origin's head, this updates the submodules.
|
|
|
|
git submodule update
|
|
|
|
|
|
|
|
# TODO(pcm): Get the build environment for tcmalloc set up and compile redis
|
|
|
|
# with tcmalloc.
|
|
|
|
# NOTE(zongheng): if we don't specify MALLOC=jemalloc, then build behiavors
|
|
|
|
# differ between Mac (libc) and Linux (jemalloc)... This breaks our CMake
|
|
|
|
# rules.
|
|
|
|
if [[ "${CREDIS_TCMALLOC}" = 1 ]]; then
|
|
|
|
echo "CREDIS_MALLOC is set, using tcmalloc to build redis"
|
|
|
|
pushd redis && env USE_TCMALLOC=yes make -j && popd
|
|
|
|
else
|
|
|
|
pushd redis && make -j MALLOC=jemalloc && popd
|
|
|
|
fi
|
2018-06-20 14:40:57 -07:00
|
|
|
pushd glog; cmake -DWITH_GFLAGS=off . && make -j; popd
|
|
|
|
pushd leveldb;
|
|
|
|
mkdir -p build && cd build
|
|
|
|
cmake ${BUILD_LEVELDB_CONFIG} -DCMAKE_BUILD_TYPE=Release .. && cmake --build .
|
|
|
|
popd
|
2018-05-24 23:35:25 -07:00
|
|
|
|
2018-06-20 14:40:57 -07:00
|
|
|
mkdir -p build
|
2018-05-24 23:35:25 -07:00
|
|
|
pushd build
|
2018-06-20 14:40:57 -07:00
|
|
|
cmake -DCMAKE_BUILD_TYPE=Release ..
|
2018-05-24 23:35:25 -07:00
|
|
|
make -j
|
2018-03-07 10:18:58 -08:00
|
|
|
popd
|
|
|
|
|
2018-06-02 07:28:27 +08:00
|
|
|
mkdir -p $ROOT_DIR/build/src/credis/redis/src/
|
|
|
|
cp redis/src/redis-server $ROOT_DIR/build/src/credis/redis/src/redis-server
|
2018-06-20 14:40:57 -07:00
|
|
|
|
2018-06-02 07:28:27 +08:00
|
|
|
mkdir -p $ROOT_DIR/build/src/credis/build/src/
|
|
|
|
cp build/src/libmaster.so $ROOT_DIR/build/src/credis/build/src/libmaster.so
|
|
|
|
cp build/src/libmember.so $ROOT_DIR/build/src/credis/build/src/libmember.so
|
2018-05-24 23:35:25 -07:00
|
|
|
popd
|
2018-03-07 10:18:58 -08:00
|
|
|
fi
|