• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1{
2  'target_defaults': {
3    'conditions': [
4      ['OS!="win"', {
5        'defines': [
6          '_DARWIN_USE_64_BIT_INODE=1',
7          '_LARGEFILE_SOURCE',
8          '_FILE_OFFSET_BITS=64',
9          '_GNU_SOURCE'
10        ]
11      }],
12      [ 'OS=="aix"', {
13        'include_dirs': [ 'config/aix' ],
14        'sources': [ 'config/aix/ares_config.h' ],
15        'defines': [
16          # Support for malloc(0)
17          '_LINUX_SOURCE_COMPAT=1',
18          '_ALL_SOURCE=1'],
19      }],
20      ['OS=="solaris"', {
21        'defines': [
22          '__EXTENSIONS__',
23          '_XOPEN_SOURCE=500'
24        ]
25      }]
26    ]
27  },
28
29  'targets': [
30    {
31      'target_name': 'cares',
32      'type': '<(library)',
33      'include_dirs': [ 'include' ],
34      'direct_dependent_settings': {
35        'include_dirs': [ 'include' ]
36      },
37      'sources': [
38        'include/ares.h',
39        'include/ares_dns.h',
40        'include/ares_nameser.h',
41        'include/ares_rules.h',
42        'include/ares_version.h',
43        'src/lib/ares__addrinfo2hostent.c',
44        'src/lib/ares__addrinfo_localhost.c',
45        'src/lib/ares_android.c',
46        'src/lib/ares_cancel.c',
47        'src/lib/ares__close_sockets.c',
48        'src/lib/ares_create_query.c',
49        'src/lib/ares_data.c',
50        'src/lib/ares_data.h',
51        'src/lib/ares_destroy.c',
52        'src/lib/ares_expand_name.c',
53        'src/lib/ares_expand_string.c',
54        'src/lib/ares_fds.c',
55        'src/lib/ares_free_hostent.c',
56        'src/lib/ares_free_string.c',
57        'src/lib/ares_freeaddrinfo.c',
58        'src/lib/ares_getenv.h',
59        'src/lib/ares_getaddrinfo.c',
60        'src/lib/ares_gethostbyaddr.c',
61        'src/lib/ares_gethostbyname.c',
62        'src/lib/ares__get_hostent.c',
63        'src/lib/ares_getnameinfo.c',
64        'src/lib/ares_getsock.c',
65        'src/lib/ares_init.c',
66        'src/lib/ares_ipv6.h',
67        'src/lib/ares_library_init.c',
68        'src/lib/ares_library_init.h',
69        'src/lib/ares_llist.c',
70        'src/lib/ares_llist.h',
71        'src/lib/ares_mkquery.c',
72        'src/lib/ares_nowarn.c',
73        'src/lib/ares_nowarn.h',
74        'src/lib/ares_options.c',
75        'src/lib/ares__parse_into_addrinfo.c',
76        'src/lib/ares_parse_aaaa_reply.c',
77        'src/lib/ares_parse_a_reply.c',
78        'src/lib/ares_parse_caa_reply.c',
79        'src/lib/ares_parse_mx_reply.c',
80        'src/lib/ares_parse_naptr_reply.c',
81        'src/lib/ares_parse_ns_reply.c',
82        'src/lib/ares_parse_ptr_reply.c',
83        'src/lib/ares_parse_soa_reply.c',
84        'src/lib/ares_parse_srv_reply.c',
85        'src/lib/ares_parse_txt_reply.c',
86        'src/lib/ares_parse_uri_reply.c',
87        'src/lib/ares_platform.h',
88        'src/lib/ares_private.h',
89        'src/lib/ares_process.c',
90        'src/lib/ares_query.c',
91        'src/lib/ares__read_line.c',
92        'src/lib/ares__readaddrinfo.c',
93        'src/lib/ares_search.c',
94        'src/lib/ares_send.c',
95        'src/lib/ares_setup.h',
96        'src/lib/ares__sortaddrinfo.c',
97        'src/lib/ares_strcasecmp.c',
98        'src/lib/ares_strcasecmp.h',
99        'src/lib/ares_strdup.c',
100        'src/lib/ares_strdup.h',
101        'src/lib/ares_strerror.c',
102        'src/lib/ares_strsplit.c',
103        'src/lib/ares_timeout.c',
104        'src/lib/ares__timeval.c',
105        'src/lib/ares_version.c',
106        'src/lib/ares_writev.c',
107        'src/lib/ares_writev.h',
108        'src/lib/bitncmp.c',
109        'src/lib/bitncmp.h',
110        'src/lib/inet_net_pton.c',
111        'src/lib/inet_ntop.c',
112        'src/lib/ares_inet_net_pton.h',
113        'src/lib/setup_once.h',
114        'src/tools/ares_getopt.c',
115        'src/tools/ares_getopt.h',
116      ],
117      'conditions': [
118        [ 'library=="static_library"', {
119          'defines': [ 'CARES_STATICLIB' ]
120        }, {
121          'defines': [ 'CARES_BUILDING_LIBRARY' ]
122        }],
123        [ 'OS=="win"', {
124          'defines': [
125            'CARES_PULL_WS2TCPIP_H=1',
126            '_WINSOCK_DEPRECATED_NO_WARNINGS',
127          ],
128          'include_dirs': [ 'config/win32' ],
129          'sources': [
130            'src/lib/config-win32.h',
131            'src/lib/windows_port.c',
132            'src/lib/ares_getenv.c',
133            'src/lib/ares_iphlpapi.h',
134            'src/lib/ares_platform.c'
135          ],
136          'libraries': [
137            '-lws2_32.lib',
138            '-liphlpapi.lib'
139          ],
140        }, {
141          # Not Windows i.e. POSIX
142          'cflags': [
143            '-g',
144            '-pedantic',
145            '-Wall',
146            '-Wextra',
147            '-Wno-unused-parameter'
148          ],
149          'defines': [ 'HAVE_CONFIG_H' ],
150        }],
151        [ 'OS not in "win android"', {
152          'cflags': [
153            '--std=gnu89'
154          ],
155        }],
156        [ 'OS=="linux"', {
157          'include_dirs': [ 'config/linux' ],
158          'sources': [ 'config/linux/ares_config.h' ]
159        }],
160        [ 'OS=="mac"', {
161          'include_dirs': [ 'config/darwin' ],
162          'sources': [ 'config/darwin/ares_config.h' ]
163        }],
164        [ 'OS=="freebsd" or OS=="dragonflybsd"', {
165          'include_dirs': [ 'config/freebsd' ],
166          'sources': [ 'config/freebsd/ares_config.h' ]
167        }],
168        [ 'OS=="openbsd"', {
169          'include_dirs': [ 'config/openbsd' ],
170          'sources': [ 'config/openbsd/ares_config.h' ]
171        }],
172        [ 'OS=="android"', {
173          'include_dirs': [ 'config/android' ],
174          'sources': [ 'config/android/ares_config.h' ],
175        }],
176        [ 'OS=="solaris"', {
177          'include_dirs': [ 'config/sunos' ],
178          'sources': [ 'config/sunos/ares_config.h' ],
179          'direct_dependent_settings': {
180            'libraries': [
181              '-lsocket',
182              '-lnsl'
183            ]
184          }
185        }]
186      ]
187    }
188  ]
189}
190