Home | History | Annotate | Download | only in c-ares
      1 #!/usr/bin/env python2.7
      2 
      3 # Copyright 2015 gRPC authors.
      4 #
      5 # Licensed under the Apache License, Version 2.0 (the "License");
      6 # you may not use this file except in compliance with the License.
      7 # You may obtain a copy of the License at
      8 #
      9 #     http://www.apache.org/licenses/LICENSE-2.0
     10 #
     11 # Unless required by applicable law or agreed to in writing, software
     12 # distributed under the License is distributed on an "AS IS" BASIS,
     13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     14 # See the License for the specific language governing permissions and
     15 # limitations under the License.
     16 
     17 import re
     18 import os
     19 import sys
     20 import yaml
     21 
     22 os.chdir(os.path.dirname(sys.argv[0])+'/../..')
     23 
     24 out = {}
     25 
     26 try:
     27   def gen_ares_build(x):
     28     subprocess.call("third_party/cares/cares/buildconf", shell=True)
     29     subprocess.call("third_party/cares/cares/configure", shell=True)
     30 
     31   def config_platform(x):
     32     if 'darwin' in sys.platform:
     33       return 'src/cares/cares/config_darwin/ares_config.h'
     34     if 'freebsd' in sys.platform:
     35       return 'src/cares/cares/config_freebsd/ares_config.h'
     36     if 'linux' in sys.platform:
     37       return 'src/cares/cares/config_linux/ares_config.h'
     38     if 'openbsd' in sys.platform:
     39       return 'src/cares/cares/config_openbsd/ares_config.h'
     40     if not os.path.isfile('third_party/cares/cares/ares_config.h'):
     41       gen_ares_build(x)
     42     return 'third_party/cares/cares/ares_config.h'
     43 
     44   def ares_build(x):
     45     if os.path.isfile('src/cares/cares/ares_build.h'):
     46       return 'src/cares/cares/ares_build.h'
     47     if not os.path.isfile('third_party/cares/cares/ares_build.h'):
     48       gen_ares_build(x)
     49     return 'third_party/cares/cares/ares_build.h'
     50 
     51   out['libs'] = [{
     52       'name': 'ares',
     53       'defaults': 'ares',
     54       'build': 'private',
     55       'language': 'c',
     56       'secure': 'no',
     57       'src': [
     58         "third_party/cares/cares/ares__close_sockets.c",
     59         "third_party/cares/cares/ares__get_hostent.c",
     60         "third_party/cares/cares/ares__read_line.c",
     61         "third_party/cares/cares/ares__timeval.c",
     62         "third_party/cares/cares/ares_cancel.c",
     63         "third_party/cares/cares/ares_create_query.c",
     64         "third_party/cares/cares/ares_data.c",
     65         "third_party/cares/cares/ares_destroy.c",
     66         "third_party/cares/cares/ares_expand_name.c",
     67         "third_party/cares/cares/ares_expand_string.c",
     68         "third_party/cares/cares/ares_fds.c",
     69         "third_party/cares/cares/ares_free_hostent.c",
     70         "third_party/cares/cares/ares_free_string.c",
     71         "third_party/cares/cares/ares_getenv.c",
     72         "third_party/cares/cares/ares_gethostbyaddr.c",
     73         "third_party/cares/cares/ares_gethostbyname.c",
     74         "third_party/cares/cares/ares_getnameinfo.c",
     75         "third_party/cares/cares/ares_getopt.c",
     76         "third_party/cares/cares/ares_getsock.c",
     77         "third_party/cares/cares/ares_init.c",
     78         "third_party/cares/cares/ares_library_init.c",
     79         "third_party/cares/cares/ares_llist.c",
     80         "third_party/cares/cares/ares_mkquery.c",
     81         "third_party/cares/cares/ares_nowarn.c",
     82         "third_party/cares/cares/ares_options.c",
     83         "third_party/cares/cares/ares_parse_a_reply.c",
     84         "third_party/cares/cares/ares_parse_aaaa_reply.c",
     85         "third_party/cares/cares/ares_parse_mx_reply.c",
     86         "third_party/cares/cares/ares_parse_naptr_reply.c",
     87         "third_party/cares/cares/ares_parse_ns_reply.c",
     88         "third_party/cares/cares/ares_parse_ptr_reply.c",
     89         "third_party/cares/cares/ares_parse_soa_reply.c",
     90         "third_party/cares/cares/ares_parse_srv_reply.c",
     91         "third_party/cares/cares/ares_parse_txt_reply.c",
     92         "third_party/cares/cares/ares_platform.c",
     93         "third_party/cares/cares/ares_process.c",
     94         "third_party/cares/cares/ares_query.c",
     95         "third_party/cares/cares/ares_search.c",
     96         "third_party/cares/cares/ares_send.c",
     97         "third_party/cares/cares/ares_strcasecmp.c",
     98         "third_party/cares/cares/ares_strdup.c",
     99         "third_party/cares/cares/ares_strerror.c",
    100         "third_party/cares/cares/ares_timeout.c",
    101         "third_party/cares/cares/ares_version.c",
    102         "third_party/cares/cares/ares_writev.c",
    103         "third_party/cares/cares/bitncmp.c",
    104         "third_party/cares/cares/inet_net_pton.c",
    105         "third_party/cares/cares/inet_ntop.c",
    106         "third_party/cares/cares/windows_port.c",
    107       ],
    108       'headers': [
    109         "third_party/cares/cares/ares.h",
    110         "third_party/cares/cares/ares_data.h",
    111         "third_party/cares/cares/ares_dns.h",
    112         "third_party/cares/cares/ares_getenv.h",
    113         "third_party/cares/cares/ares_getopt.h",
    114         "third_party/cares/cares/ares_inet_net_pton.h",
    115         "third_party/cares/cares/ares_iphlpapi.h",
    116         "third_party/cares/cares/ares_ipv6.h",
    117         "third_party/cares/cares/ares_library_init.h",
    118         "third_party/cares/cares/ares_llist.h",
    119         "third_party/cares/cares/ares_nowarn.h",
    120         "third_party/cares/cares/ares_platform.h",
    121         "third_party/cares/cares/ares_private.h",
    122         "third_party/cares/cares/ares_rules.h",
    123         "third_party/cares/cares/ares_setup.h",
    124         "third_party/cares/cares/ares_strcasecmp.h",
    125         "third_party/cares/cares/ares_strdup.h",
    126         "third_party/cares/cares/ares_version.h",
    127         "third_party/cares/cares/bitncmp.h",
    128         "third_party/cares/cares/config-win32.h",
    129         "third_party/cares/cares/setup_once.h",
    130         "third_party/cares/ares_build.h",
    131         "third_party/cares/config_darwin/ares_config.h",
    132         "third_party/cares/config_freebsd/ares_config.h",
    133         "third_party/cares/config_linux/ares_config.h",
    134         "third_party/cares/config_openbsd/ares_config.h"
    135     ],
    136   }]
    137 except:
    138   pass
    139 
    140 print yaml.dump(out)
    141