forked from ray-project/ray
-
Notifications
You must be signed in to change notification settings - Fork 0
/
BUILD.redis
84 lines (77 loc) · 1.95 KB
/
BUILD.redis
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
74
75
76
77
78
79
80
81
82
83
load("@rules_foreign_cc//foreign_cc:defs.bzl", "make")
exports_files(
[
"redis-server.exe",
"redis-cli.exe",
],
visibility = ["//visibility:public"],
)
filegroup(
name = "all_srcs",
srcs = glob(
include = ["**"],
exclude = ["*.bazel"],
),
)
make(
name = "redis",
args = [
"BUILD_TLS=yes",
"-s",
],
copts = [
"-DLUA_USE_MKSTEMP",
"-Wno-pragmas",
"-Wno-empty-body",
"-fPIC",
],
visibility = ["//visibility:public"],
lib_source = ":all_srcs",
deps = [
"@openssl//:openssl",
],
out_binaries = [
"redis-server",
"redis-cli"
]
)
genrule(
name = "bin",
srcs = [":redis"],
outs = [
"redis-server",
"redis-cli",
],
cmd = """
cp $(RULEDIR)/redis/bin/redis-server $(location redis-server)
cp $(RULEDIR)/redis/bin/redis-cli $(location redis-cli)
""",
visibility = ["//visibility:public"],
tags = ["local"],
)
# This is a build for mac without openssl.
# rules_foreign_cc somehow pick the wrong toolchain in CI.
genrule(
name = "bin-mac",
srcs = glob(["**"]),
outs = [
"redis-server-mac",
"redis-cli-mac",
],
cmd = """
unset CC LDFLAGS CXX CXXFLAGS
tmpdir="redis.tmp"
p=$(location Makefile)
cp -p -L -R -- "$${p%/*}" "$${tmpdir}"
chmod +x "$${tmpdir}"/deps/jemalloc/configure
parallel="$$(getconf _NPROCESSORS_ONLN || echo 1)"
make -s -C "$${tmpdir}" -j"$${parallel}" V=0 CFLAGS="$${CFLAGS-} -DLUA_USE_MKSTEMP -Wno-pragmas -Wno-empty-body"
mv "$${tmpdir}"/src/redis-server $(location redis-server-mac)
chmod +x $(location redis-server-mac)
mv "$${tmpdir}"/src/redis-cli $(location redis-cli-mac)
chmod +x $(location redis-cli-mac)
rm -r -f -- "$${tmpdir}"
""",
visibility = ["//visibility:public"],
tags = ["local"],
)