blob: 5bf53d2ac64d771060655746bbf4a2d56cf29b85 [file] [log] [blame]
Serge Bazanski385c12f2020-06-17 12:12:42 +02001load(":cc_toolchain_config.bzl", "host_cc_toolchain_config")
2
3# Toolchain definitions.
4#
5# We currently define a single custom toolchain: the host_cc toolchain suite.
6# This is a C++ toolchain that uses GCC from the host at hardcoded paths. We
7# can get away with this, as currently the entire build is performed in a known
8# container (see: //scripts:create_container.sh). We define this toolchain so
9# that we have full control over all configuration of it, which we need as we
10# are building some fairly odd C binaries (notably, a qboot bootloader for
11# testing).
12#
13# The host_cc toolchain suite is enabled for all cc_* targets that aren't
14# building host tools by setting --crosstool_top in .bazelrc. In the future,
15# this should only be triggered by transitions where necessary.
16#
17# In the future, the host_cc toolchains should be replaced by a hermetic
18# toolchain that's built locally, or downloaded from the Internet - as
19# github.com/bazelbuild/bazel-toolchains does it. As that's being built, we
20# should then also have another toolchain definition for C binaries that
21# target Smalltown static binaries, so that mkfs.xfs can be built using native
22# cc_* rules, too.
23#
24# This, and :cc_toolchain_config.bzl is based on the following tutorial:
25# https://docs.bazel.build/versions/master/tutorial/cc-toolchain-config.html
26
27package(default_visibility = ["//visibility:public"])
28
29filegroup(name = "empty")
30
31cc_toolchain_suite(
32 name = "host_cc_suite",
33 toolchains = {
34 "k8": ":host_cc_k8_toolchain",
35 },
36)
37
38cc_toolchain(
39 name = "host_cc_k8_toolchain",
40 toolchain_identifier = "host-k8-toolchain",
41 toolchain_config = ":host_cc_k8_toolchain_config",
42 all_files = ":empty",
43 compiler_files = ":empty",
44 dwp_files = ":empty",
45 linker_files = ":empty",
46 objcopy_files = ":empty",
47 strip_files = ":empty",
48 supports_param_files = 0,
49)
50
51host_cc_toolchain_config(name = "host_cc_k8_toolchain_config")