2019-08-20 21:14:45 +00:00
|
|
|
#!/bin/bash
|
|
|
|
# used in Travis CI scripts
|
|
|
|
|
2020-06-14 17:12:27 +00:00
|
|
|
# Copyright (c) 2018-2020 Status Research & Development GmbH. Licensed under
|
2019-08-20 21:14:45 +00:00
|
|
|
# either of:
|
|
|
|
# - Apache License, version 2.0
|
|
|
|
# - MIT license
|
|
|
|
# at your option. This file may not be copied, modified, or distributed except
|
|
|
|
# according to those terms.
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
ROCKSDBVER="5.17.2"
|
|
|
|
|
|
|
|
# script arguments
|
2020-06-14 17:12:27 +00:00
|
|
|
[[ $# -ne 1 ]] && { echo "Usage: $0 ci_cache_dir"; exit 1; }
|
2019-08-20 21:14:45 +00:00
|
|
|
CI_CACHE="$1" # here we cache the installed files
|
|
|
|
|
2019-10-21 21:39:11 +00:00
|
|
|
# env vars
|
|
|
|
|
|
|
|
[[ -z "$NPROC" ]] && NPROC=2 # number of CPU cores available
|
|
|
|
|
2019-08-20 21:14:45 +00:00
|
|
|
# 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
|
|
|
|
sudo cp -a "$CI_CACHE"/* /usr/local/
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
# build it
|
|
|
|
echo "Building RocksDB"
|
2019-10-21 21:39:11 +00:00
|
|
|
curl -O -L -s -S https://github.com/facebook/rocksdb/archive/v${ROCKSDBVER}.tar.gz
|
|
|
|
tar xzf v${ROCKSDBVER}.tar.gz
|
|
|
|
cd rocksdb-${ROCKSDBVER}
|
|
|
|
make DISABLE_WARNING_AS_ERROR=1 -j${NPROC} shared_lib
|
2019-08-20 21:14:45 +00:00
|
|
|
|
|
|
|
# install it
|
|
|
|
if [[ -n "../$CI_CACHE" ]]; then
|
|
|
|
rm -rf "../$CI_CACHE"
|
|
|
|
mkdir "../$CI_CACHE"
|
|
|
|
make INSTALL_PATH="../$CI_CACHE" install-shared
|
|
|
|
sudo cp -a "../$CI_CACHE"/* /usr/local/
|
|
|
|
fi
|
|
|
|
|