forked from RediSearch/RediSearch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild-redisjson
executable file
·73 lines (58 loc) · 1.72 KB
/
build-redisjson
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/bash
PROGNAME="${BASH_SOURCE[0]}"
HERE="$(cd "$(dirname "$PROGNAME")" &>/dev/null && pwd)"
ROOT=$(cd $HERE/.. && pwd)
READIES=$ROOT/deps/readies
. $READIES/shibumi/defs
if [[ $1 == --help || $1 == help || $HELP == 1 ]]; then
cat <<-END
Build RedisJSON module (for Sanitizer)
build-redisjson [--help|help]
Argument variables:
BINROOT=dir Build into dir
BRANCH=name Use given branch (default: master)
SAN=mode Clang Sanitizer mode (address|memory)
MODULE_FILE=file Write module path into `file`
FORCE=1 Force rebuild
NOP=1 No operation
HELP=1 Show help
END
exit 0
fi
OP=
[[ $NOP == 1 ]] && OP=echo
if [[ -n $SAN && $SAN != address && $SAN != memory ]]; then
echo "Invalid SAN setting: '$SAN'"
exit 1
fi
if [[ -z $BINROOT ]]; then
export BINROOT=$ROOT/bin/$($READIES/bin/platform -t)
fi
TARGET_DIR=$BINROOT/RedisJSON
echo Building into $TARGET_DIR ...
if [[ $FORCE == 1 ]]; then
runn rm -rf $TARGET_DIR
fi
BRANCH=${BRANCH:-master}
$OP cd $ROOT/deps
if [[ ! -d RedisJSON ]]; then
runn git clone --quiet --recursive https://github.com/RedisJSON/RedisJSON.git
fi
$OP cd RedisJSON
runn git checkout $BRANCH
runn git pull --quiet --recurse-submodules
# Install only rust, because the rest of the dependencies are already installed
if [[ $NOP != 1 ]]; then
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source $HOME/.cargo/env
rustup update
rustup update nightly
# for RedisJSON build with addess santizer
rustup component add rust-src --toolchain nightly
rustup show
BINROOT=$TARGET_DIR make SAN=$SAN
echo "Created ${TARGET_DIR}/rejson.so"
fi
if [[ -n $MODULE_FILE ]]; then
echo "${TARGET_DIR}/rejson.so" > $MODULE_FILE
fi