2016-09-23 21:01:57 -07:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
LINKAGE=$1
|
|
|
|
if [ -z $LINKAGE ]; then
|
|
|
|
LINKAGE="shared_lib"
|
|
|
|
fi
|
|
|
|
|
2018-04-09 12:42:16 -07:00
|
|
|
BRANCH=$2
|
|
|
|
if [ -z $BRANCH ]; then
|
|
|
|
BRANCH="master"
|
|
|
|
fi
|
|
|
|
|
2016-09-23 21:01:57 -07:00
|
|
|
run ()
|
|
|
|
{
|
|
|
|
COMMAND=$1
|
|
|
|
# check for empty commands
|
|
|
|
if test -z "$COMMAND" ; then
|
|
|
|
echo -e "\033[1;5;31mERROR\033[0m No command specified!"
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
shift;
|
|
|
|
OPTIONS="$@"
|
|
|
|
# print a message
|
|
|
|
if test -n "$OPTIONS" ; then
|
|
|
|
echo -ne "\033[1m$COMMAND $OPTIONS\033[0m ... "
|
|
|
|
else
|
|
|
|
echo -ne "\033[1m$COMMAND\033[0m ... "
|
|
|
|
fi
|
|
|
|
|
|
|
|
# run or die
|
|
|
|
$COMMAND $OPTIONS ; RESULT=$?
|
|
|
|
if test $RESULT -ne 0 ; then
|
|
|
|
echo -e "\033[1;5;31mERROR\033[0m $COMMAND failed. (exit code = $RESULT)"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo -e "\033[0;32myes\033[0m"
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
echo "*** Building RocksDB... "
|
|
|
|
|
|
|
|
USERDIR=$PWD # Save current dir and return to it later
|
|
|
|
|
2018-01-27 20:46:41 -08:00
|
|
|
run git submodule update --init deps/rocksdb
|
2016-09-23 21:01:57 -07:00
|
|
|
|
2018-01-27 20:46:41 -08:00
|
|
|
run cd deps/rocksdb
|
2020-03-03 13:08:03 -08:00
|
|
|
run git fetch --tags --force
|
2018-04-09 12:42:16 -07:00
|
|
|
run git checkout $BRANCH
|
2018-06-14 19:44:18 -06:00
|
|
|
NJOBS=`nproc`
|
2019-05-26 22:16:33 -07:00
|
|
|
# export CFLAGS="$CFLAGS -DROCKSDB_USE_RTTI"
|
|
|
|
# export CFLAGS="$CFLAGS -frtti"
|
2018-12-23 15:16:21 -08:00
|
|
|
export CFLAGS="$CFLAGS -fPIC"
|
2018-12-23 16:04:08 -08:00
|
|
|
export CFLAGS="$CFLAGS -ftls-model=initial-exec"
|
2019-06-22 16:53:56 -07:00
|
|
|
export CFLAGS="$CFLAGS -Wno-error"
|
2020-05-04 14:04:14 -07:00
|
|
|
export CFLAGS="$CFLAGS -mtune=native"
|
2018-11-29 12:58:26 -08:00
|
|
|
export DISABLE_JEMALLOC=1
|
2020-05-04 14:06:23 -07:00
|
|
|
run make V=1 -j$NJOBS $LINKAGE
|
2016-09-23 21:01:57 -07:00
|
|
|
run cd $USERDIR # Return to user's original directory
|