Serge Bazanski | 385c12f | 2020-06-17 12:12:42 +0200 | [diff] [blame] | 1 | load(":cc_toolchain_config.bzl", "host_cc_toolchain_config") |
| 2 | |
| 3 | # Toolchain definitions. |
| 4 | # |
Serge Bazanski | 9e861a8 | 2020-09-16 13:46:41 +0200 | [diff] [blame] | 5 | # We currently define two toolchains: |
| 6 | # |
| 7 | # - //build/toolchain:host_cc_suite , which is a fully unhermetic host toolchain, |
| 8 | # that can be used to build tools for the host. |
| 9 | # - //build/toolchain/musl-host-gcc:musl_host_cc_suite , which combines the host's |
Serge Bazanski | 662b5b3 | 2020-12-21 13:49:00 +0100 | [diff] [blame] | 10 | # gcc compiler with a sysroot tarball that targets the Metropolis node |
| 11 | # runtime. This can be used to build C libraries/tools running within the |
| 12 | # Metropolis node image. |
Serge Bazanski | 9e861a8 | 2020-09-16 13:46:41 +0200 | [diff] [blame] | 13 | # |
| 14 | |
| 15 | # This file defines //build/toolchain:host_cc_suite. |
| 16 | # |
Serge Bazanski | 385c12f | 2020-06-17 12:12:42 +0200 | [diff] [blame] | 17 | # This is a C++ toolchain that uses GCC from the host at hardcoded paths. We |
| 18 | # can get away with this, as currently the entire build is performed in a known |
| 19 | # container (see: //scripts:create_container.sh). We define this toolchain so |
| 20 | # that we have full control over all configuration of it, which we need as we |
| 21 | # are building some fairly odd C binaries (notably, a qboot bootloader for |
| 22 | # testing). |
| 23 | # |
| 24 | # The host_cc toolchain suite is enabled for all cc_* targets that aren't |
| 25 | # building host tools by setting --crosstool_top in .bazelrc. In the future, |
| 26 | # this should only be triggered by transitions where necessary. |
| 27 | # |
| 28 | # In the future, the host_cc toolchains should be replaced by a hermetic |
| 29 | # toolchain that's built locally, or downloaded from the Internet - as |
| 30 | # github.com/bazelbuild/bazel-toolchains does it. As that's being built, we |
| 31 | # should then also have another toolchain definition for C binaries that |
Serge Bazanski | 662b5b3 | 2020-12-21 13:49:00 +0100 | [diff] [blame] | 32 | # target static binaries for Metropolis nodes, so that mkfs.xfs can be built |
| 33 | # using native cc_* rules, too. |
Serge Bazanski | 385c12f | 2020-06-17 12:12:42 +0200 | [diff] [blame] | 34 | # |
| 35 | # This, and :cc_toolchain_config.bzl is based on the following tutorial: |
| 36 | # https://docs.bazel.build/versions/master/tutorial/cc-toolchain-config.html |
| 37 | |
| 38 | package(default_visibility = ["//visibility:public"]) |
| 39 | |
| 40 | filegroup(name = "empty") |
| 41 | |
| 42 | cc_toolchain_suite( |
| 43 | name = "host_cc_suite", |
| 44 | toolchains = { |
| 45 | "k8": ":host_cc_k8_toolchain", |
| 46 | }, |
| 47 | ) |
| 48 | |
| 49 | cc_toolchain( |
| 50 | name = "host_cc_k8_toolchain", |
Serge Bazanski | 385c12f | 2020-06-17 12:12:42 +0200 | [diff] [blame] | 51 | all_files = ":empty", |
| 52 | compiler_files = ":empty", |
| 53 | dwp_files = ":empty", |
| 54 | linker_files = ":empty", |
| 55 | objcopy_files = ":empty", |
| 56 | strip_files = ":empty", |
| 57 | supports_param_files = 0, |
Serge Bazanski | f12bedf | 2021-01-15 16:58:50 +0100 | [diff] [blame^] | 58 | toolchain_config = ":host_cc_k8_toolchain_config", |
| 59 | toolchain_identifier = "host-k8-toolchain", |
Serge Bazanski | 385c12f | 2020-06-17 12:12:42 +0200 | [diff] [blame] | 60 | ) |
| 61 | |
| 62 | host_cc_toolchain_config(name = "host_cc_k8_toolchain_config") |