Re-land: C++ readability review
[chromium-blink-merge.git] / net / net_common.gypi
blob4f97ff2bba9248e10fc56e11a52e5bc483ed9e5e
1 # Copyright 2015 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
6   # This target is included in both 'net' and 'net_small'.
7   'type': '<(component)',
8   'variables': { 'enable_wexit_time_destructors': 1, },
9   'dependencies': [
10     '../base/base.gyp:base',
11     '../base/base.gyp:base_prefs',
12     '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
13     '../crypto/crypto.gyp:crypto',
14     '../sdch/sdch.gyp:sdch',
15     '../third_party/protobuf/protobuf.gyp:protobuf_lite',
16     '../third_party/zlib/zlib.gyp:zlib',
17     'net_derived_sources',
18     'net_quic_proto',
19     'net_resources',
20   ],
21   'sources': [
22     '<@(net_nacl_common_sources)',
23     '<@(net_non_nacl_sources)',
24   ],
25   'defines': [
26     'NET_IMPLEMENTATION',
27   ],
28   'export_dependent_settings': [
29     '../base/base.gyp:base',
30   ],
31   'conditions': [
32     ['chromeos==1', {
33       'sources!': [
34          'base/network_change_notifier_linux.cc',
35          'base/network_change_notifier_linux.h',
36          'base/network_change_notifier_netlink_linux.cc',
37          'base/network_change_notifier_netlink_linux.h',
38          'proxy/proxy_config_service_linux.cc',
39          'proxy/proxy_config_service_linux.h',
40       ],
41     }],
42     ['use_kerberos==1', {
43       'defines': [
44         'USE_KERBEROS',
45       ],
46       'conditions': [
47         ['OS=="openbsd"', {
48           'include_dirs': [
49             '/usr/include/kerberosV'
50           ],
51         }],
52         ['linux_link_kerberos==1', {
53           'link_settings': {
54             'ldflags': [
55               '<!@(krb5-config --libs gssapi)',
56             ],
57           },
58         }, { # linux_link_kerberos==0
59           'defines': [
60             'DLOPEN_KERBEROS',
61           ],
62         }],
63       ],
64     }, { # use_kerberos == 0
65       'sources!': [
66         'http/http_auth_gssapi_posix.cc',
67         'http/http_auth_gssapi_posix.h',
68         'http/http_auth_handler_negotiate.cc',
69         'http/http_auth_handler_negotiate.h',
70       ],
71     }],
72     ['posix_avoid_mmap==1', {
73       'defines': [
74         'POSIX_AVOID_MMAP',
75       ],
76       'direct_dependent_settings': {
77         'defines': [
78           'POSIX_AVOID_MMAP',
79         ],
80       },
81       'sources!': [
82         'disk_cache/blockfile/mapped_file_posix.cc',
83       ],
84     }, { # else
85       'sources!': [
86         'disk_cache/blockfile/mapped_file_avoid_mmap_posix.cc',
87       ],
88     }],
89     ['disable_file_support==1', {
90       # TODO(mmenke):  Should probably get rid of the dependency on
91       # net_resources in this case (It's used in net_util, to format
92       # directory listings.  Also used outside of net/).
93       'sources!': [
94         'base/directory_lister.cc',
95         'base/directory_lister.h',
96         'url_request/file_protocol_handler.cc',
97         'url_request/file_protocol_handler.h',
98         'url_request/url_request_file_dir_job.cc',
99         'url_request/url_request_file_dir_job.h',
100         'url_request/url_request_file_job.cc',
101         'url_request/url_request_file_job.h',
102       ],
103     }],
104     ['disable_ftp_support==1', {
105       'sources/': [
106         ['exclude', '^ftp/'],
107       ],
108       'sources!': [
109         'url_request/ftp_protocol_handler.cc',
110         'url_request/ftp_protocol_handler.h',
111         'url_request/url_request_ftp_job.cc',
112         'url_request/url_request_ftp_job.h',
113       ],
114     }],
115     ['enable_built_in_dns==1', {
116       'defines': [
117         'ENABLE_BUILT_IN_DNS',
118       ]
119     }, { # else
120       'sources!': [
121         'dns/address_sorter_posix.cc',
122         'dns/address_sorter_posix.h',
123         'dns/dns_client.cc',
124       ],
125     }],
126     ['use_openssl==1', {
127         'sources!': [
128           'base/crypto_module_nss.cc',
129           'base/keygen_handler_nss.cc',
130           'base/nss_memio.c',
131           'base/nss_memio.h',
132           'cert/cert_database_nss.cc',
133           'cert/cert_verify_proc_nss.cc',
134           'cert/cert_verify_proc_nss.h',
135           'cert/ct_log_verifier_nss.cc',
136           'cert/ct_objects_extractor_nss.cc',
137           'cert/jwk_serializer_nss.cc',
138           'cert/nss_cert_database.cc',
139           'cert/nss_cert_database.h',
140           'cert/nss_cert_database_chromeos.cc',
141           'cert/nss_cert_database_chromeos.h',
142           'cert/nss_profile_filter_chromeos.cc',
143           'cert/nss_profile_filter_chromeos.h',
144           'cert/scoped_nss_types.h',
145           'cert/sha256_legacy_support_nss_win.cc',
146           'cert/test_root_certs_nss.cc',
147           'cert/x509_certificate_nss.cc',
148           'cert/x509_util_nss.cc',
149           'cert/x509_util_nss.h',
150           'ocsp/nss_ocsp.cc',
151           'ocsp/nss_ocsp.h',
152           'quic/crypto/aead_base_decrypter_nss.cc',
153           'quic/crypto/aead_base_encrypter_nss.cc',
154           'quic/crypto/aes_128_gcm_12_decrypter_nss.cc',
155           'quic/crypto/aes_128_gcm_12_encrypter_nss.cc',
156           'quic/crypto/chacha20_poly1305_decrypter_nss.cc',
157           'quic/crypto/chacha20_poly1305_encrypter_nss.cc',
158           'quic/crypto/channel_id_nss.cc',
159           'quic/crypto/p256_key_exchange_nss.cc',
160           'socket/nss_ssl_util.cc',
161           'socket/nss_ssl_util.h',
162           'socket/ssl_client_socket_nss.cc',
163           'socket/ssl_client_socket_nss.h',
164           'socket/ssl_server_socket_nss.cc',
165           'socket/ssl_server_socket_nss.h',
166           'third_party/mozilla_security_manager/nsKeygenHandler.cpp',
167           'third_party/mozilla_security_manager/nsKeygenHandler.h',
168           'third_party/mozilla_security_manager/nsNSSCertificateDB.cpp',
169           'third_party/mozilla_security_manager/nsNSSCertificateDB.h',
170           'third_party/mozilla_security_manager/nsPKCS12Blob.cpp',
171           'third_party/mozilla_security_manager/nsPKCS12Blob.h',
172         ],
173         'dependencies': [
174           '../third_party/boringssl/boringssl.gyp:boringssl',
175         ],
176       },
177       {  # else !use_openssl: remove the unneeded files and depend on NSS.
178         'sources!': [
179           'base/crypto_module_openssl.cc',
180           'cert/ct_log_verifier_openssl.cc',
181           'cert/ct_objects_extractor_openssl.cc',
182           'cert/jwk_serializer_openssl.cc',
183           'cert/sha256_legacy_support_openssl_win.cc',
184           'cert/x509_util_openssl.cc',
185           'cert/x509_util_openssl.h',
186           'quic/crypto/aead_base_decrypter_openssl.cc',
187           'quic/crypto/aead_base_encrypter_openssl.cc',
188           'quic/crypto/aes_128_gcm_12_decrypter_openssl.cc',
189           'quic/crypto/aes_128_gcm_12_encrypter_openssl.cc',
190           'quic/crypto/chacha20_poly1305_decrypter_openssl.cc',
191           'quic/crypto/chacha20_poly1305_encrypter_openssl.cc',
192           'quic/crypto/channel_id_openssl.cc',
193           'quic/crypto/p256_key_exchange_openssl.cc',
194           'quic/crypto/scoped_evp_aead_ctx.cc',
195           'quic/crypto/scoped_evp_aead_ctx.h',
196           'socket/ssl_client_socket_openssl.cc',
197           'socket/ssl_client_socket_openssl.h',
198           'socket/ssl_server_socket_openssl.cc',
199           'socket/ssl_server_socket_openssl.h',
200           'socket/ssl_session_cache_openssl.cc',
201           'socket/ssl_session_cache_openssl.h',
202           'ssl/openssl_platform_key.h',
203           'ssl/openssl_platform_key_mac.cc',
204           'ssl/openssl_platform_key_win.cc',
205           'ssl/openssl_ssl_util.cc',
206           'ssl/openssl_ssl_util.h',
207         ],
208         'conditions': [
209           # Pull in the bundled or system NSS as appropriate.
210           [ 'desktop_linux == 1 or chromeos == 1', {
211             'dependencies': [
212               '../build/linux/system.gyp:ssl',
213             ],
214           }, {
215             'dependencies': [
216               '../third_party/nss/nss.gyp:nspr',
217               '../third_party/nss/nss.gyp:nss',
218               'third_party/nss/ssl.gyp:libssl',
219             ],
220           }]
221         ],
222       },
223     ],
224     [ 'use_openssl_certs == 0', {
225         'sources!': [
226           'base/keygen_handler_openssl.cc',
227           'base/openssl_private_key_store.h',
228           'base/openssl_private_key_store_android.cc',
229           'base/openssl_private_key_store_memory.cc',
230           'cert/cert_database_openssl.cc',
231           'cert/cert_verify_proc_openssl.cc',
232           'cert/cert_verify_proc_openssl.h',
233           'cert/test_root_certs_openssl.cc',
234           'cert/x509_certificate_openssl.cc',
235           'ssl/openssl_client_key_store.cc',
236           'ssl/openssl_client_key_store.h',
237         ],
238     }],
239     [ 'use_glib == 1', {
240         'dependencies': [
241           '../build/linux/system.gyp:gconf',
242           '../build/linux/system.gyp:gio',
243         ],
244     }],
245     [ 'desktop_linux == 1 or chromeos == 1', {
246         'conditions': [
247           ['os_bsd==1', {
248             'sources!': [
249               'base/network_change_notifier_linux.cc',
250               'base/network_change_notifier_netlink_linux.cc',
251               'proxy/proxy_config_service_linux.cc',
252             ],
253           },{
254             'dependencies': [
255               '../build/linux/system.gyp:libresolv',
256             ],
257           }],
258           ['OS=="solaris"', {
259             'link_settings': {
260               'ldflags': [
261                 '-R/usr/lib/mps',
262               ],
263             },
264           }],
265         ],
266       },
267       {  # else: OS is not in the above list
268         'sources!': [
269           'base/crypto_module_nss.cc',
270           'base/keygen_handler_nss.cc',
271           'cert/cert_database_nss.cc',
272           'cert/nss_cert_database.cc',
273           'cert/nss_cert_database.h',
274           'cert/test_root_certs_nss.cc',
275           'cert/x509_certificate_nss.cc',
276           'ocsp/nss_ocsp.cc',
277           'ocsp/nss_ocsp.h',
278           'third_party/mozilla_security_manager/nsKeygenHandler.cpp',
279           'third_party/mozilla_security_manager/nsKeygenHandler.h',
280           'third_party/mozilla_security_manager/nsNSSCertificateDB.cpp',
281           'third_party/mozilla_security_manager/nsNSSCertificateDB.h',
282           'third_party/mozilla_security_manager/nsPKCS12Blob.cpp',
283           'third_party/mozilla_security_manager/nsPKCS12Blob.h',
284         ],
285       },
286     ],
287     [ 'use_nss != 1', {
288         'sources!': [
289           'cert/cert_verify_proc_nss.cc',
290           'cert/cert_verify_proc_nss.h',
291           'ssl/client_cert_store_chromeos.cc',
292           'ssl/client_cert_store_chromeos.h',
293           'ssl/client_cert_store_nss.cc',
294           'ssl/client_cert_store_nss.h',
295         ],
296     }],
297     [ 'enable_websockets != 1', {
298         'sources/': [
299           ['exclude', '^websockets/'],
300         ],
301     }],
302     [ 'enable_mdns != 1', {
303         'sources!' : [
304           'dns/mdns_cache.cc',
305           'dns/mdns_cache.h',
306           'dns/mdns_client.cc',
307           'dns/mdns_client.h',
308           'dns/mdns_client_impl.cc',
309           'dns/mdns_client_impl.h',
310           'dns/record_parsed.cc',
311           'dns/record_parsed.h',
312           'dns/record_rdata.cc',
313           'dns/record_rdata.h',
314         ]
315     }],
316     [ 'OS == "win"', {
317         'sources!': [
318           'http/http_auth_handler_ntlm_portable.cc',
319           'socket/socket_libevent.cc',
320           'socket/socket_libevent.h',
321           'socket/tcp_socket_libevent.cc',
322           'socket/tcp_socket_libevent.h',
323           'udp/udp_socket_libevent.cc',
324           'udp/udp_socket_libevent.h',
325         ],
326          # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
327         'msvs_disabled_warnings': [4267, ],
328       }, { # else: OS != "win"
329         'sources!': [
330           'base/winsock_init.cc',
331           'base/winsock_init.h',
332           'base/winsock_util.cc',
333           'base/winsock_util.h',
334           'proxy/proxy_resolver_winhttp.cc',
335           'proxy/proxy_resolver_winhttp.h',
336         ],
337       },
338     ],
339     [ 'OS == "mac"', {
340         'link_settings': {
341           'libraries': [
342             '$(SDKROOT)/System/Library/Frameworks/Foundation.framework',
343             '$(SDKROOT)/System/Library/Frameworks/Security.framework',
344             '$(SDKROOT)/System/Library/Frameworks/SystemConfiguration.framework',
345             '$(SDKROOT)/usr/lib/libresolv.dylib',
346           ]
347         },
348       },
349     ],
350     [ 'OS == "ios"', {
351         'sources!': [
352           'disk_cache/blockfile/file_posix.cc',
353         ],
354         'link_settings': {
355           'libraries': [
356             '$(SDKROOT)/System/Library/Frameworks/CFNetwork.framework',
357             '$(SDKROOT)/System/Library/Frameworks/MobileCoreServices.framework',
358             '$(SDKROOT)/System/Library/Frameworks/Security.framework',
359             '$(SDKROOT)/System/Library/Frameworks/SystemConfiguration.framework',
360             '$(SDKROOT)/usr/lib/libresolv.dylib',
361           ],
362         },
363       },
364     ],
365     [ 'OS == "ios" or OS == "mac"', {
366         'sources': [
367           '<@(net_base_mac_ios_sources)',
368         ],
369       },
370     ],
371     ['OS=="android" and _toolset=="target"', {
372       'dependencies': [
373          'net_java',
374       ],
375     }],
376     [ 'OS == "android"', {
377         'dependencies': [
378           'net_jni_headers',
379         ],
380         'sources!': [
381           'base/openssl_private_key_store_memory.cc',
382           'cert/cert_database_openssl.cc',
383           'cert/cert_verify_proc_openssl.cc',
384           'cert/test_root_certs_openssl.cc',
385         ],
386       },
387     ],
388   ],
389   'target_conditions': [
390     # These source files are excluded by default platform rules, but they
391     # are needed in specific cases on other platforms. Re-including them can
392     # only be done in target_conditions as it is evaluated after the
393     # platform rules.
394     ['OS == "android"', {
395       'sources/': [
396         ['include', '^base/platform_mime_util_linux\\.cc$'],
397         ['include', '^base/address_tracker_linux\\.cc$'],
398         ['include', '^base/address_tracker_linux\\.h$'],
399         ['include', '^base/net_util_linux\\.cc$'],
400         ['include', '^base/net_util_linux\\.h$'],
401       ],
402     }],
403     ['OS == "ios"', {
404       'sources/': [
405         ['include', '^base/mac/url_conversions\\.h$'],
406         ['include', '^base/mac/url_conversions\\.mm$'],
407         ['include', '^base/net_util_mac\\.cc$'],
408         ['include', '^base/net_util_mac\\.h$'],
409         ['include', '^base/network_change_notifier_mac\\.cc$'],
410         ['include', '^base/network_config_watcher_mac\\.cc$'],
411         ['include', '^base/platform_mime_util_mac\\.mm$'],
412         # The iOS implementation only partially uses NSS and thus does not
413         # defines |use_nss|. In particular the |USE_NSS| preprocessor
414         # definition is not used. The following files are needed though:
415         ['include', '^cert/cert_verify_proc_nss\\.cc$'],
416         ['include', '^cert/cert_verify_proc_nss\\.h$'],
417         ['include', '^cert/test_root_certs_nss\\.cc$'],
418         ['include', '^cert/x509_util_nss\\.cc$'],
419         ['include', '^cert/x509_util_nss\\.h$'],
420         ['include', '^proxy/proxy_resolver_mac\\.cc$'],
421         ['include', '^proxy/proxy_server_mac\\.cc$'],
422         ['include', '^ocsp/nss_ocsp\\.cc$'],
423         ['include', '^ocsp/nss_ocsp\\.h$'],
424       ],
425     }],
426   ],