Remove APIPermission::kFileSystemWriteDirectory
[chromium-blink-merge.git] / net / net_common.gypi
blobd029591690877c700bd05091636149fc15b9a208
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': ['<@(net_file_support_sources)']
94     }],
95     ['disable_ftp_support!=1', {
96       'sources': ['<@(net_ftp_support_sources)']
97     }],
98     ['enable_built_in_dns==1', {
99       'defines': [
100         'ENABLE_BUILT_IN_DNS',
101       ]
102     }, { # else
103       'sources!': [
104         'dns/address_sorter_posix.cc',
105         'dns/address_sorter_posix.h',
106         'dns/dns_client.cc',
107       ],
108     }],
109     ['use_openssl==1', {
110         'sources!': [
111           'base/nss_memio.c',
112           'base/nss_memio.h',
113           'cert/ct_log_verifier_nss.cc',
114           'cert/ct_objects_extractor_nss.cc',
115           'cert/jwk_serializer_nss.cc',
116           'cert/scoped_nss_types.h',
117           'cert/sha256_legacy_support_nss_win.cc',
118           'cert/x509_util_nss.cc',
119           'quic/crypto/aead_base_decrypter_nss.cc',
120           'quic/crypto/aead_base_encrypter_nss.cc',
121           'quic/crypto/aes_128_gcm_12_decrypter_nss.cc',
122           'quic/crypto/aes_128_gcm_12_encrypter_nss.cc',
123           'quic/crypto/chacha20_poly1305_decrypter_nss.cc',
124           'quic/crypto/chacha20_poly1305_encrypter_nss.cc',
125           'quic/crypto/channel_id_nss.cc',
126           'quic/crypto/p256_key_exchange_nss.cc',
127           'socket/nss_ssl_util.cc',
128           'socket/nss_ssl_util.h',
129           'socket/ssl_client_socket_nss.cc',
130           'socket/ssl_client_socket_nss.h',
131           'socket/ssl_server_socket_nss.cc',
132           'socket/ssl_server_socket_nss.h',
133         ],
134         'dependencies': [
135           '../third_party/boringssl/boringssl.gyp:boringssl',
136         ],
137       },
138       {  # else !use_openssl: remove the unneeded files and depend on NSS.
139         'sources!': [
140           'cert/ct_log_verifier_openssl.cc',
141           'cert/ct_objects_extractor_openssl.cc',
142           'cert/jwk_serializer_openssl.cc',
143           'cert/sha256_legacy_support_openssl_win.cc',
144           'cert/x509_util_openssl.cc',
145           'cert/x509_util_openssl.h',
146           'quic/crypto/aead_base_decrypter_openssl.cc',
147           'quic/crypto/aead_base_encrypter_openssl.cc',
148           'quic/crypto/aes_128_gcm_12_decrypter_openssl.cc',
149           'quic/crypto/aes_128_gcm_12_encrypter_openssl.cc',
150           'quic/crypto/chacha20_poly1305_decrypter_openssl.cc',
151           'quic/crypto/chacha20_poly1305_encrypter_openssl.cc',
152           'quic/crypto/channel_id_openssl.cc',
153           'quic/crypto/p256_key_exchange_openssl.cc',
154           'quic/crypto/scoped_evp_aead_ctx.cc',
155           'quic/crypto/scoped_evp_aead_ctx.h',
156           'socket/ssl_client_socket_openssl.cc',
157           'socket/ssl_client_socket_openssl.h',
158           'socket/ssl_server_socket_openssl.cc',
159           'socket/ssl_server_socket_openssl.h',
160           'ssl/client_key_store.cc',
161           'ssl/client_key_store.h',
162           'ssl/openssl_ssl_util.cc',
163           'ssl/openssl_ssl_util.h',
164           'ssl/ssl_client_session_cache_openssl.cc',
165           'ssl/ssl_client_session_cache_openssl.h',
166           'ssl/ssl_platform_key.h',
167           'ssl/ssl_platform_key_nss.cc',
168           'ssl/threaded_ssl_private_key.cc',
169           'ssl/threaded_ssl_private_key.h',
170         ],
171       },
172     ],
173     [ 'use_nss_certs == 1 or OS == "ios" or use_openssl == 0', {
174         'conditions': [
175           # Pull in the bundled or system NSS as appropriate.
176           [ 'desktop_linux == 1 or chromeos == 1', {
177             'dependencies': [
178               '../build/linux/system.gyp:ssl',
179             ],
180           }, {
181             'dependencies': [
182               '../third_party/nss/nss.gyp:nspr',
183               '../third_party/nss/nss.gyp:nss',
184               'third_party/nss/ssl.gyp:libssl',
185             ],
186           }]
187         ],
188       }, {
189         'sources!': [
190           'cert/x509_util_nss.h',
191         ],
192       },
193     ],
194     [ 'use_openssl_certs == 0', {
195         'sources!': [
196           'base/crypto_module_openssl.cc',
197           'base/keygen_handler_openssl.cc',
198           'base/openssl_private_key_store.h',
199           'base/openssl_private_key_store_android.cc',
200           'base/openssl_private_key_store_memory.cc',
201           'cert/cert_database_openssl.cc',
202           'cert/cert_verify_proc_openssl.cc',
203           'cert/cert_verify_proc_openssl.h',
204           'cert/test_root_certs_openssl.cc',
205           'cert/x509_certificate_openssl.cc',
206           'ssl/openssl_client_key_store.cc',
207           'ssl/openssl_client_key_store.h',
208         ],
209     }, {
210         'sources!': [
211           # TODO(davidben): Remove these exclusions when use_openssl_certs
212           # builds also use the SSLPrivateKey machinery.
213           'ssl/threaded_ssl_private_key.cc',
214           'ssl/threaded_ssl_private_key.h',
215         ],
216     }],
217     [ 'use_glib == 1', {
218         'dependencies': [
219           '../build/linux/system.gyp:gconf',
220           '../build/linux/system.gyp:gio',
221         ],
222     }],
223     [ 'desktop_linux == 1 or chromeos == 1', {
224         'conditions': [
225           ['os_bsd==1', {
226             'sources!': [
227               'base/network_change_notifier_linux.cc',
228               'base/network_change_notifier_netlink_linux.cc',
229               'proxy/proxy_config_service_linux.cc',
230             ],
231           },{
232             'dependencies': [
233               '../build/linux/system.gyp:libresolv',
234             ],
235           }],
236           ['OS=="solaris"', {
237             'link_settings': {
238               'ldflags': [
239                 '-R/usr/lib/mps',
240               ],
241             },
242           }],
243         ],
244       },
245     ],
246     [ 'use_nss_certs != 1', {
247         'sources!': [
248           'base/crypto_module_nss.cc',
249           'base/keygen_handler_nss.cc',
250           'cert/cert_database_nss.cc',
251           'cert/cert_verify_proc_nss.cc',
252           'cert/cert_verify_proc_nss.h',
253           'cert/nss_cert_database.cc',
254           'cert/nss_cert_database.h',
255           'cert/nss_cert_database_chromeos.cc',
256           'cert/nss_cert_database_chromeos.h',
257           'cert/nss_profile_filter_chromeos.cc',
258           'cert/nss_profile_filter_chromeos.h',
259           'cert/test_root_certs_nss.cc',
260           'cert/x509_certificate_nss.cc',
261           'cert/x509_util_nss_certs.cc',
262           'cert_net/nss_ocsp.cc',
263           'cert_net/nss_ocsp.h',
264           'ssl/client_cert_store_nss.cc',
265           'ssl/client_cert_store_nss.h',
266           'ssl/client_key_store.cc',
267           'ssl/client_key_store.h',
268           'ssl/ssl_platform_key_nss.cc',
269           'third_party/mozilla_security_manager/nsKeygenHandler.cpp',
270           'third_party/mozilla_security_manager/nsKeygenHandler.h',
271           'third_party/mozilla_security_manager/nsNSSCertificateDB.cpp',
272           'third_party/mozilla_security_manager/nsNSSCertificateDB.h',
273           'third_party/mozilla_security_manager/nsPKCS12Blob.cpp',
274           'third_party/mozilla_security_manager/nsPKCS12Blob.h',
275         ],
276       },
277     ],
278     # client_cert_store_nss.c requires NSS_CmpCertChainWCANames from NSS's
279     # libssl, but our bundled copy is not built in OpenSSL ports. Pull that
280     # file in directly.
281     [ 'use_nss_certs == 1 and use_openssl == 1', {
282         'sources': [
283           'third_party/nss/ssl/cmpcert.c',
284         ],
285     }],
286     [ 'enable_websockets == 1', {
287         'sources': ['<@(net_websockets_sources)']
288     }],
289     [ 'enable_mdns != 1', {
290         'sources!' : [
291           'dns/mdns_cache.cc',
292           'dns/mdns_cache.h',
293           'dns/mdns_client.cc',
294           'dns/mdns_client.h',
295           'dns/mdns_client_impl.cc',
296           'dns/mdns_client_impl.h',
297           'dns/record_parsed.cc',
298           'dns/record_parsed.h',
299           'dns/record_rdata.cc',
300           'dns/record_rdata.h',
301         ]
302     }],
303     [ 'OS == "win"', {
304         'sources!': [
305           'http/http_auth_handler_ntlm_portable.cc',
306           'socket/socket_libevent.cc',
307           'socket/socket_libevent.h',
308           'socket/tcp_socket_libevent.cc',
309           'socket/tcp_socket_libevent.h',
310           'udp/udp_socket_libevent.cc',
311           'udp/udp_socket_libevent.h',
312         ],
313          # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
314         'msvs_disabled_warnings': [4267, ],
315       }, { # else: OS != "win"
316         'sources!': [
317           'base/winsock_init.cc',
318           'base/winsock_init.h',
319           'base/winsock_util.cc',
320           'base/winsock_util.h',
321           'proxy/proxy_resolver_winhttp.cc',
322           'proxy/proxy_resolver_winhttp.h',
323         ],
324       },
325     ],
326     [ 'OS == "mac"', {
327         'link_settings': {
328           'libraries': [
329             '$(SDKROOT)/System/Library/Frameworks/Foundation.framework',
330             '$(SDKROOT)/System/Library/Frameworks/Security.framework',
331             '$(SDKROOT)/System/Library/Frameworks/SystemConfiguration.framework',
332             '$(SDKROOT)/usr/lib/libresolv.dylib',
333           ]
334         },
335       },
336     ],
337     [ 'OS == "ios"', {
338         'sources!': [
339           'disk_cache/blockfile/file_posix.cc',
340         ],
341         'link_settings': {
342           'libraries': [
343             '$(SDKROOT)/System/Library/Frameworks/CFNetwork.framework',
344             '$(SDKROOT)/System/Library/Frameworks/MobileCoreServices.framework',
345             '$(SDKROOT)/System/Library/Frameworks/Security.framework',
346             '$(SDKROOT)/System/Library/Frameworks/SystemConfiguration.framework',
347           ],
348           'xcode_settings': {
349             'OTHER_LDFLAGS': [
350               '-lresolv',
351             ],
352           },
353         },
354       },
355     ],
356     [ 'OS == "ios" or OS == "mac"', {
357         'sources': [
358           '<@(net_base_mac_ios_sources)',
359         ],
360       },
361     ],
362     ['OS=="android" and _toolset=="target"', {
363       'dependencies': [
364          'net_java',
365       ],
366     }],
367     [ 'OS == "android"', {
368         'dependencies': [
369           'net_jni_headers',
370         ],
371         'sources!': [
372           'base/openssl_private_key_store_memory.cc',
373           'cert/cert_database_openssl.cc',
374           'cert/cert_verify_proc_openssl.cc',
375           'cert/test_root_certs_openssl.cc',
376           'http/http_auth_gssapi_posix.cc',
377           'http/http_auth_gssapi_posix.h',
378         ],
379       },
380     ],
381   ],
382   'target_conditions': [
383     # These source files are excluded by default platform rules, but they
384     # are needed in specific cases on other platforms. Re-including them can
385     # only be done in target_conditions as it is evaluated after the
386     # platform rules.
387     ['OS == "android"', {
388       'sources/': [
389         ['include', '^base/platform_mime_util_linux\\.cc$'],
390         ['include', '^base/address_tracker_linux\\.cc$'],
391         ['include', '^base/address_tracker_linux\\.h$'],
392         ['include', '^base/network_interfaces_linux\\.cc$'],
393         ['include', '^base/network_interfaces_linux\\.h$'],
394       ],
395     }],
396     ['OS == "ios"', {
397       'sources/': [
398         ['include', '^base/mac/url_conversions\\.h$'],
399         ['include', '^base/mac/url_conversions\\.mm$'],
400         ['include', '^base/network_change_notifier_mac\\.cc$'],
401         ['include', '^base/network_config_watcher_mac\\.cc$'],
402         ['include', '^base/network_interfaces_mac\\.cc$'],
403         ['include', '^base/network_interfaces_mac\\.h$'],
404         ['include', '^base/platform_mime_util_mac\\.mm$'],
405         # The iOS implementation only partially uses NSS and thus does not
406         # defines |use_nss_certs|. In particular the |USE_NSS_CERTS|
407         # preprocessor definition is not used. The following files are needed
408         # though:
409         ['include', '^cert/cert_verify_proc_nss\\.cc$'],
410         ['include', '^cert/cert_verify_proc_nss\\.h$'],
411         ['include', '^cert/test_root_certs_nss\\.cc$'],
412         ['include', '^cert/x509_util_nss_certs\\.cc$'],
413         ['include', '^cert_net/nss_ocsp\\.cc$'],
414         ['include', '^cert_net/nss_ocsp\\.h$'],
415         ['include', '^proxy/proxy_resolver_mac\\.cc$'],
416         ['include', '^proxy/proxy_server_mac\\.cc$'],
417       ],
418     }],
419   ],