0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-25 16:22:35 +01:00
construct/tools/buildrocks.sh
Jason Volk 24e97c01be tools: Build included rocksdb without explicit RTTI.
closes #53 indirectly. The related issue was actually satisfied two different
ways: first, our primary installation target platforms tend to compile their
rocksdb package with RTTI. Nevertheless, the relaxation/weakening of
symbol binding at compile and runtime which was recently committed also allows
our RTTI to serve in place of librocksdb's missing RTTI.
2019-05-26 22:16:33 -07:00

59 lines
1.1 KiB
Bash
Executable file

#!/bin/bash
LINKAGE=$1
if [ -z $LINKAGE ]; then
LINKAGE="shared_lib"
fi
BRANCH=$2
if [ -z $BRANCH ]; then
BRANCH="master"
fi
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
run git submodule update --init deps/rocksdb
run cd deps/rocksdb
run git fetch --tags
run git checkout $BRANCH
NJOBS=`nproc`
# export CFLAGS="$CFLAGS -DROCKSDB_USE_RTTI"
# export CFLAGS="$CFLAGS -frtti"
export CFLAGS="$CFLAGS -fPIC"
export CFLAGS="$CFLAGS -ftls-model=initial-exec"
export DISABLE_JEMALLOC=1
run make -j$NJOBS $LINKAGE
run cd $USERDIR # Return to user's original directory