| Tim Windelschmidt | 16cb15a | 2025-02-24 18:47:48 +0100 | [diff] [blame] | 1 | load("@rules_cc//cc:defs.bzl", "cc_toolchain") |
| Serge Bazanski | 9e861a8 | 2020-09-16 13:46:41 +0200 | [diff] [blame] | 2 | load("//build/toolchain:cc_toolchain_config.bzl", "host_cc_toolchain_config") |
| 3 | |
| Leopold | bc93c2b | 2023-01-14 13:12:23 +0100 | [diff] [blame] | 4 | # This file defines //build/toolchain/musl-host-gcc:musl_host_toolchain. |
| Serge Bazanski | 9e861a8 | 2020-09-16 13:46:41 +0200 | [diff] [blame] | 5 | # |
| Leopold | bc93c2b | 2023-01-14 13:12:23 +0100 | [diff] [blame] | 6 | # This is a C++ toolchain that uses GCC from the sandbox sysroot at hardcoded paths, with |
| Serge Bazanski | 662b5b3 | 2020-12-21 13:49:00 +0100 | [diff] [blame] | 7 | # a pre-built sysroot tarball that targets Metropolis nodes with musl and Linux |
| Leopold | bc93c2b | 2023-01-14 13:12:23 +0100 | [diff] [blame] | 8 | # headers. It's a superset of //build/toolchain:host_cc_toolchain. |
| 9 | # |
| Serge Bazanski | 9e861a8 | 2020-09-16 13:46:41 +0200 | [diff] [blame] | 10 | # For more information, see README.md. |
| 11 | |
| Serge Bazanski | 9e861a8 | 2020-09-16 13:46:41 +0200 | [diff] [blame] | 12 | cc_toolchain( |
| 13 | name = "musl_host_cc_k8_toolchain", |
| 14 | all_files = ":musl_toolchain_files", |
| Leopold | bc93c2b | 2023-01-14 13:12:23 +0100 | [diff] [blame] | 15 | ar_files = ":musl_toolchain_files", |
| 16 | as_files = ":musl_toolchain_files", |
| Serge Bazanski | 9e861a8 | 2020-09-16 13:46:41 +0200 | [diff] [blame] | 17 | 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 | |
| 27 | host_cc_toolchain_config( |
| 28 | name = "musl_host_cc_k8_toolchain_config", |
| 29 | gcc = "gcc-wrapper.sh", |
| Lorenz Brun | 735119f | 2021-03-11 00:30:01 +0100 | [diff] [blame] | 30 | has_cpp = False, |
| Serge Bazanski | 9e861a8 | 2020-09-16 13:46:41 +0200 | [diff] [blame] | 31 | host_includes = [], |
| Lorenz Brun | 735119f | 2021-03-11 00:30:01 +0100 | [diff] [blame] | 32 | is_glibc = False, |
| Tim Windelschmidt | 0de9212 | 2024-09-24 06:37:30 +0200 | [diff] [blame] | 33 | sysroot = package_relative_label("@musl_sysroot//:all").workspace_root, |
| Serge Bazanski | 9e861a8 | 2020-09-16 13:46:41 +0200 | [diff] [blame] | 34 | ) |
| 35 | |
| 36 | filegroup( |
| 37 | name = "musl_toolchain_files", |
| 38 | srcs = [ |
| 39 | ":gcc-wrapper.sh", |
| 40 | ":musl.spec", |
| 41 | "@musl_sysroot//:all", |
| 42 | ], |
| 43 | ) |
| Leopold | bc93c2b | 2023-01-14 13:12:23 +0100 | [diff] [blame] | 44 | |
| Jan Schär | 230a31a | 2025-05-05 12:28:50 +0000 | [diff] [blame^] | 45 | config_setting( |
| 46 | name = "is_static", |
| 47 | flag_values = {"//build/platforms/linkmode:static": "True"}, |
| 48 | ) |
| 49 | |
| Leopold | bc93c2b | 2023-01-14 13:12:23 +0100 | [diff] [blame] | 50 | toolchain( |
| 51 | name = "musl_host_toolchain", |
| 52 | exec_compatible_with = [ |
| 53 | "@platforms//cpu:x86_64", |
| 54 | "@platforms//os:linux", |
| 55 | ], |
| 56 | target_compatible_with = [ |
| 57 | "@platforms//cpu:x86_64", |
| 58 | "@platforms//os:linux", |
| Jan Schär | 230a31a | 2025-05-05 12:28:50 +0000 | [diff] [blame^] | 59 | ], |
| 60 | target_settings = [ |
| 61 | ":is_static", |
| Leopold | bc93c2b | 2023-01-14 13:12:23 +0100 | [diff] [blame] | 62 | ], |
| 63 | toolchain = ":musl_host_cc_k8_toolchain", |
| 64 | toolchain_type = "@bazel_tools//tools/cpp:toolchain_type", |
| 65 | ) |