jcater | f5c8c0b | 2018-03-27 07:22:35 -0700 | [diff] [blame] | 1 | # Copyright 2018 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 | |
aldersondrive | 644b7d41 | 2020-01-10 07:48:15 -0800 | [diff] [blame] | 15 | # This becomes the BUILD file for @local_config_cc// under FreeBSD and OpenBSD. |
jcater | f5c8c0b | 2018-03-27 07:22:35 -0700 | [diff] [blame] | 16 | |
rosica | 5ee6d35 | 2019-08-09 07:24:36 -0700 | [diff] [blame] | 17 | load(":cc_toolchain_config.bzl", "cc_toolchain_config") |
ruperts | c0f0f8d | 2021-06-14 15:52:09 -0700 | [diff] [blame] | 18 | load("@rules_cc//cc:defs.bzl", "cc_library", "cc_toolchain", "cc_toolchain_suite") |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 19 | |
Xavier Bonaventura | 36116ce | 2021-04-06 02:23:40 -0700 | [diff] [blame] | 20 | package(default_visibility = ["//visibility:public"]) |
| 21 | |
jcater | f5c8c0b | 2018-03-27 07:22:35 -0700 | [diff] [blame] | 22 | cc_library( |
| 23 | name = "malloc", |
| 24 | ) |
| 25 | |
jcater | f5c8c0b | 2018-03-27 07:22:35 -0700 | [diff] [blame] | 26 | filegroup( |
| 27 | name = "empty", |
| 28 | srcs = [], |
| 29 | ) |
| 30 | |
| 31 | # Hardcoded toolchain, legacy behaviour. |
| 32 | cc_toolchain_suite( |
| 33 | name = "toolchain", |
| 34 | toolchains = { |
| 35 | "armeabi-v7a|compiler": ":cc-compiler-armeabi-v7a", |
| 36 | "freebsd|compiler": ":cc-compiler-freebsd", |
aldersondrive | 644b7d41 | 2020-01-10 07:48:15 -0800 | [diff] [blame] | 37 | "openbsd|compiler": ":cc-compiler-openbsd", |
rosica | 547bf42 | 2018-09-06 02:10:02 -0700 | [diff] [blame] | 38 | "armeabi-v7a": ":cc-compiler-armeabi-v7a", |
| 39 | "freebsd": ":cc-compiler-freebsd", |
aldersondrive | 644b7d41 | 2020-01-10 07:48:15 -0800 | [diff] [blame] | 40 | "openbsd": ":cc-compiler-openbsd", |
jcater | f5c8c0b | 2018-03-27 07:22:35 -0700 | [diff] [blame] | 41 | }, |
| 42 | ) |
| 43 | |
| 44 | cc_toolchain( |
| 45 | name = "cc-compiler-freebsd", |
| 46 | all_files = ":empty", |
Googler | 28953cb | 2018-12-05 10:46:00 -0800 | [diff] [blame] | 47 | ar_files = ":empty", |
| 48 | as_files = ":empty", |
jcater | f5c8c0b | 2018-03-27 07:22:35 -0700 | [diff] [blame] | 49 | compiler_files = ":empty", |
jcater | f5c8c0b | 2018-03-27 07:22:35 -0700 | [diff] [blame] | 50 | dwp_files = ":empty", |
jcater | f5c8c0b | 2018-03-27 07:22:35 -0700 | [diff] [blame] | 51 | linker_files = ":empty", |
| 52 | objcopy_files = ":empty", |
jcater | f5c8c0b | 2018-03-27 07:22:35 -0700 | [diff] [blame] | 53 | strip_files = ":empty", |
| 54 | supports_param_files = 0, |
hlopko | 1a25668 | 2019-10-24 07:01:01 -0700 | [diff] [blame] | 55 | toolchain_config = ":local_freebsd", |
| 56 | toolchain_identifier = "local_freebsd", |
jcater | f5c8c0b | 2018-03-27 07:22:35 -0700 | [diff] [blame] | 57 | ) |
| 58 | |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 59 | cc_toolchain_config( |
| 60 | name = "local_freebsd", |
| 61 | cpu = "freebsd", |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 62 | ) |
| 63 | |
jcater | f5c8c0b | 2018-03-27 07:22:35 -0700 | [diff] [blame] | 64 | toolchain( |
| 65 | name = "cc-toolchain-freebsd", |
| 66 | exec_compatible_with = [ |
hlopko | 71a213c | 2019-06-21 02:01:33 -0700 | [diff] [blame] | 67 | "@platforms//cpu:x86_64", |
| 68 | "@platforms//os:freebsd", |
jcater | f5c8c0b | 2018-03-27 07:22:35 -0700 | [diff] [blame] | 69 | ], |
| 70 | target_compatible_with = [ |
hlopko | 71a213c | 2019-06-21 02:01:33 -0700 | [diff] [blame] | 71 | "@platforms//cpu:x86_64", |
| 72 | "@platforms//os:freebsd", |
jcater | f5c8c0b | 2018-03-27 07:22:35 -0700 | [diff] [blame] | 73 | ], |
| 74 | toolchain = ":cc-compiler-freebsd", |
| 75 | toolchain_type = "@bazel_tools//tools/cpp:toolchain_type", |
| 76 | ) |
| 77 | |
| 78 | cc_toolchain( |
aldersondrive | 644b7d41 | 2020-01-10 07:48:15 -0800 | [diff] [blame] | 79 | name = "cc-compiler-openbsd", |
| 80 | all_files = ":empty", |
| 81 | ar_files = ":empty", |
| 82 | as_files = ":empty", |
| 83 | compiler_files = ":empty", |
| 84 | dwp_files = ":empty", |
| 85 | linker_files = ":empty", |
| 86 | objcopy_files = ":empty", |
| 87 | strip_files = ":empty", |
| 88 | supports_param_files = 0, |
| 89 | toolchain_config = ":local_openbsd", |
| 90 | toolchain_identifier = "local_openbsd", |
| 91 | ) |
| 92 | |
| 93 | cc_toolchain_config( |
| 94 | name = "local_openbsd", |
| 95 | cpu = "openbsd", |
| 96 | ) |
| 97 | |
| 98 | toolchain( |
| 99 | name = "cc-toolchain-openbsd", |
| 100 | exec_compatible_with = [ |
| 101 | "@platforms//cpu:x86_64", |
| 102 | "@platforms//os:openbsd", |
| 103 | ], |
| 104 | target_compatible_with = [ |
| 105 | "@platforms//cpu:x86_64", |
| 106 | "@platforms//os:openbsd", |
| 107 | ], |
| 108 | toolchain = ":cc-compiler-openbsd", |
| 109 | toolchain_type = "@bazel_tools//tools/cpp:toolchain_type", |
| 110 | ) |
| 111 | |
| 112 | cc_toolchain( |
jcater | f5c8c0b | 2018-03-27 07:22:35 -0700 | [diff] [blame] | 113 | name = "cc-compiler-armeabi-v7a", |
| 114 | all_files = ":empty", |
Googler | 28953cb | 2018-12-05 10:46:00 -0800 | [diff] [blame] | 115 | ar_files = ":empty", |
| 116 | as_files = ":empty", |
jcater | f5c8c0b | 2018-03-27 07:22:35 -0700 | [diff] [blame] | 117 | compiler_files = ":empty", |
jcater | f5c8c0b | 2018-03-27 07:22:35 -0700 | [diff] [blame] | 118 | dwp_files = ":empty", |
jcater | f5c8c0b | 2018-03-27 07:22:35 -0700 | [diff] [blame] | 119 | linker_files = ":empty", |
| 120 | objcopy_files = ":empty", |
jcater | f5c8c0b | 2018-03-27 07:22:35 -0700 | [diff] [blame] | 121 | strip_files = ":empty", |
| 122 | supports_param_files = 0, |
hlopko | 1a25668 | 2019-10-24 07:01:01 -0700 | [diff] [blame] | 123 | toolchain_config = ":stub_armeabi-v7a", |
| 124 | toolchain_identifier = "stub_armeabi-v7a", |
jcater | f5c8c0b | 2018-03-27 07:22:35 -0700 | [diff] [blame] | 125 | ) |
| 126 | |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 127 | cc_toolchain_config( |
| 128 | name = "stub_armeabi-v7a", |
| 129 | cpu = "armeabi-v7a", |
rosica | 71bc38f | 2019-02-04 02:39:30 -0800 | [diff] [blame] | 130 | ) |
| 131 | |
jcater | f5c8c0b | 2018-03-27 07:22:35 -0700 | [diff] [blame] | 132 | toolchain( |
| 133 | name = "cc-toolchain-armeabi-v7a", |
| 134 | exec_compatible_with = [ |
hlopko | 71a213c | 2019-06-21 02:01:33 -0700 | [diff] [blame] | 135 | "@platforms//cpu:arm", |
jcater | f5c8c0b | 2018-03-27 07:22:35 -0700 | [diff] [blame] | 136 | ], |
| 137 | target_compatible_with = [ |
hlopko | 71a213c | 2019-06-21 02:01:33 -0700 | [diff] [blame] | 138 | "@platforms//cpu:arm", |
| 139 | "@platforms//os:android", |
jcater | f5c8c0b | 2018-03-27 07:22:35 -0700 | [diff] [blame] | 140 | ], |
| 141 | toolchain = ":cc-compiler-armeabi-v7a", |
| 142 | toolchain_type = "@bazel_tools//tools/cpp:toolchain_type", |
| 143 | ) |
| 144 | |
jcater | f5c8c0b | 2018-03-27 07:22:35 -0700 | [diff] [blame] | 145 | filegroup( |
| 146 | name = "link_dynamic_library", |
| 147 | srcs = ["link_dynamic_library.sh"], |
| 148 | ) |