1load("@bazel_skylib//rules:copy_file.bzl", "copy_file") 2 3config_setting( 4 name = "darwin", 5 values = {"cpu": "darwin"}, 6) 7 8config_setting( 9 name = "darwin_x86_64", 10 values = {"cpu": "darwin_x86_64"}, 11) 12 13config_setting( 14 name = "darwin_arm64", 15 values = {"cpu": "darwin_arm64"}, 16) 17 18config_setting( 19 name = "darwin_arm64e", 20 values = {"cpu": "darwin_arm64e"}, 21) 22 23config_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. 30config_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. 39config_setting( 40 name = "ios_x86_64", 41 values = {"cpu": "ios_x86_64"}, 42) 43 44config_setting( 45 name = "ios_armv7", 46 values = {"cpu": "ios_armv7"}, 47) 48 49config_setting( 50 name = "ios_armv7s", 51 values = {"cpu": "ios_armv7s"}, 52) 53 54config_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 61config_setting( 62 name = "tvos_x86_64", 63 values = {"cpu": "tvos_x86_64"}, 64) 65 66config_setting( 67 name = "tvos_arm64", 68 values = {"cpu": "tvos_arm64"} 69) 70 71config_setting( 72 name = "watchos_i386", 73 values = {"cpu": "watchos_i386"}, 74) 75 76config_setting( 77 name = "watchos_x86_64", 78 values = {"cpu": "watchos_x86_64"} 79) 80 81config_setting( 82 name = "watchos_armv7k", 83 values = {"cpu": "watchos_armv7k"}, 84) 85 86config_setting( 87 name = "watchos_arm64_32", 88 values = {"cpu": "watchos_arm64_32"} 89) 90 91copy_file( 92 name = "ares_build_h", 93 src = "@com_github_grpc_grpc//third_party/cares:ares_build.h", 94 out = "ares_build.h", 95) 96 97copy_file( 98 name = "ares_config_h", 99 src = select({ 100 ":ios_x86_64": "@com_github_grpc_grpc//third_party/cares:config_darwin/ares_config.h", 101 ":ios_armv7": "@com_github_grpc_grpc//third_party/cares:config_darwin/ares_config.h", 102 ":ios_armv7s": "@com_github_grpc_grpc//third_party/cares:config_darwin/ares_config.h", 103 ":ios_arm64": "@com_github_grpc_grpc//third_party/cares:config_darwin/ares_config.h", 104 ":tvos_x86_64": "@com_github_grpc_grpc//third_party/cares:config_darwin/ares_config.h", 105 ":tvos_arm64": "@com_github_grpc_grpc//third_party/cares:config_darwin/ares_config.h", 106 ":watchos_i386": "@com_github_grpc_grpc//third_party/cares:config_darwin/ares_config.h", 107 ":watchos_x86_64": "@com_github_grpc_grpc//third_party/cares:config_darwin/ares_config.h", 108 ":watchos_armv7k": "@com_github_grpc_grpc//third_party/cares:config_darwin/ares_config.h", 109 ":watchos_arm64_32": "@com_github_grpc_grpc//third_party/cares:config_darwin/ares_config.h", 110 ":darwin": "@com_github_grpc_grpc//third_party/cares:config_darwin/ares_config.h", 111 ":darwin_x86_64": "@com_github_grpc_grpc//third_party/cares:config_darwin/ares_config.h", 112 ":darwin_arm64": "@com_github_grpc_grpc//third_party/cares:config_darwin/ares_config.h", 113 ":darwin_arm64e": "@com_github_grpc_grpc//third_party/cares:config_darwin/ares_config.h", 114 ":windows": "@com_github_grpc_grpc//third_party/cares:config_windows/ares_config.h", 115 ":android": "@com_github_grpc_grpc//third_party/cares:config_android/ares_config.h", 116 "//conditions:default": "@com_github_grpc_grpc//third_party/cares:config_linux/ares_config.h", 117 }), 118 out = "ares_config.h", 119) 120 121cc_library( 122 name = "ares", 123 srcs = [ 124 "ares__close_sockets.c", 125 "ares__get_hostent.c", 126 "ares__read_line.c", 127 "ares__timeval.c", 128 "ares_android.c", 129 "ares_cancel.c", 130 "ares_create_query.c", 131 "ares_data.c", 132 "ares_destroy.c", 133 "ares_expand_name.c", 134 "ares_expand_string.c", 135 "ares_fds.c", 136 "ares_free_hostent.c", 137 "ares_free_string.c", 138 "ares_getenv.c", 139 "ares_gethostbyaddr.c", 140 "ares_gethostbyname.c", 141 "ares_getnameinfo.c", 142 "ares_getopt.c", 143 "ares_getsock.c", 144 "ares_init.c", 145 "ares_library_init.c", 146 "ares_llist.c", 147 "ares_mkquery.c", 148 "ares_nowarn.c", 149 "ares_options.c", 150 "ares_parse_a_reply.c", 151 "ares_parse_aaaa_reply.c", 152 "ares_parse_mx_reply.c", 153 "ares_parse_naptr_reply.c", 154 "ares_parse_ns_reply.c", 155 "ares_parse_ptr_reply.c", 156 "ares_parse_soa_reply.c", 157 "ares_parse_srv_reply.c", 158 "ares_parse_txt_reply.c", 159 "ares_platform.c", 160 "ares_process.c", 161 "ares_query.c", 162 "ares_search.c", 163 "ares_send.c", 164 "ares_strcasecmp.c", 165 "ares_strdup.c", 166 "ares_strsplit.c", 167 "ares_strerror.c", 168 "ares_timeout.c", 169 "ares_version.c", 170 "ares_writev.c", 171 "bitncmp.c", 172 "inet_net_pton.c", 173 "inet_ntop.c", 174 "windows_port.c", 175 ], 176 hdrs = [ 177 "ares.h", 178 "ares_android.h", 179 "ares_build.h", 180 "ares_config.h", 181 "ares_data.h", 182 "ares_dns.h", 183 "ares_getenv.h", 184 "ares_getopt.h", 185 "ares_inet_net_pton.h", 186 "ares_iphlpapi.h", 187 "ares_ipv6.h", 188 "ares_library_init.h", 189 "ares_llist.h", 190 "ares_nowarn.h", 191 "ares_platform.h", 192 "ares_private.h", 193 "ares_rules.h", 194 "ares_setup.h", 195 "ares_strcasecmp.h", 196 "ares_strdup.h", 197 "ares_strsplit.h", 198 "ares_version.h", 199 "ares_writev.h", 200 "bitncmp.h", 201 "config-win32.h", 202 "nameser.h", 203 "setup_once.h", 204 ], 205 copts = [ 206 "-D_GNU_SOURCE", 207 "-D_HAS_EXCEPTIONS=0", 208 "-DHAVE_CONFIG_H", 209 ] + select({ 210 ":windows": [ 211 "-DNOMINMAX", 212 "-D_CRT_SECURE_NO_DEPRECATE", 213 "-D_CRT_NONSTDC_NO_DEPRECATE", 214 "-D_WIN32_WINNT=0x0600", 215 ], 216 "//conditions:default": [], 217 }), 218 defines = ["CARES_STATICLIB"], 219 includes = ["."], 220 linkopts = select({ 221 ":windows": ["-defaultlib:ws2_32.lib"], 222 "//conditions:default": [], 223 }), 224 linkstatic = 1, 225 visibility = [ 226 "//visibility:public", 227 ], 228 alwayslink = 1, 229) 230