Debian Codegraph @

src/c-ares/gen_build_yaml.py

raw
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
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/include/ares_build.h'):
49 gen_ares_build(x)
50 return 'third_party/cares/cares/include/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/src/lib/ares_init.c",
65 "third_party/cares/cares/src/lib/ares_expand_string.c",
66 "third_party/cares/cares/src/lib/ares_strcasecmp.c",
67 "third_party/cares/cares/src/lib/ares_destroy.c",
68 "third_party/cares/cares/src/lib/ares_free_string.c",
69 "third_party/cares/cares/src/lib/ares__timeval.c",
70 "third_party/cares/cares/src/lib/ares_library_init.c",
71 "third_party/cares/cares/src/lib/ares_getsock.c",
72 "third_party/cares/cares/src/lib/ares_process.c",
73 "third_party/cares/cares/src/lib/ares_create_query.c",
74 "third_party/cares/cares/src/lib/ares_fds.c",
75 "third_party/cares/cares/src/lib/ares_gethostbyname.c",
76 "third_party/cares/cares/src/lib/ares_mkquery.c",
77 "third_party/cares/cares/src/lib/ares_freeaddrinfo.c",
78 "third_party/cares/cares/src/lib/ares_strdup.c",
79 "third_party/cares/cares/src/lib/ares_timeout.c",
80 "third_party/cares/cares/src/lib/ares_getnameinfo.c",
81 "third_party/cares/cares/src/lib/ares_parse_soa_reply.c",
82 "third_party/cares/cares/src/lib/ares_parse_naptr_reply.c",
83 "third_party/cares/cares/src/lib/ares_parse_a_reply.c",
84 "third_party/cares/cares/src/lib/ares_send.c",
85 "third_party/cares/cares/src/lib/ares_nowarn.c",
86 "third_party/cares/cares/src/lib/ares__sortaddrinfo.c",
87 "third_party/cares/cares/src/lib/ares_android.c",
88 "third_party/cares/cares/src/lib/ares_strerror.c",
89 "third_party/cares/cares/src/lib/ares_parse_caa_reply.c",
90 "third_party/cares/cares/src/lib/ares__close_sockets.c",
91 "third_party/cares/cares/src/lib/ares_llist.c",
92 "third_party/cares/cares/src/lib/ares_parse_aaaa_reply.c",
93 "third_party/cares/cares/src/lib/ares_getaddrinfo.c",
94 "third_party/cares/cares/src/lib/ares_parse_ns_reply.c",
95 "third_party/cares/cares/src/lib/windows_port.c",
96 "third_party/cares/cares/src/lib/bitncmp.c",
97 "third_party/cares/cares/src/lib/ares_strsplit.c",
98 "third_party/cares/cares/src/lib/ares_data.c",
99 "third_party/cares/cares/src/lib/ares_free_hostent.c",
100 "third_party/cares/cares/src/lib/ares_platform.c",
101 "third_party/cares/cares/src/lib/ares_parse_txt_reply.c",
102 "third_party/cares/cares/src/lib/ares__parse_into_addrinfo.c",
103 "third_party/cares/cares/src/lib/ares_gethostbyaddr.c",
104 "third_party/cares/cares/src/lib/ares_parse_srv_reply.c",
105 "third_party/cares/cares/src/lib/ares_version.c",
106 "third_party/cares/cares/src/lib/ares_getenv.c",
107 "third_party/cares/cares/src/lib/ares_search.c",
108 "third_party/cares/cares/src/lib/ares_parse_mx_reply.c",
109 "third_party/cares/cares/src/lib/ares__get_hostent.c",
110 "third_party/cares/cares/src/lib/ares__readaddrinfo.c",
111 "third_party/cares/cares/src/lib/ares_parse_ptr_reply.c",
112 "third_party/cares/cares/src/lib/ares__read_line.c",
113 "third_party/cares/cares/src/lib/ares_query.c",
114 "third_party/cares/cares/src/lib/ares_options.c",
115 "third_party/cares/cares/src/lib/inet_net_pton.c",
116 "third_party/cares/cares/src/lib/ares_expand_name.c",
117 "third_party/cares/cares/src/lib/inet_ntop.c",
118 "third_party/cares/cares/src/lib/ares_cancel.c",
119 "third_party/cares/cares/src/lib/ares_writev.c",
120 ],
121 'headers': [
122 "third_party/cares/ares_build.h",
123 "third_party/cares/cares/include/ares_version.h",
124 "third_party/cares/cares/include/ares.h",
125 "third_party/cares/cares/include/ares_rules.h",
126 "third_party/cares/cares/include/ares_dns.h",
127 "third_party/cares/cares/src/lib/ares_data.h",
128 "third_party/cares/cares/src/lib/ares_strsplit.h",
129 "third_party/cares/cares/src/lib/bitncmp.h",
130 "third_party/cares/cares/src/lib/ares_iphlpapi.h",
131 "third_party/cares/cares/src/lib/ares_inet_net_pton.h",
132 "third_party/cares/cares/src/lib/ares_getenv.h",
133 "third_party/cares/cares/src/lib/ares_platform.h",
134 "third_party/cares/cares/src/lib/ares_writev.h",
135 "third_party/cares/cares/src/lib/ares_private.h",
136 "third_party/cares/cares/src/lib/ares_setup.h",
137 "third_party/cares/cares/src/lib/config-win32.h",
138 "third_party/cares/cares/src/lib/ares_strcasecmp.h",
139 "third_party/cares/cares/src/lib/setup_once.h",
140 "third_party/cares/cares/src/lib/ares_ipv6.h",
141 "third_party/cares/cares/src/lib/ares_library_init.h",
142 "third_party/cares/cares/src/lib/ares_nameser.h",
143 "third_party/cares/cares/src/lib/ares_strdup.h",
144 "third_party/cares/cares/src/lib/config-dos.h",
145 "third_party/cares/cares/src/lib/ares_llist.h",
146 "third_party/cares/cares/src/lib/ares_nowarn.h",
147 "third_party/cares/cares/src/lib/ares_android.h",
148 "third_party/cares/config_darwin/ares_config.h",
149 "third_party/cares/config_freebsd/ares_config.h",
150 "third_party/cares/config_linux/ares_config.h",
151 "third_party/cares/config_openbsd/ares_config.h"
152 ],
153 }]
154 except:
155 pass
156
157 print(yaml.dump(out))