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