build_rocksdb.sh: use the NPROC env var for number of make jobs

This commit is contained in:
Ștefan Talpalaru 2019-10-21 23:39:11 +02:00
parent 0641a8a04a
commit d58ee95fe0
No known key found for this signature in database
GPG Key ID: CBF7934204F1B6F9
1 changed files with 8 additions and 4 deletions

View File

@ -16,6 +16,10 @@ ROCKSDBVER="5.17.2"
[[ $# -ne 1 ]] && { echo "usage: $0 ci_cache_dir"; exit 1; } [[ $# -ne 1 ]] && { echo "usage: $0 ci_cache_dir"; exit 1; }
CI_CACHE="$1" # here we cache the installed files CI_CACHE="$1" # here we cache the installed files
# env vars
[[ -z "$NPROC" ]] && NPROC=2 # number of CPU cores available
# install from cache and exit, if the version we want is already there # install from cache and exit, if the version we want is already there
if [[ -n "$CI_CACHE" ]] && ls "$CI_CACHE"/lib/librocksdb* 2>/dev/null | grep -q "$ROCKSDBVER"; then if [[ -n "$CI_CACHE" ]] && ls "$CI_CACHE"/lib/librocksdb* 2>/dev/null | grep -q "$ROCKSDBVER"; then
sudo cp -a "$CI_CACHE"/* /usr/local/ sudo cp -a "$CI_CACHE"/* /usr/local/
@ -24,10 +28,10 @@ fi
# build it # build it
echo "Building RocksDB" echo "Building RocksDB"
curl -O -L -s -S https://github.com/facebook/rocksdb/archive/v$ROCKSDBVER.tar.gz curl -O -L -s -S https://github.com/facebook/rocksdb/archive/v${ROCKSDBVER}.tar.gz
tar xzf v$ROCKSDBVER.tar.gz tar xzf v${ROCKSDBVER}.tar.gz
cd rocksdb-$ROCKSDBVER cd rocksdb-${ROCKSDBVER}
make DISABLE_WARNING_AS_ERROR=1 -j2 shared_lib make DISABLE_WARNING_AS_ERROR=1 -j${NPROC} shared_lib
# install it # install it
if [[ -n "../$CI_CACHE" ]]; then if [[ -n "../$CI_CACHE" ]]; then