test-zig-cc/WORKSPACE

98 lines
3.1 KiB
Python
Raw Normal View History

2022-10-19 11:35:55 +03:00
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
## LLVM
2022-10-19 11:35:55 +03:00
BAZEL_TOOLCHAIN_TAG = "0.7.2"
2022-10-19 11:35:55 +03:00
BAZEL_TOOLCHAIN_SHA = "f7aa8e59c9d3cafde6edb372d9bd25fb4ee7293ab20b916d867cd0baaa642529"
http_archive(
name = "com_grail_bazel_toolchain",
canonical_id = BAZEL_TOOLCHAIN_TAG,
2022-10-19 11:35:55 +03:00
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")
2022-12-11 15:55:21 +02:00
LLVM_VERSION = "14.0.0"
2022-10-19 11:35:55 +03:00
llvm_toolchain(
name = "llvm_toolchain",
2022-12-11 15:55:21 +02:00
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"],
2022-12-11 15:55:21 +02:00
)
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//",
},
2022-10-19 11:35:55 +03:00
)
2022-12-11 15:55:21 +02:00
load("@llvm_toolchain_with_sysroot//:toolchains.bzl", "llvm_register_toolchains")
2022-10-19 11:35:55 +03:00
#llvm_register_toolchains()
### ZIG
2023-04-24 16:26:56 +03:00
HERMETIC_CC_TOOLCHAIN_VERSION = "v2.0.0-rc1"
2022-10-19 11:35:55 +03:00
http_archive(
2023-04-24 16:26:56 +03:00
name = "hermetic_cc_toolchain",
sha256 = "43a1b398f08109c4f03b9ba2b3914bd43d1fec0425f71b71f802bf3f78cee0c2",
2022-10-19 11:35:55 +03:00
urls = [
2023-04-24 16:48:10 +03:00
"https://mirror.bazel.build/github.com/uber/hermetic_cc_toolchain/releases/download/{0}/{0}.tar.gz".format(HERMETIC_CC_TOOLCHAIN_VERSION),
2023-04-24 16:26:56 +03:00
"https://github.com/uber/hermetic_cc_toolchain/releases/download/{0}/{0}.tar.gz".format(HERMETIC_CC_TOOLCHAIN_VERSION),
2022-10-19 11:35:55 +03:00
],
)
2023-04-24 16:26:56 +03:00
load("@hermetic_cc_toolchain//toolchain:defs.bzl", zig_toolchains = "toolchains")
2022-10-19 11:35:55 +03:00
2023-04-27 14:19:45 +03:00
zig_toolchains(
#host_platform_sha256 = {
# "linux-aarch64": "",
# "linux-x86_64": "637d0f87b2cb409e1fad28e1f65a4f3645ecda467e4e2f96fe9c6959937f7c93",
# "macos-aarch64": "",
# "macos-x86_64": "",
# "windows-x86_64": "",
#},
## first "unofficial release" with multi-for syntax and still on llvm15
#version = "0.11.0-dev.2336+5b82b4004",
)
2023-04-24 16:48:10 +03:00
2022-10-19 11:35:55 +03:00
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",
)