Serge Bazanski | 385c12f | 2020-06-17 12:12:42 +0200 | [diff] [blame] | 1 | # Copyright 2020 The Monogon Project Authors. |
| 2 | # |
| 3 | # SPDX-License-Identifier: Apache-2.0 |
| 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
| 16 | |
| 17 | load("@bazel_tools//tools/cpp:cc_toolchain_config_lib.bzl", "tool_path") |
| 18 | |
| 19 | # This defines a minimal, non-parametrized toolchain configuration rule that |
| 20 | # uses the host GCC. For background on why we do this, see |
| 21 | # //build/toolchain/BUILD. |
| 22 | |
| 23 | def _host_cc_toolchain_impl(ctx): |
| 24 | tool_paths = [ |
| 25 | tool_path( |
| 26 | name = "gcc", |
| 27 | path = "/usr/bin/gcc", |
| 28 | ), |
| 29 | tool_path( |
| 30 | name = "ld", |
| 31 | path = "/usr/bin/ld", |
| 32 | ), |
| 33 | tool_path( |
| 34 | name = "ar", |
| 35 | path = "/usr/bin/ar", |
| 36 | ), |
| 37 | tool_path( |
| 38 | name = "cpp", |
| 39 | path = "/bin/false", |
| 40 | ), |
| 41 | tool_path( |
| 42 | name = "gcov", |
| 43 | path = "/bin/false", |
| 44 | ), |
| 45 | tool_path( |
| 46 | name = "nm", |
| 47 | path = "/bin/false", |
| 48 | ), |
| 49 | tool_path( |
| 50 | name = "objdump", |
| 51 | path = "/bin/false", |
| 52 | ), |
| 53 | tool_path( |
| 54 | name = "strip", |
| 55 | path = "/bin/false", |
| 56 | ), |
| 57 | ] |
| 58 | return cc_common.create_cc_toolchain_config_info( |
| 59 | ctx = ctx, |
| 60 | cxx_builtin_include_directories = [ |
| 61 | "/usr/lib/gcc/x86_64-redhat-linux/10/include/", |
| 62 | "/usr/include", |
| 63 | ], |
| 64 | toolchain_identifier = "k8-toolchain", |
| 65 | host_system_name = "local", |
| 66 | target_system_name = "local", |
| 67 | target_cpu = "k8", |
| 68 | target_libc = "unknown", |
| 69 | compiler = "gcc", |
| 70 | abi_version = "unknown", |
| 71 | abi_libc_version = "unknown", |
| 72 | tool_paths = tool_paths, |
| 73 | ) |
| 74 | |
| 75 | host_cc_toolchain_config = rule( |
| 76 | implementation = _host_cc_toolchain_impl, |
| 77 | attrs = {}, |
| 78 | provides = [CcToolchainConfigInfo], |
| 79 | ) |