-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathBUILD.bazel
More file actions
43 lines (40 loc) · 1.69 KB
/
BUILD.bazel
File metadata and controls
43 lines (40 loc) · 1.69 KB
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
load("@rules_foreign_cc//foreign_cc:configure.bzl", "configure_make_variant")
filegroup(
name = "all",
srcs = glob(["**"]),
)
# Wrap the cmake-built jemalloc code in a cc_library which can then be passed
# to a bazel cc_binary or cc_target `malloc` attribute.
# TODO(https://github.com/bazelbuild/rules_foreign_cc/issues/227): Remove this
# wrapper when bazel allows any target to be pasesd to `malloc`.
cc_library(
# The `configure_make_variant` wrapper around `configure_make` doesn't
# pass the 'visibility' setting correctly; it gets lost. As a
# workaround we wrap the target to give the correct visibility setting.
# TODO(xander): File an issue on `rules_foreign_cc` to preserve visibility.
name = "jemalloc",
visibility = ["//visibility:public"],
deps = [":jemalloc_preinstalled_make"],
)
configure_make_variant(
name = "jemalloc_preinstalled_make",
autoconf = True,
configure_in_place = True,
env = select({
# Without this option on macOS we will have the following issue:
# .../libtool: no output file specified (specify with -o output).
"@bazel_tools//src/conditions:darwin": {"AR": ""},
"//conditions:default": {},
}),
lib_source = ":all",
out_static_libs = select({
"@bazel_tools//src/conditions:windows": [
"libjemalloc_a.lib",
],
"//conditions:default": ["libjemalloc.a"],
}),
# We need to use the system-default make; the version of make packaged
# with `rules_foreign_cc` (4.3) segfaults on GitHub's Actions workers.
# The version that is pre-installed on those workers (3.81) works fine.
toolchain = "@rules_foreign_cc//toolchains:preinstalled_make_toolchain",
)