blob: a8cb59e05003e0810716f02f1f74932f47576273 [file]
module(
name = "toolchains_llvm_bootstrapped",
version = "0.2.5",
bazel_compatibility = [">=7.4.0"],
compatibility_level = 0,
)
bazel_dep(name = "aspect_bazel_lib", version = "2.14.0")
bazel_dep(name = "bazel_skylib", version = "1.7.1")
bazel_dep(name = "bazel_features", version = "1.24.0")
bazel_dep(name = "platforms", version = "0.0.11")
bazel_dep(name = "rules_cc", version = "0.2.12")
bazel_dep(name = "with_cfg.bzl", version = "0.9.2")
http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
LLVM_VERSION = "21.1.4"
LLVM_TOOLCHAIN_MINIMAL_SHA256 = {
"darwin-arm64": "419f4d4b9893ac2658a41665e2adbcbb3147cfc8c010f8811097a04f586d33fe",
"linux-amd64-musl": "e1fdddcd40f654941aac1acb59f0dcc54f15c0be3c0dd9d487ce8d66c0cef00d",
"linux-arm64-musl": "9ebac95e671f4abeacc1f85b77e6882fc9307210543b0f4440182bf61c70145b",
}
[
http_archive(
name = "llvm-toolchain-minimal-{llvm_version}-{target}".format(llvm_version = LLVM_VERSION, target = target.replace("-musl", "")),
urls = ["https://github.com/cerisier/toolchains_llvm_bootstrapped/releases/download/llvm-{llvm_version}/llvm-toolchain-minimal-{llvm_version}-{target}.tar.zst".format(llvm_version = LLVM_VERSION, target = target)],
sha256 = sha256,
build_file = "//toolchain/llvm:BUILD.llvm_release.tpl",
) for (target, sha256) in LLVM_TOOLCHAIN_MINIMAL_SHA256.items()
]
LLVM_TOOLCHAIN_EXTRAS_SHA256 = {
"darwin-arm64": "5f21cff510da9a5fd6444f4239383c220246193bbc17d48ffe7d2583476d6a25",
"linux-amd64-musl": "7296ab64eaea3276260d4db934d9986e6b8ec01effb89fb35cf87c02f93ea027",
"linux-arm64-musl": "b886c1bc2c48a214b2a1076f14968f2e36fd9bfc926975f09515f287bbd9b734",
}
[
http_archive(
name = "static-extras-toolchain-artifacts-{target}".format(target = target.replace("-musl", "")),
urls = ["https://github.com/cerisier/toolchains_llvm_bootstrapped/releases/download/bootstrap%2Fextras%2F20250505/toolchain-extra-prebuilts-20250505-{target}.tar.zst".format(target = target)],
sha256 = sha256,
build_file = "//bootstrap/extras:BUILD.extras.tpl",
) for (target, sha256) in LLVM_TOOLCHAIN_EXTRAS_SHA256.items()
]
LLVM_RELEASE_ASSETS_SHA256 = {
"compiler-rt": "84fed7aa95bfac348642a753d332afd303a0847b1fe1e76acf13fe98f8760d5f",
"libcxx": "5d0af8cc8a387074bdac8587bbf3421addfcdf5b7cc05af9e3fbc9f5961e5a7e",
"libcxxabi": "df0005d6f2238ed6d0c236cf02271de4e08719d0fe1f63454037734af527ad87",
"libunwind": "fc3ca27e1094b5fd4b7c1879e83705d89e9a2632b9a43426eb96c0536ace5345"
}
[
http_archive(
name = name,
urls = ["https://github.com/llvm/llvm-project/releases/download/llvmorg-{llvm_version}/{name}-{llvm_version}.src.tar.xz".format(llvm_version = LLVM_VERSION, name = name)],
strip_prefix = "{name}-{llvm_version}.src".format(llvm_version = LLVM_VERSION, name = name),
sha256 = sha256,
build_file = "//third_party/llvm-project/20.x/{name}:BUILD.tpl".format(name = name),
) for (name, sha256) in LLVM_RELEASE_ASSETS_SHA256.items()
]
http_archive(
name = "musl_libc",
urls = ["https://musl.libc.org/releases/musl-1.2.5.tar.gz"],
strip_prefix = "musl-1.2.5",
patch_args = ["-p1"],
patches = [
"//third_party/libc/musl:1.2.5-CVE-2025-26519-1.patch",
"//third_party/libc/musl:1.2.5-CVE-2025-26519-2.patch",
],
integrity = "sha256-qaEYu+hNh2TaDqDSizqz+uhHf8fkCF2QECuFlvx8deQ=",
build_file = "//third_party/libc/musl:BUILD.tpl",
)
http_pkg_archive = use_repo_rule("//:http_pkg_archive.bzl", "http_pkg_archive")
http_pkg_archive(
name = "macosx15.4.sdk",
urls = ["https://swcdn.apple.com/content/downloads/10/32/082-12052-A_AHPGDY76PT/1a419zaf3vh8o9t3c0usblyr8eystpnsh5/CLTools_macOSNMOS_SDK.pkg"],
strip_files = [
"Library/Developer/CommandLineTools/SDKs/MacOSX15.4.sdk/System/Library/Frameworks/Ruby.framework/Versions/Current/Headers/ruby",
],
sha256 = "f8b0600aa4ad9b0b0b150fb62691dc561f47bc33ebc40546439f1460a0680913",
build_file = "//third_party/macosx.sdk:BUILD.MacOSX15.4.sdk.tpl",
strip_prefix = "Library/Developer/CommandLineTools/SDKs/MacOSX15.4.sdk",
)
glibc = use_extension("//runtimes/glibc/extension:glibc.bzl", "glibc")
# https://cerisier.github.io/glibc-headers/index.json
glibc.index(file = "//runtimes/glibc/extension:glibc_headers_index.json")
use_repo(glibc, "glibc")
kernel_headers = use_extension("//kernel/extension:kernel_headers.bzl", "kernel_headers")
# https://cerisier.github.io/kernel-headers/index.json
kernel_headers.index(file = "//kernel/extension:kernel_headers_index.json")
use_repo(kernel_headers, "kernel_headers")
## DEV DEPENDENCIES
GLIBC_STUBS_GENERATOR_COMMIT = "33276300351d5a3cbedd308f4d21669b8e8ef83d"
bazel_dep(name = "glibc-stubs-generator", version = "2.0.1", dev_dependency = True)
archive_override(
module_name = "glibc-stubs-generator",
urls = ["https://github.com/cerisier/glibc-stubs-generator/archive/{}.tar.gz".format(GLIBC_STUBS_GENERATOR_COMMIT)],
integrity = "sha256-q7bwGW3nRigiGuXj/2kIZMi/LFCHZpVbMD/kRdllLCg=",
strip_prefix = "glibc-stubs-generator-{}".format(GLIBC_STUBS_GENERATOR_COMMIT),
)
LIBSTDCXX_STUBS_GENERATOR_COMMIT = "ed896a140ef8466140c3bcfd066e710a80a41ebe"
bazel_dep(name = "libstdcxx-stubs-generator", version = "0.0.1", dev_dependency = True)
archive_override(
module_name = "libstdcxx-stubs-generator",
urls = ["https://github.com/cerisier/libstdcxx-stubs-generator/archive/{}.tar.gz".format(LIBSTDCXX_STUBS_GENERATOR_COMMIT)],
integrity = "sha256-OAZfeifniTQmKit60qHpZanOLLIJVyYEiMlpN5Q7Fjw=",
strip_prefix = "libstdcxx-stubs-generator-{}".format(LIBSTDCXX_STUBS_GENERATOR_COMMIT),
)
bazel_dep(name = "rules_python", version = "0.40.0", dev_dependency = True)
llvm_raw = use_extension("//:llvm_raw.bzl", "llvm_raw", dev_dependency = True)
use_repo(llvm_raw, "llvm-raw", "llvm_zlib", "llvm_zstd")
llvm = use_extension("//:llvm.bzl", "llvm", dev_dependency = True)
llvm.configure(
targets = ["AArch64", "X86"],
)
use_repo(llvm, "llvm-project")
# llvm_configure = use_repo_rule("@llvm-raw//utils/bazel:configure.bzl", "llvm_configure")
# llvm_configure(name = "llvm-project")
## OVERRIDES PORTS FROM DEPENDENCIES
RULES_ZIG_COMMIT = "b9739c615ce62b64ee595ac4bcd9ee7cc06b0422" # branch=zml
bazel_dep(name = "rules_zig", version = "0.12.2", dev_dependency = True)
zig = use_extension("@rules_zig//zig:extensions.bzl", "zig", dev_dependency = True)
zig.index(file = "//:zig_index.json")
zig.toolchain(zig_version = "0.14.0")
zig.mirrors(urls = [
"https://mirror.zml.ai/zig",
])
use_repo(zig, "zig_toolchains")
register_toolchains("@rules_zig//zig/target:all", dev_dependency = True)
register_toolchains("@zig_toolchains//:all", dev_dependency = True)
# Register the bootstrap toolchain since it is a prerequisite to all other toolchains.
register_toolchains(
"@toolchains_llvm_bootstrapped//toolchain/stage2:stage2_toolchain",
)