2023-08-23 13:29:23 -07:00
|
|
|
load("@rules_foreign_cc//foreign_cc:configure.bzl", "configure_make")
|
2025-08-12 21:17:48 -04:00
|
|
|
load("@io_ray//bazel:ray.bzl", "filter_files_with_suffix")
|
2023-08-23 13:29:23 -07:00
|
|
|
|
|
|
|
|
filegroup(
|
|
|
|
|
name = "all",
|
|
|
|
|
srcs = glob(["**"]),
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
configure_make(
|
|
|
|
|
name = "libjemalloc",
|
|
|
|
|
lib_source = ":all",
|
|
|
|
|
linkopts = ["-ldl"],
|
|
|
|
|
copts = ["-fPIC"],
|
|
|
|
|
args = ["-j"],
|
2023-09-02 16:29:20 -07:00
|
|
|
out_shared_libs = ["libjemalloc.so"],
|
2023-11-16 18:01:02 -08:00
|
|
|
# See https://salsa.debian.org/debian/jemalloc/-/blob/c0a88c37a551be7d12e4863435365c9a6a51525f/debian/rules#L8-23
|
|
|
|
|
# for why we are setting "--with-lg-page" on non x86 hardware here.
|
2024-11-12 19:22:05 -08:00
|
|
|
configure_options = ["--disable-static", "--enable-prof", "--enable-prof-libunwind"] +
|
2023-11-16 18:01:02 -08:00
|
|
|
select({
|
|
|
|
|
"@platforms//cpu:x86_64": [],
|
|
|
|
|
"//conditions:default": ["--with-lg-page=16"],
|
|
|
|
|
}),
|
2023-09-02 16:29:20 -07:00
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
filter_files_with_suffix(
|
|
|
|
|
name = "shared",
|
|
|
|
|
srcs = ["@jemalloc//:libjemalloc"],
|
|
|
|
|
suffix = ".so",
|
2023-08-23 13:29:23 -07:00
|
|
|
visibility = ["//visibility:public"],
|
|
|
|
|
)
|