blob: bd8c307eef391460dda59235af811098e899c8ca [file] [log] [blame]
Serge Bazanski385c12f2020-06-17 12:12:42 +02001load(":cc_toolchain_config.bzl", "host_cc_toolchain_config")
2
3# Toolchain definitions.
4#
Serge Bazanski9e861a82020-09-16 13:46:41 +02005# 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 Bazanski662b5b32020-12-21 13:49:00 +010010# 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 Bazanski9e861a82020-09-16 13:46:41 +020013#
14
15# This file defines //build/toolchain:host_cc_suite.
16#
Serge Bazanski385c12f2020-06-17 12:12:42 +020017# 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 Bazanski662b5b32020-12-21 13:49:00 +010032# target static binaries for Metropolis nodes, so that mkfs.xfs can be built
33# using native cc_* rules, too.
Serge Bazanski385c12f2020-06-17 12:12:42 +020034#
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
38package(default_visibility = ["//visibility:public"])
39
40filegroup(name = "empty")
41
42cc_toolchain_suite(
43 name = "host_cc_suite",
44 toolchains = {
45 "k8": ":host_cc_k8_toolchain",
46 },
47)
48
49cc_toolchain(
50 name = "host_cc_k8_toolchain",
Serge Bazanski385c12f2020-06-17 12:12:42 +020051 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 Bazanskif12bedf2021-01-15 16:58:50 +010058 toolchain_config = ":host_cc_k8_toolchain_config",
59 toolchain_identifier = "host-k8-toolchain",
Serge Bazanski385c12f2020-06-17 12:12:42 +020060)
61
62host_cc_toolchain_config(name = "host_cc_k8_toolchain_config")