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