cares.BUILD 5.9 KB

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