Yuchen Zeng | d790dd6 | 2016-08-11 17:32:50 -0700 | [diff] [blame] | 1 | #!/usr/bin/env python2.7 |
| 2 | |
Jan Tattermusch | 7897ae9 | 2017-06-07 22:57:36 +0200 | [diff] [blame] | 3 | # Copyright 2015 gRPC authors. |
Yuchen Zeng | d790dd6 | 2016-08-11 17:32:50 -0700 | [diff] [blame] | 4 | # |
Jan Tattermusch | 7897ae9 | 2017-06-07 22:57:36 +0200 | [diff] [blame] | 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 |
Yuchen Zeng | d790dd6 | 2016-08-11 17:32:50 -0700 | [diff] [blame] | 8 | # |
Jan Tattermusch | 7897ae9 | 2017-06-07 22:57:36 +0200 | [diff] [blame] | 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
Yuchen Zeng | d790dd6 | 2016-08-11 17:32:50 -0700 | [diff] [blame] | 10 | # |
Jan Tattermusch | 7897ae9 | 2017-06-07 22:57:36 +0200 | [diff] [blame] | 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. |
Yuchen Zeng | d790dd6 | 2016-08-11 17:32:50 -0700 | [diff] [blame] | 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): |
Yuchen Zeng | 6694bb0 | 2017-01-23 17:09:51 -0800 | [diff] [blame] | 28 | subprocess.call("third_party/cares/cares/buildconf", shell=True) |
| 29 | subprocess.call("third_party/cares/cares/configure", shell=True) |
Yuchen Zeng | d790dd6 | 2016-08-11 17:32:50 -0700 | [diff] [blame] | 30 | |
| 31 | def config_platform(x): |
Yuchen Zeng | d790dd6 | 2016-08-11 17:32:50 -0700 | [diff] [blame] | 32 | if 'darwin' in sys.platform: |
Yuchen Zeng | 6694bb0 | 2017-01-23 17:09:51 -0800 | [diff] [blame] | 33 | return 'src/cares/cares/config_darwin/ares_config.h' |
Mehrdad Afshari | 451c02b | 2017-10-12 10:28:14 -0700 | [diff] [blame] | 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' |
Frank Groeneveld | fbf8128 | 2017-10-12 08:27:14 +0200 | [diff] [blame] | 38 | if 'openbsd' in sys.platform: |
| 39 | return 'src/cares/cares/config_openbsd/ares_config.h' |
Yuchen Zeng | 6694bb0 | 2017-01-23 17:09:51 -0800 | [diff] [blame] | 40 | if not os.path.isfile('third_party/cares/cares/ares_config.h'): |
Yuchen Zeng | d790dd6 | 2016-08-11 17:32:50 -0700 | [diff] [blame] | 41 | gen_ares_build(x) |
Yuchen Zeng | 6694bb0 | 2017-01-23 17:09:51 -0800 | [diff] [blame] | 42 | return 'third_party/cares/cares/ares_config.h' |
Yuchen Zeng | d790dd6 | 2016-08-11 17:32:50 -0700 | [diff] [blame] | 43 | |
| 44 | def ares_build(x): |
Yuchen Zeng | 6694bb0 | 2017-01-23 17:09:51 -0800 | [diff] [blame] | 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'): |
Yuchen Zeng | d790dd6 | 2016-08-11 17:32:50 -0700 | [diff] [blame] | 48 | gen_ares_build(x) |
Yuchen Zeng | 6694bb0 | 2017-01-23 17:09:51 -0800 | [diff] [blame] | 49 | return 'third_party/cares/cares/ares_build.h' |
Yuchen Zeng | d790dd6 | 2016-08-11 17:32:50 -0700 | [diff] [blame] | 50 | |
Yuchen Zeng | d790dd6 | 2016-08-11 17:32:50 -0700 | [diff] [blame] | 51 | out['libs'] = [{ |
| 52 | 'name': 'ares', |
Yuchen Zeng | f64bf28 | 2016-08-11 21:21:32 -0700 | [diff] [blame] | 53 | 'defaults': 'ares', |
Yuchen Zeng | d790dd6 | 2016-08-11 17:32:50 -0700 | [diff] [blame] | 54 | 'build': 'private', |
| 55 | 'language': 'c', |
| 56 | 'secure': 'no', |
| 57 | 'src': [ |
Yuchen Zeng | 6694bb0 | 2017-01-23 17:09:51 -0800 | [diff] [blame] | 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", |
Yuchen Zeng | d790dd6 | 2016-08-11 17:32:50 -0700 | [diff] [blame] | 107 | ], |
| 108 | 'headers': [ |
Yuchen Zeng | 6694bb0 | 2017-01-23 17:09:51 -0800 | [diff] [blame] | 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", |
Frank Groeneveld | fbf8128 | 2017-10-12 08:27:14 +0200 | [diff] [blame] | 131 | "third_party/cares/config_darwin/ares_config.h", |
Mehrdad Afshari | 451c02b | 2017-10-12 10:28:14 -0700 | [diff] [blame] | 132 | "third_party/cares/config_freebsd/ares_config.h", |
| 133 | "third_party/cares/config_linux/ares_config.h", |
Frank Groeneveld | fbf8128 | 2017-10-12 08:27:14 +0200 | [diff] [blame] | 134 | "third_party/cares/config_openbsd/ares_config.h" |
Yuchen Zeng | d790dd6 | 2016-08-11 17:32:50 -0700 | [diff] [blame] | 135 | ], |
| 136 | }] |
| 137 | except: |
| 138 | pass |
| 139 | |
| 140 | print yaml.dump(out) |