• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2024 The Bazel Authors. All rights reserved.
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#    http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15load("@bazel_skylib//rules/directory:directory.bzl", "directory")
16load("@bazel_skylib//rules/directory:subdirectory.bzl", "subdirectory")
17
18package(default_visibility = ["//visibility:public"])
19
20licenses(["notice"])
21
22exports_files(glob(["bin/**"]))
23
24# Directory-based rules in this toolchain only referece things in
25# lib/ or include/ subdirectories.
26directory(
27    name = "toolchain_root",
28    srcs = glob([
29        "lib/**",
30        "include/**",
31    ]),
32)
33
34subdirectory(
35    name = "include-c++-v1",
36    parent = ":toolchain_root",
37    path = "include/c++/v1",
38)
39
40subdirectory(
41    name = "lib-clang-include",
42    parent = ":toolchain_root",
43    path = "lib/clang/19/include",
44)
45
46subdirectory(
47    name = "include-x86_64-unknown-linux-gnu-c++-v1",
48    parent = ":toolchain_root",
49    path = "include/x86_64-unknown-linux-gnu/c++/v1",
50)
51
52filegroup(
53    name = "builtin_headers",
54    srcs = [
55        ":include-c++-v1",
56        ":include-x86_64-unknown-linux-gnu-c++-v1",
57        ":lib-clang-include",
58    ],
59)
60
61# Various supporting files needed to run the linker.
62filegroup(
63    name = "linker_builtins",
64    data = glob([
65        "bin/lld*",
66        "bin/ld*",
67        "lib/**/*.a",
68        "lib/**/*.so*",
69        "lib/**/*.o",
70    ]) + [
71        ":multicall_support_files",
72    ],
73)
74
75# Some toolchain distributions use busybox-style handling of tools, so things
76# like `clang++` just redirect to a `llvm` binary. This glob catches this
77# binary if it's included in the distribution, and is a no-op if the multicall
78# binary doesn't exist.
79filegroup(
80    name = "multicall_support_files",
81    srcs = glob(
82        ["bin/llvm"],
83        allow_empty = True,
84    ),
85)
86