blob: 4fa0fa2cefb10e67507602bb279fbfc43e2dbcbf [file] [log] [blame]
[email protected]4625ade2014-04-15 19:26:441# Copyright (c) 2013 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.
4
5import("//build/config/crypto.gni")
6import("//build/config/features.gni")
7import("//build/config/ui.gni")
8import("//tools/grit/grit_rule.gni")
9
10if (is_android) {
11 import("//build/config/android/config.gni")
12} else if (is_mac) {
13 import("//build/config/mac/mac_sdk.gni")
14}
15
16# The list of net files is kept in net.gypi. Read it.
17gypi_values = exec_script(
18 "//build/gypi_to_gn.py",
19 [ rebase_path("net.gypi") ]
20 "scope",
21 [ "net.gypi" ])
22
23# Disable Kerberos on ChromeOS, Android and iOS, at least for now. It needs
24# configuration (krb5.conf and so on).
25use_kerberos = !is_chromeos && !is_android && !is_ios
26
27# The way the cache uses mmap() is inefficient on some Android devices. If
28# this flag is set, we hackily avoid using mmap() in the disk cache. We are
29# pretty confident that mmap-ing the index would not hurt any existing x86
30# android devices, but we cannot be so sure about the variety of ARM devices.
31# So enable it for x86 only for now.
32posix_avoid_mmap = is_android && cpu_arch != "x86"
33
34# WebSockets and socket stream code are used everywhere except iOS.
35enable_websockets = !is_ios
36use_v8_in_net = !is_ios
37enable_built_in_dns = !is_ios
38
39disable_ftp_support = !is_ios
40
41# When OpenSSL is used for SSL and crypto on Unix-like systems, use OpenSSL"s
42# certificate definition.
43use_openssl_certs = (is_linux || is_android) && use_openssl
44
45config("net_config") {
46 defines = []
47 if (posix_avoid_mmap) {
48 defines += [ "POSIX_AVOID_MMAP" ]
49 }
50}
51
52component("net") {
53 sources =
54 gypi_values.net_nacl_common_sources +
55 gypi_values.net_non_nacl_sources
56
57 cflags = []
58 defines = [ "NET_IMPLEMENTATION" ]
59 direct_dependent_configs = [ ":net_config" ]
60 include_dirs = []
61
62 deps = [
63 ":net_resources",
64 "//base",
65 "//base:i18n",
66 "//base/third_party/dynamic_annotations",
67 "//crypto",
68 "//crypto:platform",
69 "//sdch",
70 "//third_party/icu",
71 "//third_party/zlib",
72 "//url",
73 ]
74
75 if (use_kerberos) {
76 defines += [ "USE_KERBEROS" ]
77 if (is_android) {
78 include_dirs += [ "/usr/include/kerberosV" ]
79 }
80 } else {
81 sources -= [
82 "http/http_auth_gssapi_posix.cc",
83 "http/http_auth_gssapi_posix.h",
84 "http/http_auth_handler_negotiate.h",
85 "http/http_auth_handler_negotiate.cc",
86 ]
87 }
88
89 if (is_posix) {
90 if (posix_avoid_mmap) {
91 sources -= [ "disk_cache/blockfile/mapped_file_posix.cc" ]
92 } else {
93 sources -= [ "disk_cache/blockfile/mapped_file_avoid_mmap_posix.cc" ]
94 }
95 }
96
97 if (disable_ftp_support) {
98 sources -= [
99 "ftp/ftp_auth_cache.cc",
100 "ftp/ftp_auth_cache.h",
101 "ftp/ftp_ctrl_response_buffer.cc",
102 "ftp/ftp_ctrl_response_buffer.h",
103 "ftp/ftp_directory_listing_parser.cc",
104 "ftp/ftp_directory_listing_parser.h",
105 "ftp/ftp_directory_listing_parser_ls.cc",
106 "ftp/ftp_directory_listing_parser_ls.h",
107 "ftp/ftp_directory_listing_parser_netware.cc",
108 "ftp/ftp_directory_listing_parser_netware.h",
109 "ftp/ftp_directory_listing_parser_os2.cc",
110 "ftp/ftp_directory_listing_parser_os2.h",
111 "ftp/ftp_directory_listing_parser_vms.cc",
112 "ftp/ftp_directory_listing_parser_vms.h",
113 "ftp/ftp_directory_listing_parser_windows.cc",
114 "ftp/ftp_directory_listing_parser_windows.h",
115 "ftp/ftp_network_layer.cc",
116 "ftp/ftp_network_layer.h",
117 "ftp/ftp_network_session.cc",
118 "ftp/ftp_network_session.h",
119 "ftp/ftp_network_transaction.cc",
120 "ftp/ftp_network_transaction.h",
121 "ftp/ftp_request_info.h",
122 "ftp/ftp_response_info.cc",
123 "ftp/ftp_response_info.h",
124 "ftp/ftp_server_type_histograms.cc",
125 "ftp/ftp_server_type_histograms.h",
126 "ftp/ftp_transaction.h",
127 "ftp/ftp_transaction_factory.h",
128 "ftp/ftp_util.cc",
129 "ftp/ftp_util.h",
130 "url_request/ftp_protocol_handler.cc",
131 "url_request/ftp_protocol_handler.h",
132 "url_request/url_request_ftp_job.cc",
133 "url_request/url_request_ftp_job.h",
134 ]
135 }
136
137 if (enable_built_in_dns) {
138 defines += [ "ENABLE_BUILT_IN_DNS" ]
139 } else {
140 sources -= [
141 "dns/address_sorter_posix.cc",
142 "dns/address_sorter_posix.h",
143 "dns/dns_client.cc",
144 ]
145 }
146
147 if (use_openssl) {
148 sources -= [
149 "base/crypto_module_nss.cc",
150 "base/keygen_handler_nss.cc",
151 "base/nss_memio.c",
152 "base/nss_memio.h",
153 "cert/cert_database_nss.cc",
154 "cert/cert_verify_proc_nss.cc",
155 "cert/cert_verify_proc_nss.h",
156 "cert/ct_log_verifier_nss.cc",
157 "cert/ct_objects_extractor_nss.cc",
158 "cert/jwk_serializer_nss.cc",
159 "cert/nss_cert_database.cc",
160 "cert/nss_cert_database.h",
161 "cert/nss_cert_database_chromeos.cc",
162 "cert/nss_cert_database_chromeos.h",
163 "cert/nss_profile_filter_chromeos.cc",
164 "cert/nss_profile_filter_chromeos.h",
165 "cert/scoped_nss_types.h",
166 "cert/test_root_certs_nss.cc",
167 "cert/x509_certificate_nss.cc",
168 "cert/x509_util_nss.cc",
169 "cert/x509_util_nss.h",
170 "ocsp/nss_ocsp.cc",
171 "ocsp/nss_ocsp.h",
172 "quic/crypto/aead_base_decrypter_nss.cc",
173 "quic/crypto/aead_base_encrypter_nss.cc",
174 "quic/crypto/aes_128_gcm_12_decrypter_nss.cc",
175 "quic/crypto/aes_128_gcm_12_encrypter_nss.cc",
176 "quic/crypto/chacha20_poly1305_decrypter_nss.cc",
177 "quic/crypto/chacha20_poly1305_encrypter_nss.cc",
178 "quic/crypto/channel_id_nss.cc",
179 "quic/crypto/p256_key_exchange_nss.cc",
180 "socket/nss_ssl_util.cc",
181 "socket/nss_ssl_util.h",
182 "socket/ssl_client_socket_nss.cc",
183 "socket/ssl_client_socket_nss.h",
184 "socket/ssl_server_socket_nss.cc",
185 "socket/ssl_server_socket_nss.h",
186 "third_party/mozilla_security_manager/nsKeygenHandler.cpp",
187 "third_party/mozilla_security_manager/nsKeygenHandler.h",
188 "third_party/mozilla_security_manager/nsNSSCertificateDB.cpp",
189 "third_party/mozilla_security_manager/nsNSSCertificateDB.h",
190 "third_party/mozilla_security_manager/nsPKCS12Blob.cpp",
191 "third_party/mozilla_security_manager/nsPKCS12Blob.h",
192 ]
193 } else {
194 sources -= [
195 "base/crypto_module_openssl.cc",
196 "base/keygen_handler_openssl.cc",
197 "cert/ct_log_verifier_openssl.cc",
198 "cert/ct_objects_extractor_openssl.cc",
199 "cert/jwk_serializer_openssl.cc",
200 "cert/x509_util_openssl.cc",
201 "cert/x509_util_openssl.h",
202 "quic/crypto/aead_base_decrypter_openssl.cc",
203 "quic/crypto/aead_base_encrypter_openssl.cc",
204 "quic/crypto/aes_128_gcm_12_decrypter_openssl.cc",
205 "quic/crypto/aes_128_gcm_12_encrypter_openssl.cc",
206 "quic/crypto/chacha20_poly1305_decrypter_openssl.cc",
207 "quic/crypto/chacha20_poly1305_encrypter_openssl.cc",
208 "quic/crypto/channel_id_openssl.cc",
209 "quic/crypto/p256_key_exchange_openssl.cc",
210 "quic/crypto/scoped_evp_aead_ctx.cc",
211 "quic/crypto/scoped_evp_aead_ctx.h",
212 "socket/ssl_client_socket_openssl.cc",
213 "socket/ssl_client_socket_openssl.h",
214 "socket/ssl_server_socket_openssl.cc",
215 "socket/ssl_session_cache_openssl.cc",
216 "socket/ssl_session_cache_openssl.h",
217 ]
218 }
219
220 if (!use_openssl_certs) {
221 sources -= [
222 "base/openssl_private_key_store.h",
223 "base/openssl_private_key_store_memory.cc",
224 "cert/cert_database_openssl.cc",
225 "cert/cert_verify_proc_openssl.cc",
226 "cert/cert_verify_proc_openssl.h",
227 "cert/test_root_certs_openssl.cc",
228 "cert/x509_certificate_openssl.cc",
229 "ssl/openssl_client_key_store.cc",
230 "ssl/openssl_client_key_store.h",
231 ]
232 if (is_android) {
233 sources -= [
234 "base/openssl_private_key_store_android.cc",
235 ]
236 }
237 }
238
239 if (use_glib) {
240 configs += [ "//build/config/linux:gconf" ]
241 deps += [ "//build/config/linux:gio" ]
242 }
243
244 if (is_linux) {
245 configs += [ "//build/config/linux:libresolv" ]
246 } else {
247 sources -= [
248 "base/crypto_module_nss.cc",
249 "base/keygen_handler_nss.cc",
250 "cert/cert_database_nss.cc",
251 "cert/nss_cert_database.cc",
252 "cert/nss_cert_database.h",
253 "cert/test_root_certs_nss.cc",
254 "cert/x509_certificate_nss.cc",
255 "ocsp/nss_ocsp.cc",
256 "ocsp/nss_ocsp.h",
257 "third_party/mozilla_security_manager/nsKeygenHandler.cpp",
258 "third_party/mozilla_security_manager/nsKeygenHandler.h",
259 "third_party/mozilla_security_manager/nsNSSCertificateDB.cpp",
260 "third_party/mozilla_security_manager/nsNSSCertificateDB.h",
261 "third_party/mozilla_security_manager/nsPKCS12Blob.cpp",
262 "third_party/mozilla_security_manager/nsPKCS12Blob.h",
263 ]
264 }
265
266 if (!use_nss) {
267 sources -= [
268 "cert/cert_verify_proc_nss.cc",
269 "cert/cert_verify_proc_nss.h",
270 "ssl/client_cert_store_nss.cc",
271 "ssl/client_cert_store_nss.h",
272 ]
273 if (is_chromeos) {
274 # These were already removed on non-ChromeOS.
275 sources -= [
276 "ssl/client_cert_store_chromeos.cc",
277 "ssl/client_cert_store_chromeos.h",
278 ]
279 }
280 }
281
282 if (!enable_websockets) {
283 sources -= [
284 "socket_stream/socket_stream.cc",
285 "socket_stream/socket_stream.h",
286 "socket_stream/socket_stream_job.cc",
287 "socket_stream/socket_stream_job.h",
288 "socket_stream/socket_stream_job_manager.cc",
289 "socket_stream/socket_stream_job_manager.h",
290 "socket_stream/socket_stream_metrics.cc",
291 "socket_stream/socket_stream_metrics.h",
292 "spdy/spdy_websocket_stream.cc",
293 "spdy/spdy_websocket_stream.h",
294 "websockets/websocket_basic_handshake_stream.cc",
295 "websockets/websocket_basic_handshake_stream.h",
296 "websockets/websocket_basic_stream.cc",
297 "websockets/websocket_basic_stream.h",
298 "websockets/websocket_channel.cc",
299 "websockets/websocket_channel.h",
300 "websockets/websocket_deflate_predictor.h",
301 "websockets/websocket_deflate_predictor_impl.cc",
302 "websockets/websocket_deflate_predictor_impl.h",
303 "websockets/websocket_deflate_stream.cc",
304 "websockets/websocket_deflate_stream.h",
305 "websockets/websocket_deflater.cc",
306 "websockets/websocket_deflater.h",
307 "websockets/websocket_errors.cc",
308 "websockets/websocket_errors.h",
309 "websockets/websocket_extension.cc",
310 "websockets/websocket_extension.h",
311 "websockets/websocket_extension_parser.cc",
312 "websockets/websocket_extension_parser.h",
313 "websockets/websocket_frame.cc",
314 "websockets/websocket_frame.h",
315 "websockets/websocket_frame_parser.cc",
316 "websockets/websocket_frame_parser.h",
317 "websockets/websocket_handshake_constants.cc",
318 "websockets/websocket_handshake_constants.h",
319 "websockets/websocket_handshake_handler.cc",
320 "websockets/websocket_handshake_handler.h",
321 "websockets/websocket_handshake_request_info.cc",
322 "websockets/websocket_handshake_request_info.h",
323 "websockets/websocket_handshake_response_info.cc",
324 "websockets/websocket_handshake_response_info.h",
325 "websockets/websocket_handshake_stream_base.h",
326 "websockets/websocket_handshake_stream_create_helper.cc",
327 "websockets/websocket_handshake_stream_create_helper.h",
328 "websockets/websocket_inflater.cc",
329 "websockets/websocket_inflater.h",
330 "websockets/websocket_job.cc",
331 "websockets/websocket_job.h",
332 "websockets/websocket_mux.h",
333 "websockets/websocket_net_log_params.cc",
334 "websockets/websocket_net_log_params.h",
335 "websockets/websocket_stream.cc",
336 "websockets/websocket_stream.h",
337 "websockets/websocket_throttle.cc",
338 "websockets/websocket_throttle.h",
339 ]
340 }
341
342 if (!enable_mdns) {
343 sources -= [
344 "dns/mdns_cache.cc",
345 "dns/mdns_cache.h",
346 "dns/mdns_client.cc",
347 "dns/mdns_client.h",
348 "dns/mdns_client_impl.cc",
349 "dns/mdns_client_impl.h",
350 "dns/record_parsed.cc",
351 "dns/record_parsed.h",
352 "dns/record_rdata.cc",
353 "dns/record_rdata.h",
354 ]
355 }
356
357 if (is_win) {
358 sources -= [
359 "http/http_auth_handler_ntlm_portable.cc",
360 "socket/tcp_socket_libevent.cc",
361 "socket/tcp_socket_libevent.h",
362 "udp/udp_socket_libevent.cc",
363 "udp/udp_socket_libevent.h",
364 ]
365 deps += [
366 #"//third_party/nss:nspr", # TODO(brettw)
367 #"//third_party/nss",
368 ]
369
370 # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
371 cflags += [ "/wd4267" ]
372 } else { # !is_win
373 sources -= [
374 "base/winsock_init.cc",
375 "base/winsock_init.h",
376 "base/winsock_util.cc",
377 "base/winsock_util.h",
378 "proxy/proxy_resolver_winhttp.cc",
379 "proxy/proxy_resolver_winhttp.h",
380 ]
381 }
382
383 if (is_mac) {
384 sources -= [
385 "ssl/client_cert_store_nss.cc",
386 "ssl/client_cert_store_nss.h",
387 ]
388 deps += [
389 # TODO(brettw)
390 #"//third_party/nss:nspr",
391 #"//third_party/nss",
392 ]
393 libs = [
394 "$SDKROOT/System/Library/Frameworks/Foundation.framework",
395 "$SDKROOT/System/Library/Frameworks/Security.framework",
396 "$SDKROOT/System/Library/Frameworks/SystemConfiguration.framework",
397 "$SDKROOT/usr/lib/libresolv.dylib",
398 ]
399 }
400
401 if (is_ios) {
402 sources -= [ "disk_cache/blockfile/file_posix.cc" ]
403 deps += [
404 "//third_party/nss",
405 ]
406 libs = [
407 "$SDKROOT/System/Library/Frameworks/CFNetwork.framework",
408 "$SDKROOT/System/Library/Frameworks/MobileCoreServices.framework",
409 "$SDKROOT/System/Library/Frameworks/Security.framework",
410 "$SDKROOT/System/Library/Frameworks/SystemConfiguration.framework",
411 "$SDKROOT/usr/lib/libresolv.dylib",
412 ]
413 }
414
415 if (is_android) {
416 if (!is_android_webview_build) {
417 sources -= [
418 "base/openssl_private_key_store_memory.cc",
419 "cert/cert_database_openssl.cc",
420 "cert/cert_verify_proc_openssl.cc",
421 "cert/test_root_certs_openssl.cc",
422 ]
423 deps += [ ":net_jni_headers" ]
424
425 # The net/android/keystore_openssl.cc source file needs to access an
426 # OpenSSL-internal header.
427 include_dirs = [ "//third_party/openssl" ]
428 }
429 }
430}
431
432grit("net_resources") {
433 source = "base/net_resources.grd"
434}
435
436source_set("http_server") {
437 sources = [
438 "server/http_connection.cc",
439 "server/http_connection.h",
440 "server/http_server.cc",
441 "server/http_server.h",
442 "server/http_server_request_info.cc",
443 "server/http_server_request_info.h",
444 "server/http_server_response_info.cc",
445 "server/http_server_response_info.h",
446 "server/web_socket.cc",
447 "server/web_socket.h",
448 ]
449 configs += [ "//build/config/compiler:wexit_time_destructors" ]
450 deps = [
451 ":net",
452 "//base",
453 ]
454}
455
456#TODO(brettw) enable this wben we've done all deps required by this target.
457#executable("dump_cache") {
458# sources = [
459# 'tools/dump_cache/cache_dumper.cc',
460# 'tools/dump_cache/cache_dumper.h',
461# 'tools/dump_cache/dump_cache.cc',
462# 'tools/dump_cache/dump_files.cc',
463# 'tools/dump_cache/dump_files.h',
464# 'tools/dump_cache/simple_cache_dumper.cc',
465# 'tools/dump_cache/simple_cache_dumper.h',
466# 'tools/dump_cache/upgrade_win.cc',
467# 'tools/dump_cache/upgrade_win.h',
468# 'tools/dump_cache/url_to_filename_encoder.cc',
469# 'tools/dump_cache/url_to_filename_encoder.h',
470# 'tools/dump_cache/url_utilities.h',
471# 'tools/dump_cache/url_utilities.cc',
472# ]
473#
474# deps = [
475# "//base",
476# ":net",
477# ":net_test_support",
478# ]
479#
480# if (is_win) {
481# # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
482# cflags += [ "/wd4267" ]
483# }
484#}
485#
486#source_set("net_test_support") {
487# sources = [
488# 'base/capturing_net_log.cc',
489# 'base/capturing_net_log.h',
490# 'base/load_timing_info_test_util.cc',
491# 'base/load_timing_info_test_util.h',
492# 'base/mock_file_stream.cc',
493# 'base/mock_file_stream.h',
494# 'base/test_completion_callback.cc',
495# 'base/test_completion_callback.h',
496# 'base/test_data_directory.cc',
497# 'base/test_data_directory.h',
498# 'cert/mock_cert_verifier.cc',
499# 'cert/mock_cert_verifier.h',
500# 'cookies/cookie_monster_store_test.cc',
501# 'cookies/cookie_monster_store_test.h',
502# 'cookies/cookie_store_test_callbacks.cc',
503# 'cookies/cookie_store_test_callbacks.h',
504# 'cookies/cookie_store_test_helpers.cc',
505# 'cookies/cookie_store_test_helpers.h',
506# 'disk_cache/disk_cache_test_base.cc',
507# 'disk_cache/disk_cache_test_base.h',
508# 'disk_cache/disk_cache_test_util.cc',
509# 'disk_cache/disk_cache_test_util.h',
510# 'dns/dns_test_util.cc',
511# 'dns/dns_test_util.h',
512# 'dns/mock_host_resolver.cc',
513# 'dns/mock_host_resolver.h',
514# 'dns/mock_mdns_socket_factory.cc',
515# 'dns/mock_mdns_socket_factory.h',
516# 'proxy/mock_proxy_resolver.cc',
517# 'proxy/mock_proxy_resolver.h',
518# 'proxy/mock_proxy_script_fetcher.cc',
519# 'proxy/mock_proxy_script_fetcher.h',
520# 'proxy/proxy_config_service_common_unittest.cc',
521# 'proxy/proxy_config_service_common_unittest.h',
522# 'socket/socket_test_util.cc',
523# 'socket/socket_test_util.h',
524# 'test/cert_test_util.cc',
525# 'test/cert_test_util.h',
526# 'test/ct_test_util.cc',
527# 'test/ct_test_util.h',
528# 'test/embedded_test_server/embedded_test_server.cc',
529# 'test/embedded_test_server/embedded_test_server.h',
530# 'test/embedded_test_server/http_connection.cc',
531# 'test/embedded_test_server/http_connection.h',
532# 'test/embedded_test_server/http_request.cc',
533# 'test/embedded_test_server/http_request.h',
534# 'test/embedded_test_server/http_response.cc',
535# 'test/embedded_test_server/http_response.h',
536# 'test/net_test_suite.cc',
537# 'test/net_test_suite.h',
538# 'test/python_utils.cc',
539# 'test/python_utils.h',
540# 'test/spawned_test_server/base_test_server.cc',
541# 'test/spawned_test_server/base_test_server.h',
542# 'test/spawned_test_server/local_test_server_posix.cc',
543# 'test/spawned_test_server/local_test_server_win.cc',
544# 'test/spawned_test_server/local_test_server.cc',
545# 'test/spawned_test_server/local_test_server.h',
546# 'test/spawned_test_server/remote_test_server.cc',
547# 'test/spawned_test_server/remote_test_server.h',
548# 'test/spawned_test_server/spawned_test_server.h',
549# 'test/spawned_test_server/spawner_communicator.cc',
550# 'test/spawned_test_server/spawner_communicator.h',
551# 'url_request/test_url_fetcher_factory.cc',
552# 'url_request/test_url_fetcher_factory.h',
553# 'url_request/url_request_test_util.cc',
554# 'url_request/url_request_test_util.h',
555# ]
556#
557# deps = [
558# "//base",
559# "//base/test:test_support",
560# "//crypto:platform",
561# "//net/tools/tld_cleanup",
562# "//testing/gmock",
563# "//testing/gtest",
564# "//url",
565# ]
566#
567# # TODO(brettw) conditions from GYP
568#
569# forward_dependent_configs_from = deps
570#}
571
572# TODO(brettw) remaining targets from GYP file.