blob: 7d7ba53b579605a6f469fe01ddf699d1284110e3 [file] [log] [blame] [edit]
module(
name = "v8",
version = "0.0.0",
)
bazel_dep(name = "bazel_skylib", version = "1.8.1")
bazel_dep(name = "rules_cc", version = "0.2.0")
bazel_dep(name = "rules_python", version = "1.0.0")
bazel_dep(name = "platforms", version = "1.0.0")
bazel_dep(name = "abseil-cpp", version = "20250814.0")
bazel_dep(name = "highway", version = "1.2.0")
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
pip.parse(
hub_name = "v8_python_deps",
python_version = "3.11",
requirements_lock = "//:bazel/requirements.txt",
extra_pip_args = [
"--require-hashes",
"--index-url=https://pypi.org/simple",
],
)
use_repo(pip, "v8_python_deps")
# Define the local LLVM toolchain repository
llvm_toolchain_repository = use_repo_rule("//bazel/toolchain:llvm_repository.bzl", "llvm_toolchain_repository")
llvm_toolchain_repository(
name = "llvm_toolchain",
path = "third_party/llvm-build/Release+Asserts",
config_file_content = """
load("@bazel_tools//tools/cpp:cc_toolchain_config_lib.bzl", "feature", "flag_group", "flag_set", "tool_path")
def _impl(ctx):
tool_paths = [
tool_path(name = "gcc", path = "bin/clang"),
tool_path(name = "ld", path = "bin/lld"),
tool_path(name = "ar", path = "bin/llvm-ar"),
tool_path(name = "cpp", path = "bin/clang++"),
tool_path(name = "gcov", path = "/bin/false"),
tool_path(name = "nm", path = "bin/llvm-nm"),
tool_path(name = "objdump", path = "bin/llvm-objdump"),
tool_path(name = "strip", path = "bin/llvm-strip"),
]
features = [
feature(
name = "default_compile_flags",
enabled = True,
flag_sets = [
flag_set(
actions = [
"c-compile",
"c++-compile",
"c++-header-parsing",
"c++-module-compile",
"c++-module-codegen",
"linkstamp-compile",
"assemble",
"preprocess-assemble",
],
flag_groups = [
flag_group(
flags = [
"--sysroot={WORKSPACE_ROOT}/build/linux/debian_bullseye_amd64-sysroot",
"-nostdinc++",
"-isystem",
"{WORKSPACE_ROOT}/buildtools/third_party/libc++",
"-isystem",
"{WORKSPACE_ROOT}/third_party/libc++/src/include",
"-isystem",
"{WORKSPACE_ROOT}/third_party/libc++abi/src/include",
"-isystem",
"{WORKSPACE_ROOT}/third_party/libc++/src/src",
"-isystem",
"{WORKSPACE_ROOT}/third_party/llvm-libc/src",
"-D_LIBCPP_HARDENING_MODE_DEFAULT=_LIBCPP_HARDENING_MODE_NONE",
"-DLIBC_NAMESPACE=__llvm_libc_cr",
],
),
],
),
],
),
feature(
name = "default_linker_flags",
enabled = True,
flag_sets = [
flag_set(
actions = [
"c++-link-executable",
"c++-link-dynamic-library",
"c++-link-nodeps-dynamic-library",
],
flag_groups = [
flag_group(
flags = [
"--sysroot={WORKSPACE_ROOT}/build/linux/debian_bullseye_amd64-sysroot",
"-fuse-ld=lld",
"-lm",
"-lpthread",
],
),
],
),
],
),
]
return cc_common.create_cc_toolchain_config_info(
ctx = ctx,
features = features,
cxx_builtin_include_directories = [
"{WORKSPACE_ROOT}/buildtools/third_party/libc++",
"{WORKSPACE_ROOT}/third_party/libc++/src/include",
"{WORKSPACE_ROOT}/third_party/libc++abi/src/include",
"{WORKSPACE_ROOT}/third_party/libc++/src/src",
"{WORKSPACE_ROOT}/third_party/llvm-libc/src",
"{WORKSPACE_ROOT}/third_party/llvm-build/Release+Asserts/lib/clang/22/include",
"{WORKSPACE_ROOT}/third_party/llvm-build/Release+Asserts/lib/clang/23/include",
"{WORKSPACE_ROOT}/build/linux/debian_bullseye_amd64-sysroot/usr/include",
"{WORKSPACE_ROOT}/build/linux/debian_bullseye_amd64-sysroot/usr/local/include",
],
toolchain_identifier = "local_clang",
host_system_name = "local",
target_system_name = "local",
target_cpu = "k8",
target_libc = "unknown",
compiler = "clang",
abi_version = "unknown",
abi_libc_version = "unknown",
tool_paths = tool_paths,
)
cc_toolchain_config = rule(
implementation = _impl,
attrs = {},
provides = [CcToolchainConfigInfo],
)
""",
build_file_content = """
load(":cc_toolchain_config.bzl", "cc_toolchain_config")
package(default_visibility = ["//visibility:public"])
filegroup(
name = "all_files",
srcs = glob(["**/*"]),
)
filegroup(name = "empty")
cc_toolchain_config(name = "k8_toolchain_config")
cc_toolchain(
name = "k8_toolchain",
all_files = ":all_files",
ar_files = ":all_files",
compiler_files = ":all_files",
dwp_files = ":empty",
linker_files = ":all_files",
objcopy_files = ":all_files",
strip_files = ":all_files",
supports_param_files = 0,
toolchain_config = ":k8_toolchain_config",
toolchain_identifier = "local_clang",
)
toolchain(
name = "cc_toolchain_k8",
exec_compatible_with = [
"@platforms//cpu:x86_64",
"@platforms//os:linux",
],
target_compatible_with = [
"@platforms//cpu:x86_64",
"@platforms//os:linux",
],
toolchain = ":k8_toolchain",
toolchain_type = "@bazel_tools//tools/cpp:toolchain_type",
)
""",
)
register_toolchains("@llvm_toolchain//:cc_toolchain_k8")
# Define local repository for libc++ from third_party sources
libcxx_repository = use_repo_rule("//bazel/toolchain:libcxx_repository.bzl", "libcxx_repository")
libcxx_repository(
name = "libcxx",
)