87 lines
2.7 KiB
Python
87 lines
2.7 KiB
Python
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
|
|
|
|
## LLVM
|
|
|
|
BAZEL_TOOLCHAIN_TAG = "0.7.2"
|
|
|
|
BAZEL_TOOLCHAIN_SHA = "f7aa8e59c9d3cafde6edb372d9bd25fb4ee7293ab20b916d867cd0baaa642529"
|
|
|
|
http_archive(
|
|
name = "com_grail_bazel_toolchain",
|
|
canonical_id = BAZEL_TOOLCHAIN_TAG,
|
|
sha256 = BAZEL_TOOLCHAIN_SHA,
|
|
strip_prefix = "bazel-toolchain-{tag}".format(tag = BAZEL_TOOLCHAIN_TAG),
|
|
url = "https://github.com/grailbio/bazel-toolchain/archive/{tag}.tar.gz".format(tag = BAZEL_TOOLCHAIN_TAG),
|
|
)
|
|
|
|
load("@com_grail_bazel_toolchain//toolchain:deps.bzl", "bazel_toolchain_dependencies")
|
|
|
|
bazel_toolchain_dependencies()
|
|
|
|
load("@com_grail_bazel_toolchain//toolchain:rules.bzl", "llvm_toolchain")
|
|
|
|
LLVM_VERSION = "14.0.0"
|
|
|
|
llvm_toolchain(
|
|
name = "llvm_toolchain",
|
|
llvm_version = LLVM_VERSION,
|
|
)
|
|
|
|
# This sysroot is used by github.com/vsco/bazel-toolchains.
|
|
http_archive(
|
|
name = "org_chromium_sysroot_linux_x64",
|
|
build_file_content = """
|
|
filegroup(
|
|
name = "sysroot",
|
|
srcs = glob(["*/**"]),
|
|
visibility = ["//visibility:public"],
|
|
)
|
|
""",
|
|
sha256 = "84656a6df544ecef62169cfe3ab6e41bb4346a62d3ba2a045dc5a0a2ecea94a3",
|
|
urls = ["https://commondatastorage.googleapis.com/chrome-linux-sysroot/toolchain/2202c161310ffde63729f29d27fe7bb24a0bc540/debian_stretch_amd64_sysroot.tar.xz"],
|
|
)
|
|
|
|
llvm_toolchain(
|
|
name = "llvm_toolchain_with_sysroot",
|
|
llvm_version = LLVM_VERSION,
|
|
sysroot = {
|
|
"linux-x86_64": "@org_chromium_sysroot_linux_x64//:sysroot",
|
|
},
|
|
# We can share the downloaded LLVM distribution with the first configuration.
|
|
toolchain_roots = {
|
|
"": "@llvm_toolchain_llvm//",
|
|
},
|
|
)
|
|
|
|
load("@llvm_toolchain_with_sysroot//:toolchains.bzl", "llvm_register_toolchains")
|
|
|
|
#llvm_register_toolchains()
|
|
|
|
### ZIG
|
|
|
|
BAZEL_ZIG_CC_VERSION = "00e126ec85cf8793b9d2e12d1db540c506bf781a"
|
|
|
|
http_archive(
|
|
name = "bazel-zig-cc",
|
|
sha256 = "45c38497ea2f0ffabccc356cd9d69bdbbeb43f25481de63ab2018b17079eb80c",
|
|
strip_prefix = "bazel-zig-cc-{}".format(BAZEL_ZIG_CC_VERSION),
|
|
urls = [
|
|
"https://git.sr.ht/~motiejus/bazel-zig-cc/archive/{}.tar.gz".format(BAZEL_ZIG_CC_VERSION),
|
|
],
|
|
)
|
|
|
|
load("@bazel-zig-cc//toolchain:defs.bzl", zig_toolchains = "toolchains")
|
|
|
|
zig_toolchains()
|
|
|
|
register_toolchains(
|
|
# amd64 toolchains for libc-aware platforms:
|
|
"@zig_sdk//libc_aware/toolchain:linux_amd64_gnu.2.19",
|
|
"@zig_sdk//libc_aware/toolchain:linux_amd64_gnu.2.28",
|
|
"@zig_sdk//libc_aware/toolchain:linux_amd64_gnu.2.31",
|
|
"@zig_sdk//libc_aware/toolchain:linux_amd64_musl",
|
|
# arm64 toolchains for libc-aware platforms:
|
|
"@zig_sdk//libc_aware/toolchain:linux_arm64_gnu.2.28",
|
|
"@zig_sdk//libc_aware/toolchain:linux_arm64_musl",
|
|
)
|