• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
17import re
18import os
19import sys
20import yaml
21
22os.chdir(os.path.dirname(sys.argv[0]) + '/../..')
23
24out = {}
25
26try:
27
28    def gen_ares_build(x):
29        subprocess.call("third_party/cares/cares/buildconf", shell=True)
30        subprocess.call("third_party/cares/cares/configure", shell=True)
31
32    def config_platform(x):
33        if 'darwin' in sys.platform:
34            return 'src/cares/cares/config_darwin/ares_config.h'
35        if 'freebsd' in sys.platform:
36            return 'src/cares/cares/config_freebsd/ares_config.h'
37        if 'linux' in sys.platform:
38            return 'src/cares/cares/config_linux/ares_config.h'
39        if 'openbsd' in sys.platform:
40            return 'src/cares/cares/config_openbsd/ares_config.h'
41        if not os.path.isfile('third_party/cares/cares/ares_config.h'):
42            gen_ares_build(x)
43        return 'third_party/cares/cares/ares_config.h'
44
45    def ares_build(x):
46        if os.path.isfile('src/cares/cares/ares_build.h'):
47            return 'src/cares/cares/ares_build.h'
48        if not os.path.isfile('third_party/cares/cares/ares_build.h'):
49            gen_ares_build(x)
50        return 'third_party/cares/cares/ares_build.h'
51
52    out['libs'] = [{
53        'name':
54            'ares',
55        'defaults':
56            'ares',
57        'build':
58            'private',
59        'language':
60            'c',
61        'secure':
62            False,
63        'src': [
64            "third_party/cares/cares/ares__close_sockets.c",
65            "third_party/cares/cares/ares__get_hostent.c",
66            "third_party/cares/cares/ares__read_line.c",
67            "third_party/cares/cares/ares__timeval.c",
68            "third_party/cares/cares/ares_cancel.c",
69            "third_party/cares/cares/ares_create_query.c",
70            "third_party/cares/cares/ares_data.c",
71            "third_party/cares/cares/ares_destroy.c",
72            "third_party/cares/cares/ares_expand_name.c",
73            "third_party/cares/cares/ares_expand_string.c",
74            "third_party/cares/cares/ares_fds.c",
75            "third_party/cares/cares/ares_free_hostent.c",
76            "third_party/cares/cares/ares_free_string.c",
77            "third_party/cares/cares/ares_getenv.c",
78            "third_party/cares/cares/ares_gethostbyaddr.c",
79            "third_party/cares/cares/ares_gethostbyname.c",
80            "third_party/cares/cares/ares_getnameinfo.c",
81            "third_party/cares/cares/ares_getopt.c",
82            "third_party/cares/cares/ares_getsock.c",
83            "third_party/cares/cares/ares_init.c",
84            "third_party/cares/cares/ares_library_init.c",
85            "third_party/cares/cares/ares_llist.c",
86            "third_party/cares/cares/ares_mkquery.c",
87            "third_party/cares/cares/ares_nowarn.c",
88            "third_party/cares/cares/ares_options.c",
89            "third_party/cares/cares/ares_parse_a_reply.c",
90            "third_party/cares/cares/ares_parse_aaaa_reply.c",
91            "third_party/cares/cares/ares_parse_mx_reply.c",
92            "third_party/cares/cares/ares_parse_naptr_reply.c",
93            "third_party/cares/cares/ares_parse_ns_reply.c",
94            "third_party/cares/cares/ares_parse_ptr_reply.c",
95            "third_party/cares/cares/ares_parse_soa_reply.c",
96            "third_party/cares/cares/ares_parse_srv_reply.c",
97            "third_party/cares/cares/ares_parse_txt_reply.c",
98            "third_party/cares/cares/ares_platform.c",
99            "third_party/cares/cares/ares_process.c",
100            "third_party/cares/cares/ares_query.c",
101            "third_party/cares/cares/ares_search.c",
102            "third_party/cares/cares/ares_send.c",
103            "third_party/cares/cares/ares_strcasecmp.c",
104            "third_party/cares/cares/ares_strdup.c",
105            "third_party/cares/cares/ares_strerror.c",
106            "third_party/cares/cares/ares_strsplit.c",
107            "third_party/cares/cares/ares_timeout.c",
108            "third_party/cares/cares/ares_version.c",
109            "third_party/cares/cares/ares_writev.c",
110            "third_party/cares/cares/bitncmp.c",
111            "third_party/cares/cares/inet_net_pton.c",
112            "third_party/cares/cares/inet_ntop.c",
113            "third_party/cares/cares/windows_port.c",
114        ],
115        'headers': [
116            "third_party/cares/cares/ares.h",
117            "third_party/cares/cares/ares_data.h",
118            "third_party/cares/cares/ares_dns.h",
119            "third_party/cares/cares/ares_getenv.h",
120            "third_party/cares/cares/ares_getopt.h",
121            "third_party/cares/cares/ares_inet_net_pton.h",
122            "third_party/cares/cares/ares_iphlpapi.h",
123            "third_party/cares/cares/ares_ipv6.h",
124            "third_party/cares/cares/ares_library_init.h",
125            "third_party/cares/cares/ares_llist.h",
126            "third_party/cares/cares/ares_nowarn.h",
127            "third_party/cares/cares/ares_platform.h",
128            "third_party/cares/cares/ares_private.h",
129            "third_party/cares/cares/ares_rules.h",
130            "third_party/cares/cares/ares_setup.h",
131            "third_party/cares/cares/ares_strcasecmp.h",
132            "third_party/cares/cares/ares_strdup.h",
133            "third_party/cares/cares/ares_strsplit.h",
134            "third_party/cares/cares/ares_version.h",
135            "third_party/cares/cares/bitncmp.h",
136            "third_party/cares/cares/config-win32.h",
137            "third_party/cares/cares/setup_once.h",
138            "third_party/cares/ares_build.h",
139            "third_party/cares/config_darwin/ares_config.h",
140            "third_party/cares/config_freebsd/ares_config.h",
141            "third_party/cares/config_linux/ares_config.h",
142            "third_party/cares/config_openbsd/ares_config.h"
143        ],
144    }]
145except:
146    pass
147
148print(yaml.dump(out))
149