blob: 39a0eb4783b3fedd25baeacd548e42aa15d8cf24 [file] [log] [blame]
Tim Windelschmidt16cb15a2025-02-24 18:47:48 +01001load("@rules_cc//cc:defs.bzl", "cc_toolchain")
Serge Bazanski9e861a82020-09-16 13:46:41 +02002load("//build/toolchain:cc_toolchain_config.bzl", "host_cc_toolchain_config")
3
Leopoldbc93c2b2023-01-14 13:12:23 +01004# This file defines //build/toolchain/musl-host-gcc:musl_host_toolchain.
Serge Bazanski9e861a82020-09-16 13:46:41 +02005#
Leopoldbc93c2b2023-01-14 13:12:23 +01006# This is a C++ toolchain that uses GCC from the sandbox sysroot at hardcoded paths, with
Serge Bazanski662b5b32020-12-21 13:49:00 +01007# a pre-built sysroot tarball that targets Metropolis nodes with musl and Linux
Leopoldbc93c2b2023-01-14 13:12:23 +01008# headers. It's a superset of //build/toolchain:host_cc_toolchain.
9#
Serge Bazanski9e861a82020-09-16 13:46:41 +020010# For more information, see README.md.
11
Serge Bazanski9e861a82020-09-16 13:46:41 +020012cc_toolchain(
13 name = "musl_host_cc_k8_toolchain",
14 all_files = ":musl_toolchain_files",
Leopoldbc93c2b2023-01-14 13:12:23 +010015 ar_files = ":musl_toolchain_files",
16 as_files = ":musl_toolchain_files",
Serge Bazanski9e861a82020-09-16 13:46:41 +020017 compiler_files = ":musl_toolchain_files",
18 dwp_files = ":musl_toolchain_files",
19 linker_files = ":musl_toolchain_files",
20 objcopy_files = ":musl_toolchain_files",
21 strip_files = ":musl_toolchain_files",
22 supports_param_files = 0,
23 toolchain_config = ":musl_host_cc_k8_toolchain_config",
24 toolchain_identifier = "host-musl-k8-toolchain",
25)
26
27host_cc_toolchain_config(
28 name = "musl_host_cc_k8_toolchain_config",
29 gcc = "gcc-wrapper.sh",
Lorenz Brun735119f2021-03-11 00:30:01 +010030 has_cpp = False,
Serge Bazanski9e861a82020-09-16 13:46:41 +020031 host_includes = [],
Lorenz Brun735119f2021-03-11 00:30:01 +010032 is_glibc = False,
Tim Windelschmidt0de92122024-09-24 06:37:30 +020033 sysroot = package_relative_label("@musl_sysroot//:all").workspace_root,
Serge Bazanski9e861a82020-09-16 13:46:41 +020034)
35
36filegroup(
37 name = "musl_toolchain_files",
38 srcs = [
39 ":gcc-wrapper.sh",
40 ":musl.spec",
41 "@musl_sysroot//:all",
42 ],
43)
Leopoldbc93c2b2023-01-14 13:12:23 +010044
45toolchain(
46 name = "musl_host_toolchain",
47 exec_compatible_with = [
48 "@platforms//cpu:x86_64",
49 "@platforms//os:linux",
50 ],
51 target_compatible_with = [
52 "@platforms//cpu:x86_64",
53 "@platforms//os:linux",
54 "//build/platforms/linkmode:musl-static",
55 ],
56 toolchain = ":musl_host_cc_k8_toolchain",
57 toolchain_type = "@bazel_tools//tools/cpp:toolchain_type",
58)