1
Fork 0

Rename bazel-zig-cc to hermetic_cc_toolchain (#36)

As it says on the tin.

Long live hermetic_cc_toolchain!
main
Motiejus Jakštys 2023-04-21 17:00:03 +03:00 committed by GitHub
parent 73a9ceccfb
commit e0e7a4ca46
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
31 changed files with 85 additions and 85 deletions

2
.gitignore vendored
View File

@ -1,7 +1,7 @@
*~
*.sw[op]
/bazel-bazel-zig-cc
/bazel-hermetic_cc_toolchain
/bazel-bin
/bazel-out
/bazel-testlogs

2
BUILD
View File

@ -6,7 +6,7 @@ load("@bazel_gazelle//:def.bzl", "gazelle")
# gazelle:map_kind go_binary go_binary //rules:rules_go.bzl
# gazelle:build_file_name BUILD
# gazelle:prefix github.com/uber/bazel-zig-cc
# gazelle:prefix github.com/uber/hermetic_cc_toolchain
# gazelle:exclude tools.go
gazelle(name = "gazelle")

View File

@ -1,4 +1,5 @@
Copyright 2021-2022 bazel-zig-cc contributors
Copyright 2023 hermetic_cc_toolchain contributors
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in

View File

@ -1,18 +1,17 @@
[![builds.sr.ht status](https://builds.sr.ht/~motiejus/bazel-zig-cc.svg)](https://builds.sr.ht/~motiejus/bazel-zig-cc)
# Hermetic CC toolchain
# Bazel zig cc toolchain
This is a C/C++ toolchain that can (cross-)compile C/C++ programs. It contains
clang-15, musl, glibc 2-2.34, all in a ~40MB package. Read
This is a C/C++ toolchain that can (cross-)compile C/C++ programs on top of
`zig cc`. It contains clang-16, musl, glibc 2-2.34, all in a ~40MB package.
Read
[here](https://andrewkelley.me/post/zig-cc-powerful-drop-in-replacement-gcc-clang.html)
about zig-cc; the rest of the README will present how to use this toolchain
from Bazel.
Configuring toolchains in Bazel is complex, under-documented, and fraught with
peril. I, the co-author of bazel-zig-cc, am still confused on how this all
works, and often wonder why it works at all. That aside, we made the our best
effort to make bazel-zig-cc usable for your C/C++/CGo projects, with as many
guardrails as we could install.
peril. I, the co-author of `hermetic_cc_toolchain`, am still confused on how
this all works, and often wonder why it works at all. That aside, we made the
our best effort to make `hermetic_cc_toolchain` usable for your C/C++/CGo
projects, with as many guardrails as we could install.
While copy-pasting the code in your project, attempt to read and understand the
text surrounding the code snippets. This will save you hours of head
@ -20,10 +19,12 @@ scratching, I promise.
# Project Origin
This repository is based on Adam Bouhenguel's [bazel-zig-cc][ajbouh], then
developed at `sr.ht/~motiejus/bazel-zig-cc` and finally moved to
[github.com/uber](https://github.com/uber). Many thanks to Adam who built the
very first functional version of Bazel and Zig integration.
This repository is based on Adam Bouhenguel's [bazel-zig-cc][ajbouh], later
developed at `sr.ht/~motiejus/bazel-zig-cc`. After a while it was moved to
[github.com/uber](https://github.com/uber) and renamed to
`hermetic_cc_toolchain`. Our special thanks to Adam for creating the original
version and publishing it, his contribution helped make the idea to use Zig
with Bazel at Uber a reality; now we all can benefit from it.
Previously communications were done in an email list; the past archive is in
`mailing-list-archive.mbox`. It can be accessed like this:
@ -35,19 +36,19 @@ Previously communications were done in an email list; the past archive is in
Add this to your `WORKSPACE`:
```
BAZEL_ZIG_CC_VERSION = "v1.0.1"
HERMETIC_CC_TOOLCHAIN_VERSION = "v1.0.1"
http_archive(
name = "bazel-zig-cc",
name = "hermetic_cc_toolchain",
sha256 = "e9f82bfb74b3df5ca0e67f4d4989e7f1f7ce3386c295fd7fda881ab91f83e509",
strip_prefix = "bazel-zig-cc-{}".format(BAZEL_ZIG_CC_VERSION),
strip_prefix = "bazel-zig-cc-{}".format(HERMETIC_CC_TOOLCHAIN_VERSION),
urls = [
"https://mirror.bazel.build/github.com/uber/bazel-zig-cc/releases/download/{0}/{0}.tar.gz".format(BAZEL_ZIG_CC_VERSION),
"https://github.com/uber/bazel-zig-cc/releases/download/{0}/{0}.tar.gz".format(BAZEL_ZIG_CC_VERSION),
"https://mirror.bazel.build/github.com/uber/hermetic_cc_toolchain/releases/download/{0}/{0}.tar.gz".format(HERMETIC_CC_TOOLCHAIN_VERSION),
"https://github.com/uber/hermetic_cc_toolchain/releases/download/{0}/{0}.tar.gz".format(HERMETIC_CC_TOOLCHAIN_VERSION),
],
)
load("@bazel-zig-cc//toolchain:defs.bzl", zig_toolchains = "toolchains")
load("@hermetic_cc_toolchain//toolchain:defs.bzl", zig_toolchains = "toolchains")
# version, url_formats and host_platform_sha256 are optional for those who
# want to control their Zig SDK version.
@ -70,13 +71,13 @@ The snippets above will download the zig toolchain and make the bazel
toolchains available for registration and usage. If you do nothing else, this
may work. The `.bazelrc` snippet instructs Bazel to use the registered "new
kinds of toolchains". All above are required regardless of how wants to use it.
The next steps depend on how one wants to use bazel-zig-cc. The descriptions
The next steps depend on how one wants to use `hermetic_cc_toolchain`. The descriptions
below is a gentle introduction to C++ toolchains from "user's perspective" too.
## Use case: manually build a single target with a specific zig cc toolchain
This option is least disruptive to the workflow compared to no hermetic C++
toolchain, and works best when trying out or getting started with bazel-zig-cc
toolchain, and works best when trying out or getting started with `hermetic_cc_toolchain`
for a subset of targets.
To request Bazel to use a specific toolchain (compatible with the specified
@ -180,7 +181,7 @@ build --action_env BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1
From Bazel's perspective, this is almost equivalent to always specifying
`--extra_toolchains` on every `bazel <...>` command-line invocation. It also
means there is no way to disable the toolchain with the command line. This is
useful if you find bazel-zig-cc useful enough to compile for all of your
useful if you find `hermetic_cc_toolchain` useful enough to compile for all of your
targets and tools.
With `BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1` Bazel stops detecting the default
@ -304,9 +305,9 @@ SIGILL: illegal instruction
This flag encourages program authors to fix the undefined behavior. There are
[many ways][ubsan2] to find the undefined behavior.
# Known Issues In bazel-zig-cc
# Known Issues In `hermetic_cc_toolchain`
These are the things you may stumble into when using bazel-zig-cc. I am
These are the things you may stumble into when using `hermetic_cc_toolchain`. I am
unlikely to implement them any time soon, but patches implementing those will
be accepted. See [Questions & Contributions](#questions-amp-contributions) on
how to contribute.
@ -341,7 +342,7 @@ currently targets the lowest version, without ability to change it.
# Known Issues In Upstream
This section lists issues that I've stumbled into when using `zig cc`, and is
outside of bazel-zig-cc's control.
outside of `hermetic_cc_toolchain`'s control.
## using glibc 2.27 or older
@ -400,7 +401,7 @@ The tests are running (CId) on linux-amd64.
## Transient docker environment
A standalone Docker environment to play with bazel-zig-cc:
A standalone Docker environment to play with `hermetic_cc_toolchain`:
```
$ docker run -e CC=/usr/bin/false -ti --rm -v "$PWD:/x" -w /x debian:bullseye-slim
@ -418,7 +419,7 @@ We maintain two channels for comms:
# Maintainers
This section lists the driving forces behind bazel-zig-cc. Committers have push
This section lists the driving forces behind `hermetic_cc_toolchain`. Committers have push
access, maintainers have their areas. Should make it easier to understand our
interests when reading patches or mailing lists.
@ -432,16 +433,17 @@ You may find contact information of the individuals in the commit logs.
# Publicity
This section lists notable uses or mentions of bazel-zig-cc.
This section lists notable uses or mentions of `bazel-zig-cc` (before the
rename) and afterwards of the `hermetic_cc_toolchain`.
- 2023-01-24 [bazel-zig-cc v1.0.0][bazel-zig-cc-v1]: releasing bazel-zig-cc and
admitting that bazel-zig-cc is used in production to compile all of Uber's
[Go Monorepo][go-monorepo].
- 2023-01-24 [bazel-zig-cc v1.0.0][bazel-zig-cc-v1]:
releasing `bazel-zig-cc` and telling that `bazel-zig-cc`
is used in production to compile all of Uber's [Go Monorepo][go-monorepo].
- 2022-11-18 [BazelCon 2022: Making Uber's hermetic C++
toolchain][bazelcon2022]: Laurynas Lubys presents the story of how this
repository came into being and how it was used (as of the conference).
- 2022-05-23 [How Zig is used at Uber (youtube)][yt-how-zig-is-used-at-uber]:
Yours Truly (the author) talks about how bazel-zig-cc came to existence and
Yours Truly (the author) talks about how `bazel-zig-cc` came to existence and
how it's used at Uber in Milan Zig Meetup.
- 2022-05-23 [How Uber uses Zig][how-uber-uses-zig]: text version of the above.
- 2022-03-30 [Google Open Source Peer Bonus Program][google-award] awarded the

View File

@ -1,5 +1,5 @@
workspace(
name = "bazel-zig-cc",
name = "hermetic_cc_toolchain",
)
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

View File

@ -23,5 +23,5 @@ echo "--- zig fmt --check toolchain/launcher.zig"
$ZIG fmt --check toolchain/launcher.zig
echo "--- zig test toolchain/launcher.zig"
# until bazel-zig-cc gets a zig toolchain, run launcher's unit tests here.
# until hermetic_cc_toolchain gets a zig toolchain, run launcher's unit tests here.
$ZIG test toolchain/launcher.zig

View File

@ -12,4 +12,4 @@ tools/bazel run //tools/releaser -- -tag v99.0.0
cleanup() { git tag -d v99.0.0; git reset --hard "$prev_ref"; }
trap cleanup EXIT
file bazel-zig-cc-v99.0.0.tar.gz | grep -q 'gzip compressed data'
file hermetic_cc_toolchain-v99.0.0.tar.gz | grep -q 'gzip compressed data'

View File

@ -5,7 +5,7 @@
set -xeuo pipefail
cache_prefix="${BAZEL_ZIG_CC_CACHE_PREFIX:-/tmp/bazel-zig-cc}"
cache_prefix="${HERMETIC_CC_TOOLCHAIN_CACHE_PREFIX:-/tmp/hermetic_cc_toolchain}"
# check a very hermetic setup with a single target. Re-building all of
# them takes a long time, so using only one. If we ever decide to build all

2
go.mod
View File

@ -1,4 +1,4 @@
module github.com/uber/bazel-zig-cc
module github.com/uber/hermetic_cc_toolchain
go 1.19

View File

@ -9,9 +9,9 @@ gc_linkopts values that are needed to compile for macos target.
To use it, add this map_kind gazelle directive to your BUILD.bazel files
where target binary needs to be compiled with zig toolchain.
Example: if this toolchain is registered as bazel-zig-cc in your WORKSPACE, add this to
Example: if this toolchain is registered as hermetic_cc_toolchain in your WORKSPACE, add this to
your root BUILD file
# gazelle:map_kind go_binary go_binary @bazel-zig-cc//rules:rules_go.bzl
# gazelle:map_kind go_binary go_binary @hermetic_cc_toolchain//rules:rules_go.bzl
"""
_MACOS_GC_LINKOPTS = ["-s", "-w", "-buildmode=pie"]

View File

@ -1,4 +1,4 @@
load("@bazel-zig-cc//rules:platform.bzl", "platform_binary")
load("@hermetic_cc_toolchain//rules:platform.bzl", "platform_binary")
cc_binary(
name = "which_libc",

View File

@ -3,13 +3,13 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
load("//rules:rules_go.bzl", "go_binary")
load("@bazel-zig-cc//rules:platform.bzl", "platform_binary", "platform_test")
load("@hermetic_cc_toolchain//rules:platform.bzl", "platform_binary", "platform_test")
go_library(
name = "cgo_lib",
srcs = ["cgo.go"],
cgo = True,
importpath = "github.com/uber/bazel-zig-cc/test/cgo",
importpath = "github.com/uber/hermetic_cc_toolchain/test/cgo",
visibility = ["//visibility:private"],
)

View File

@ -1,7 +1,7 @@
# Copyright 2023 Uber Technologies, Inc.
# Licensed under the MIT License
load("@bazel-zig-cc//rules:platform.bzl", "platform_binary")
load("@hermetic_cc_toolchain//rules:platform.bzl", "platform_binary")
cc_binary(
name = "main",

View File

@ -9,7 +9,7 @@ go_library(
srcs = ["main.go"],
# keep
cgo = True,
importpath = "github.com/uber/bazel-zig-cc/test/gorace",
importpath = "github.com/uber/hermetic_cc_toolchain/test/gorace",
visibility = ["//visibility:private"],
)

View File

@ -9,7 +9,7 @@
// More context: https://github.com/ziglang/zig/issues/11398
//
// This fails, because `zig cc` adds `--gc-sections` to the linker
// flag by default, which is incompatible with cgo. bazel-zig-cc
// flag by default, which is incompatible with cgo. hermetic_cc_toolchain
// adds a workaround for it.
package main

View File

@ -1,7 +1,7 @@
# Copyright 2023 Uber Technologies, Inc.
# Licensed under the MIT License
load("@bazel-zig-cc//rules:platform.bzl", "platform_binary", "platform_test")
load("@hermetic_cc_toolchain//rules:platform.bzl", "platform_binary", "platform_test")
cc_binary(
name = "winver",

View File

@ -1,8 +1,8 @@
# Copyright 2023 Uber Technologies, Inc.
# Licensed under the MIT License
load("@bazel-zig-cc//toolchain:defs.bzl", "declare_files")
load("@bazel-zig-cc//toolchain/private:cc_toolchains.bzl", "declare_cc_toolchains")
load("@hermetic_cc_toolchain//toolchain:defs.bzl", "declare_files")
load("@hermetic_cc_toolchain//toolchain/private:cc_toolchains.bzl", "declare_cc_toolchains")
package(
default_visibility = ["//visibility:public"],

View File

@ -1,7 +1,7 @@
load("@bazel_skylib//lib:paths.bzl", "paths")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "read_user_netrc", "use_netrc")
load("@bazel-zig-cc//toolchain/private:defs.bzl", "target_structs", "zig_tool_path")
load("@hermetic_cc_toolchain//toolchain/private:defs.bzl", "target_structs", "zig_tool_path")
# Directories that `zig c++` includes behind the scenes.
_DEFAULT_INCLUDE_DIRECTORIES = [
@ -13,11 +13,8 @@ _DEFAULT_INCLUDE_DIRECTORIES = [
# Official recommended version. Should use this when we have a usable release.
URL_FORMAT_RELEASE = "https://ziglang.org/download/{version}/zig-{host_platform}-{version}.{_ext}"
# Caution: nightly releases are purged from ziglang.org after ~90 days. A real
# solution would be to allow the downstream project specify their own mirrors.
# This is explained in
# https://sr.ht/~motiejus/bazel-zig-cc/#alternative-download-urls and is
# awaiting my attention or your contribution.
# Caution: nightly releases are purged from ziglang.org after ~90 days. Use the
# Bazel mirror or your own.
URL_FORMAT_NIGHTLY = "https://ziglang.org/builds/zig-{host_platform}-{version}.{_ext}"
# Official Bazel's mirror with selected Zig SDK versions. Bazel community is
@ -176,19 +173,19 @@ def _zig_repository_impl(repository_ctx):
sha256 = zig_sha256,
)
cache_prefix = repository_ctx.os.environ.get("BAZEL_ZIG_CC_CACHE_PREFIX", "")
cache_prefix = repository_ctx.os.environ.get("HERMETIC_CC_TOOLCHAIN_CACHE_PREFIX", "")
if cache_prefix == "":
if os == "windows":
cache_prefix = "C:\\\\Temp\\\\bazel-zig-cc"
cache_prefix = "C:\\\\Temp\\\\hermetic_cc_toolchain"
else:
cache_prefix = "/tmp/bazel-zig-cc"
cache_prefix = "/tmp/hermetic_cc_toolchain"
repository_ctx.template(
"tools/launcher.zig",
Label("//toolchain:launcher.zig"),
executable = False,
substitutions = {
"{BAZEL_ZIG_CC_CACHE_PREFIX}": cache_prefix,
"{HERMETIC_CC_TOOLCHAIN_CACHE_PREFIX}": cache_prefix,
},
)
@ -244,7 +241,7 @@ zig_repository = repository_rule(
"url_formats": attr.string_list(allow_empty = False),
"host_platform_ext": attr.string_dict(),
},
environ = ["BAZEL_ZIG_CC_CACHE_PREFIX"],
environ = ["HERMETIC_CC_TOOLCHAIN_CACHE_PREFIX"],
implementation = _zig_repository_impl,
)

View File

@ -36,14 +36,14 @@
// complain that the compiler is using undeclared directories on the host file
// system. We do not declare prerequisites using absolute paths, because that
// busts Bazel's remote cache.
// * BAZEL_ZIG_CC_CACHE_PREFIX is configurable per toolchain instance, and
// * HERMETIC_CC_TOOLCHAIN_CACHE_PREFIX is configurable per toolchain instance, and
// ZIG_GLOBAL_CACHE_DIR and ZIG_LOCAL_CACHE_DIR must be set to its value for
// all `zig` invocations.
//
// Originally this was a Bash script, then a POSIX shell script, then two
// scripts (one with pre-defined BAZEL_ZIG_CC_CACHE_PREFIX, one without). Then
// Windows came along with two PowerShell scripts (ports of the POSIX shell
// scripts), which I kept breaking. Then Bazel 6 came with
// scripts (one with pre-defined HERMETIC_CC_TOOLCHAIN_CACHE_PREFIX, one
// without). Then Windows came along with two PowerShell scripts (ports of the
// POSIX shell scripts), which I kept breaking. Then Bazel 6 came with
// `--experimental_use_hermetic_linux_sandbox`, which hermetizes the sandbox to
// the extreme: the sandbox has nothing that is not declared. /bin/sh and its
// dependencies (/lib/x86_64-linux-gnu/libc.so.6 on my system) are obviously
@ -67,7 +67,7 @@ const EXE = switch (builtin.target.os.tag) {
else => "",
};
const CACHE_DIR = "{BAZEL_ZIG_CC_CACHE_PREFIX}";
const CACHE_DIR = "{HERMETIC_CC_TOOLCHAIN_CACHE_PREFIX}";
const usage_cpp =
\\

View File

@ -1,7 +1,7 @@
# Copyright 2023 Uber Technologies, Inc.
# Licensed under the MIT License
load("@bazel-zig-cc//toolchain/libc:defs.bzl", "declare_libcs")
load("@hermetic_cc_toolchain//toolchain/libc:defs.bzl", "declare_libcs")
package(
default_visibility = ["//visibility:public"],

View File

@ -1,7 +1,7 @@
# Copyright 2023 Uber Technologies, Inc.
# Licensed under the MIT License
load("@bazel-zig-cc//toolchain/private:defs.bzl", "LIBCS")
load("@hermetic_cc_toolchain//toolchain/private:defs.bzl", "LIBCS")
def declare_libcs():
for libc in LIBCS:

View File

@ -1,7 +1,7 @@
# Copyright 2023 Uber Technologies, Inc.
# Licensed under the MIT License
load("@bazel-zig-cc//toolchain/platform:defs.bzl", "declare_libc_aware_platforms")
load("@hermetic_cc_toolchain//toolchain/platform:defs.bzl", "declare_libc_aware_platforms")
package(
default_visibility = ["//visibility:public"],

View File

@ -1,7 +1,7 @@
# Copyright 2023 Uber Technologies, Inc.
# Licensed under the MIT License
load("@bazel-zig-cc//toolchain/toolchain:defs.bzl", "declare_libc_aware_toolchains")
load("@hermetic_cc_toolchain//toolchain/toolchain:defs.bzl", "declare_libc_aware_toolchains")
package(
default_visibility = ["//visibility:public"],

View File

@ -1,4 +1,4 @@
load("@bazel-zig-cc//toolchain/platform:defs.bzl", "declare_platforms")
load("@hermetic_cc_toolchain//toolchain/platform:defs.bzl", "declare_platforms")
package(
default_visibility = ["//visibility:public"],

View File

@ -1,4 +1,4 @@
load("@bazel-zig-cc//toolchain/private:defs.bzl", "LIBCS")
load("@hermetic_cc_toolchain//toolchain/private:defs.bzl", "LIBCS")
_CPUS = (("x86_64", "amd64"), ("aarch64", "arm64"))
_OS = {

View File

@ -1,5 +1,5 @@
load(":defs.bzl", "target_structs", "zig_tool_path")
load("@bazel-zig-cc//toolchain:zig_toolchain.bzl", "zig_cc_toolchain_config")
load("@hermetic_cc_toolchain//toolchain:zig_toolchain.bzl", "zig_cc_toolchain_config")
DEFAULT_TOOL_PATHS = {
"ar": "ar",

View File

@ -1,4 +1,4 @@
load("@bazel-zig-cc//toolchain/toolchain:defs.bzl", "declare_toolchains")
load("@hermetic_cc_toolchain//toolchain/toolchain:defs.bzl", "declare_toolchains")
package(
default_visibility = ["//visibility:public"],

View File

@ -1,4 +1,4 @@
load("@bazel-zig-cc//toolchain/private:defs.bzl", "target_structs")
load("@hermetic_cc_toolchain//toolchain/private:defs.bzl", "target_structs")
def declare_toolchains():
for target_config in target_structs():

View File

@ -7,7 +7,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
go_library(
name = "releaser_lib",
srcs = ["main.go"],
importpath = "github.com/uber/bazel-zig-cc/tools/releaser",
importpath = "github.com/uber/hermetic_cc_toolchain/tools/releaser",
visibility = ["//visibility:private"],
)

View File

@ -1 +1 @@
workspace(name = "bazel-zig-cc")
workspace(name = "hermetic_cc_toolchain")

View File

@ -1,7 +1,7 @@
// Copyright 2023 Uber Technologies, Inc.
// Licensed under the MIT License
// releaser is a tool for managing part of the process to release a new version of bazel-zig-cc.
// releaser is a tool for managing part of the process to release a new version of hermetic_cc_toolchain.
package main
import (
@ -50,7 +50,7 @@ func run() (_err error) {
tag string
)
flag.StringVar(&repoRoot, "repo_root", os.Getenv("BUILD_WORKSPACE_DIRECTORY"), "root directory of bazel-zig-cc repo")
flag.StringVar(&repoRoot, "repo_root", os.Getenv("BUILD_WORKSPACE_DIRECTORY"), "root directory of hermetic_cc_toolchain repo")
flag.StringVar(&tag, "tag", "", "tag for this release")
flag.Usage = func() {
@ -93,7 +93,7 @@ This utility is intended to handle many of the steps to release a new version.
}
}
fpath := path.Join(repoRoot, fmt.Sprintf("bazel-zig-cc-%s.tar.gz", tag))
fpath := path.Join(repoRoot, fmt.Sprintf("hermetic_cc_toolchain-%s.tar.gz", tag))
tgz, err := os.Create(fpath)
if err != nil {
return err
@ -119,7 +119,7 @@ This utility is intended to handle many of the steps to release a new version.
"archive",
"--format=tar",
// WORKSPACE in the resulting tarball needs to be much
// smaller than of bazel-zig-cc. See #15.
// smaller than of hermetic_cc_toolchain. See #15.
"--add-file=tools/releaser/WORKSPACE",
tag,
}, _paths...)...,
@ -151,15 +151,15 @@ func genBoilerplate(version, shasum string) string {
return fmt.Sprintf(`load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "bazel-zig-cc",
name = "hermetic_cc_toolchain",
sha256 = "%[2]s",
urls = [
"https://mirror.bazel.build/github.com/uber/bazel-zig-cc/releases/download/%[1]s/bazel-zig-cc-%[1]s.tar.gz",
"https://github.com/uber/bazel-zig-cc/releases/download/%[1]s/bazel-zig-cc-%[1]s.tar.gz",
"https://mirror.bazel.build/github.com/uber/hermetic_cc_toolchain/releases/download/%[1]s/hermetic_cc_toolchain-%[1]s.tar.gz",
"https://github.com/uber/hermetic_cc_toolchain/releases/download/%[1]s/hermetic_cc_toolchain-%[1]s.tar.gz",
],
)
load("@bazel-zig-cc//toolchain:defs.bzl", zig_toolchains = "toolchains")
load("@hermetic_cc_toolchain//toolchain:defs.bzl", zig_toolchains = "toolchains")
# plain zig_toolchains() will pick reasonable defaults. See
# toolchain/defs.bzl:toolchains on how to change the Zig SDK path and version.