| 1 |
load("@bazel_skylib//rules:copy_file.bzl", "copy_file") |
| 2 |
|
| 3 |
config_setting( |
| 4 |
name = "darwin", |
| 5 |
values = {"cpu": "darwin"}, |
| 6 |
) |
| 7 |
|
| 8 |
config_setting( |
| 9 |
name = "darwin_x86_64", |
| 10 |
values = {"cpu": "darwin_x86_64"}, |
| 11 |
) |
| 12 |
|
| 13 |
config_setting( |
| 14 |
name = "darwin_arm64", |
| 15 |
values = {"cpu": "darwin_arm64"}, |
| 16 |
) |
| 17 |
|
| 18 |
config_setting( |
| 19 |
name = "darwin_arm64e", |
| 20 |
values = {"cpu": "darwin_arm64e"}, |
| 21 |
) |
| 22 |
|
| 23 |
config_setting( |
| 24 |
name = "windows", |
| 25 |
values = {"cpu": "x64_windows"}, |
| 26 |
) |
| 27 |
|
| 28 |
# Android is not officially supported through C++. |
| 29 |
# This just helps with the build for now. |
| 30 |
config_setting( |
| 31 |
name = "android", |
| 32 |
values = { |
| 33 |
"crosstool_top": "//external:android/crosstool", |
| 34 |
}, |
| 35 |
) |
| 36 |
|
| 37 |
# iOS is not officially supported through C++. |
| 38 |
# This just helps with the build for now. |
| 39 |
config_setting( |
| 40 |
name = "ios_x86_64", |
| 41 |
values = {"cpu": "ios_x86_64"}, |
| 42 |
) |
| 43 |
|
| 44 |
config_setting( |
| 45 |
name = "ios_armv7", |
| 46 |
values = {"cpu": "ios_armv7"}, |
| 47 |
) |
| 48 |
|
| 49 |
config_setting( |
| 50 |
name = "ios_armv7s", |
| 51 |
values = {"cpu": "ios_armv7s"}, |
| 52 |
) |
| 53 |
|
| 54 |
config_setting( |
| 55 |
name = "ios_arm64", |
| 56 |
values = {"cpu": "ios_arm64"}, |
| 57 |
) |
| 58 |
|
| 59 |
# The following architectures are found in |
| 60 |
# https://github.com/bazelbuild/bazel/blob/master/src/main/java/com/google/devtools/build/lib/rules/apple/ApplePlatform.java |
| 61 |
config_setting( |
| 62 |
name = "tvos_x86_64", |
| 63 |
values = {"cpu": "tvos_x86_64"}, |
| 64 |
) |
| 65 |
|
| 66 |
config_setting( |
| 67 |
name = "tvos_arm64", |
| 68 |
values = {"cpu": "tvos_arm64"} |
| 69 |
) |
| 70 |
|
| 71 |
config_setting( |
| 72 |
name = "watchos_i386", |
| 73 |
values = {"cpu": "watchos_i386"}, |
| 74 |
) |
| 75 |
|
| 76 |
config_setting( |
| 77 |
name = "watchos_x86_64", |
| 78 |
values = {"cpu": "watchos_x86_64"} |
| 79 |
) |
| 80 |
|
| 81 |
config_setting( |
| 82 |
name = "watchos_armv7k", |
| 83 |
values = {"cpu": "watchos_armv7k"}, |
| 84 |
) |
| 85 |
|
| 86 |
config_setting( |
| 87 |
name = "watchos_arm64_32", |
| 88 |
values = {"cpu": "watchos_arm64_32"} |
| 89 |
) |
| 90 |
|
| 91 |
config_setting( |
| 92 |
name = "openbsd", |
| 93 |
values = {"cpu": "openbsd"}, |
| 94 |
) |
| 95 |
|
| 96 |
copy_file( |
| 97 |
name = "ares_build_h", |
| 98 |
src = "@com_github_grpc_grpc//third_party/cares:ares_build.h", |
| 99 |
out = "ares_build.h", |
| 100 |
) |
| 101 |
|
| 102 |
copy_file( |
| 103 |
name = "ares_config_h", |
| 104 |
src = select({ |
| 105 |
":ios_x86_64": "@com_github_grpc_grpc//third_party/cares:config_darwin/ares_config.h", |
| 106 |
":ios_armv7": "@com_github_grpc_grpc//third_party/cares:config_darwin/ares_config.h", |
| 107 |
":ios_armv7s": "@com_github_grpc_grpc//third_party/cares:config_darwin/ares_config.h", |
| 108 |
":ios_arm64": "@com_github_grpc_grpc//third_party/cares:config_darwin/ares_config.h", |
| 109 |
":tvos_x86_64": "@com_github_grpc_grpc//third_party/cares:config_darwin/ares_config.h", |
| 110 |
":tvos_arm64": "@com_github_grpc_grpc//third_party/cares:config_darwin/ares_config.h", |
| 111 |
":watchos_i386": "@com_github_grpc_grpc//third_party/cares:config_darwin/ares_config.h", |
| 112 |
":watchos_x86_64": "@com_github_grpc_grpc//third_party/cares:config_darwin/ares_config.h", |
| 113 |
":watchos_armv7k": "@com_github_grpc_grpc//third_party/cares:config_darwin/ares_config.h", |
| 114 |
":watchos_arm64_32": "@com_github_grpc_grpc//third_party/cares:config_darwin/ares_config.h", |
| 115 |
":darwin": "@com_github_grpc_grpc//third_party/cares:config_darwin/ares_config.h", |
| 116 |
":darwin_x86_64": "@com_github_grpc_grpc//third_party/cares:config_darwin/ares_config.h", |
| 117 |
":darwin_arm64": "@com_github_grpc_grpc//third_party/cares:config_darwin/ares_config.h", |
| 118 |
":darwin_arm64e": "@com_github_grpc_grpc//third_party/cares:config_darwin/ares_config.h", |
| 119 |
":windows": "@com_github_grpc_grpc//third_party/cares:config_windows/ares_config.h", |
| 120 |
":android": "@com_github_grpc_grpc//third_party/cares:config_android/ares_config.h", |
| 121 |
":openbsd": "@com_github_grpc_grpc//third_party/cares:config_openbsd/ares_config.h", |
| 122 |
"//conditions:default": "@com_github_grpc_grpc//third_party/cares:config_linux/ares_config.h", |
| 123 |
}), |
| 124 |
out = "ares_config.h", |
| 125 |
) |
| 126 |
|
| 127 |
cc_library( |
| 128 |
name = "ares", |
| 129 |
srcs = [ |
| 130 |
"src/lib/ares_init.c", |
| 131 |
"src/lib/ares_expand_string.c", |
| 132 |
"src/lib/ares_strcasecmp.c", |
| 133 |
"src/lib/ares_destroy.c", |
| 134 |
"src/lib/ares_free_string.c", |
| 135 |
"src/lib/ares__timeval.c", |
| 136 |
"src/lib/ares_library_init.c", |
| 137 |
"src/lib/ares_getsock.c", |
| 138 |
"src/lib/ares_process.c", |
| 139 |
"src/lib/ares_create_query.c", |
| 140 |
"src/lib/ares_fds.c", |
| 141 |
"src/lib/ares_gethostbyname.c", |
| 142 |
"src/lib/ares_mkquery.c", |
| 143 |
"src/lib/ares_freeaddrinfo.c", |
| 144 |
"src/lib/ares_strdup.c", |
| 145 |
"src/lib/ares_timeout.c", |
| 146 |
"src/lib/ares_getnameinfo.c", |
| 147 |
"src/lib/ares_parse_soa_reply.c", |
| 148 |
"src/lib/ares_parse_naptr_reply.c", |
| 149 |
"src/lib/ares_parse_a_reply.c", |
| 150 |
"src/lib/ares_send.c", |
| 151 |
"src/lib/ares_nowarn.c", |
| 152 |
"src/lib/ares__sortaddrinfo.c", |
| 153 |
"src/lib/ares_android.c", |
| 154 |
"src/lib/ares_strerror.c", |
| 155 |
"src/lib/ares_parse_caa_reply.c", |
| 156 |
"src/lib/ares__close_sockets.c", |
| 157 |
"src/lib/ares_llist.c", |
| 158 |
"src/lib/ares_parse_aaaa_reply.c", |
| 159 |
"src/lib/ares_getaddrinfo.c", |
| 160 |
"src/lib/ares_parse_ns_reply.c", |
| 161 |
"src/lib/windows_port.c", |
| 162 |
"src/lib/bitncmp.c", |
| 163 |
"src/lib/ares_strsplit.c", |
| 164 |
"src/lib/ares_data.c", |
| 165 |
"src/lib/ares_free_hostent.c", |
| 166 |
"src/lib/ares_platform.c", |
| 167 |
"src/lib/ares_parse_txt_reply.c", |
| 168 |
"src/lib/ares__parse_into_addrinfo.c", |
| 169 |
"src/lib/ares_gethostbyaddr.c", |
| 170 |
"src/lib/ares_parse_srv_reply.c", |
| 171 |
"src/lib/ares_version.c", |
| 172 |
"src/lib/ares_getenv.c", |
| 173 |
"src/lib/ares_search.c", |
| 174 |
"src/lib/ares_parse_mx_reply.c", |
| 175 |
"src/lib/ares__get_hostent.c", |
| 176 |
"src/lib/ares__readaddrinfo.c", |
| 177 |
"src/lib/ares_parse_ptr_reply.c", |
| 178 |
"src/lib/ares__read_line.c", |
| 179 |
"src/lib/ares_query.c", |
| 180 |
"src/lib/ares_options.c", |
| 181 |
"src/lib/inet_net_pton.c", |
| 182 |
"src/lib/ares_expand_name.c", |
| 183 |
"src/lib/inet_ntop.c", |
| 184 |
"src/lib/ares_cancel.c", |
| 185 |
"src/lib/ares_writev.c", |
| 186 |
], |
| 187 |
hdrs = [ |
| 188 |
"ares_build.h", |
| 189 |
"ares_config.h", |
| 190 |
"include/ares_version.h", |
| 191 |
"include/ares.h", |
| 192 |
"include/ares_rules.h", |
| 193 |
"include/ares_dns.h", |
| 194 |
"src/lib/ares_data.h", |
| 195 |
"src/lib/ares_strsplit.h", |
| 196 |
"src/lib/bitncmp.h", |
| 197 |
"src/lib/ares_iphlpapi.h", |
| 198 |
"src/lib/ares_inet_net_pton.h", |
| 199 |
"src/lib/ares_getenv.h", |
| 200 |
"src/lib/ares_platform.h", |
| 201 |
"src/lib/ares_writev.h", |
| 202 |
"src/lib/ares_private.h", |
| 203 |
"src/lib/ares_setup.h", |
| 204 |
"src/lib/config-win32.h", |
| 205 |
"src/lib/ares_strcasecmp.h", |
| 206 |
"src/lib/setup_once.h", |
| 207 |
"src/lib/ares_ipv6.h", |
| 208 |
"src/lib/ares_library_init.h", |
| 209 |
"src/lib/ares_nameser.h", |
| 210 |
"src/lib/ares_strdup.h", |
| 211 |
"src/lib/config-dos.h", |
| 212 |
"src/lib/ares_llist.h", |
| 213 |
"src/lib/ares_nowarn.h", |
| 214 |
"src/lib/ares_android.h", |
| 215 |
], |
| 216 |
copts = [ |
| 217 |
"-D_GNU_SOURCE", |
| 218 |
"-D_HAS_EXCEPTIONS=0", |
| 219 |
"-DHAVE_CONFIG_H", |
| 220 |
] + select({ |
| 221 |
":windows": [ |
| 222 |
"-DNOMINMAX", |
| 223 |
"-D_CRT_SECURE_NO_DEPRECATE", |
| 224 |
"-D_CRT_NONSTDC_NO_DEPRECATE", |
| 225 |
"-D_WIN32_WINNT=0x0600", |
| 226 |
], |
| 227 |
"//conditions:default": [], |
| 228 |
}), |
| 229 |
defines = ["CARES_STATICLIB"], |
| 230 |
includes = ["include", "."], |
| 231 |
linkopts = select({ |
| 232 |
":windows": ["-defaultlib:ws2_32.lib"], |
| 233 |
"//conditions:default": [], |
| 234 |
}), |
| 235 |
linkstatic = 1, |
| 236 |
visibility = [ |
| 237 |
"//visibility:public", |
| 238 |
], |
| 239 |
alwayslink = 1, |
| 240 |
) |