blob: 4600d8d2241fe0066d6abe7c1cc129dd22873978 [file] [log] [blame]
Yuchen Zengd790dd62016-08-11 17:32:50 -07001#!/usr/bin/env python2.7
2
Jan Tattermusch7897ae92017-06-07 22:57:36 +02003# Copyright 2015 gRPC authors.
Yuchen Zengd790dd62016-08-11 17:32:50 -07004#
Jan Tattermusch7897ae92017-06-07 22:57:36 +02005# 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
Yuchen Zengd790dd62016-08-11 17:32:50 -07008#
Jan Tattermusch7897ae92017-06-07 22:57:36 +02009# http://www.apache.org/licenses/LICENSE-2.0
Yuchen Zengd790dd62016-08-11 17:32:50 -070010#
Jan Tattermusch7897ae92017-06-07 22:57:36 +020011# 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.
Yuchen Zengd790dd62016-08-11 17:32:50 -070016
17import re
18import os
19import sys
20import yaml
21
22os.chdir(os.path.dirname(sys.argv[0])+'/../..')
23
24out = {}
25
26try:
27 def gen_ares_build(x):
Yuchen Zeng6694bb02017-01-23 17:09:51 -080028 subprocess.call("third_party/cares/cares/buildconf", shell=True)
29 subprocess.call("third_party/cares/cares/configure", shell=True)
Yuchen Zengd790dd62016-08-11 17:32:50 -070030
31 def config_platform(x):
Yuchen Zengd790dd62016-08-11 17:32:50 -070032 if 'darwin' in sys.platform:
Yuchen Zeng6694bb02017-01-23 17:09:51 -080033 return 'src/cares/cares/config_darwin/ares_config.h'
Mehrdad Afshari451c02b2017-10-12 10:28:14 -070034 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'
Frank Groeneveldfbf81282017-10-12 08:27:14 +020038 if 'openbsd' in sys.platform:
39 return 'src/cares/cares/config_openbsd/ares_config.h'
Yuchen Zeng6694bb02017-01-23 17:09:51 -080040 if not os.path.isfile('third_party/cares/cares/ares_config.h'):
Yuchen Zengd790dd62016-08-11 17:32:50 -070041 gen_ares_build(x)
Yuchen Zeng6694bb02017-01-23 17:09:51 -080042 return 'third_party/cares/cares/ares_config.h'
Yuchen Zengd790dd62016-08-11 17:32:50 -070043
44 def ares_build(x):
Yuchen Zeng6694bb02017-01-23 17:09:51 -080045 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'):
Yuchen Zengd790dd62016-08-11 17:32:50 -070048 gen_ares_build(x)
Yuchen Zeng6694bb02017-01-23 17:09:51 -080049 return 'third_party/cares/cares/ares_build.h'
Yuchen Zengd790dd62016-08-11 17:32:50 -070050
Yuchen Zengd790dd62016-08-11 17:32:50 -070051 out['libs'] = [{
52 'name': 'ares',
Yuchen Zengf64bf282016-08-11 21:21:32 -070053 'defaults': 'ares',
Yuchen Zengd790dd62016-08-11 17:32:50 -070054 'build': 'private',
55 'language': 'c',
56 'secure': 'no',
57 'src': [
Yuchen Zeng6694bb02017-01-23 17:09:51 -080058 "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",
Yuchen Zengd790dd62016-08-11 17:32:50 -0700107 ],
108 'headers': [
Yuchen Zeng6694bb02017-01-23 17:09:51 -0800109 "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",
Frank Groeneveldfbf81282017-10-12 08:27:14 +0200131 "third_party/cares/config_darwin/ares_config.h",
Mehrdad Afshari451c02b2017-10-12 10:28:14 -0700132 "third_party/cares/config_freebsd/ares_config.h",
133 "third_party/cares/config_linux/ares_config.h",
Frank Groeneveldfbf81282017-10-12 08:27:14 +0200134 "third_party/cares/config_openbsd/ares_config.h"
Yuchen Zengd790dd62016-08-11 17:32:50 -0700135 ],
136 }]
137except:
138 pass
139
140print yaml.dump(out)