QUIC - cleanup changes to sync chromium tree with internal source.
[chromium-blink-merge.git] / components / nacl / BUILD.gn
blobe5a4ad02eec3e9810e32fc70012bb5a4c09725d1
1 # Copyright (c) 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.
5 import("//build/config/crypto.gni")
6 import("//build/config/features.gni")
7 import("//build/config/ui.gni")
8 import("//testing/test.gni")
10 if (enable_nacl) {
11   source_set("nacl") {
12     sources = [
13       "loader/nacl_ipc_adapter.cc",
14       "loader/nacl_ipc_adapter.h",
15       "loader/nacl_listener.cc",
16       "loader/nacl_listener.h",
17       "loader/nacl_main.cc",
18       "loader/nacl_main_platform_delegate.h",
19       "loader/nacl_main_platform_delegate_linux.cc",
20       "loader/nacl_main_platform_delegate_mac.mm",
21       "loader/nacl_main_platform_delegate_win.cc",
22       "loader/nacl_trusted_listener.cc",
23       "loader/nacl_trusted_listener.h",
24       "loader/nacl_validation_db.h",
25       "loader/nacl_validation_query.cc",
26       "loader/nacl_validation_query.h",
27     ]
29     deps = [
30       ":nacl_common",
31       ":nacl_switches",
32       "//base",
33       "//base:base_static",
34       "//content/public/common",
35       "//crypto",
36       "//ipc",
37       "//native_client/src/trusted/service_runtime:sel_main_chrome",
38       "//ppapi/c",
39       "//ppapi/proxy:ipc",
40       "//ppapi/shared_impl",
41       "//third_party/mojo/src/mojo/edk/embedder",
42     ]
44     if (enable_nacl_untrusted) {
45       data_deps = [
46         # TODO(GYP): handle other architectures correctly.
47         "//ppapi/native_client:nacl_irt(//build/toolchain/nacl:irt_x64)",
48       ]
49     }
50     if (enable_pnacl) {
51       data_deps += [
52         # TODO(GYP): handle other architectures correctly.
53         "//ppapi/native_client/src/untrusted/pnacl_support_extension",
54       ]
55     }
56   }
58   source_set("nacl_browser") {
59     sources = [
60       "browser/bad_message.cc",
61       "browser/bad_message.h",
62       "browser/nacl_broker_host_win.cc",
63       "browser/nacl_broker_host_win.h",
64       "browser/nacl_broker_service_win.cc",
65       "browser/nacl_broker_service_win.h",
66       "browser/nacl_browser.cc",
67       "browser/nacl_browser.h",
68       "browser/nacl_file_host.cc",
69       "browser/nacl_file_host.h",
70       "browser/nacl_host_message_filter.cc",
71       "browser/nacl_host_message_filter.h",
72       "browser/nacl_process_host.cc",
73       "browser/nacl_process_host.h",
74       "browser/nacl_validation_cache.cc",
75       "browser/nacl_validation_cache.h",
76       "browser/pnacl_host.cc",
77       "browser/pnacl_host.h",
78       "browser/pnacl_translation_cache.cc",
79       "browser/pnacl_translation_cache.h",
80       "common/nacl_debug_exception_handler_win.cc",
81       "common/nacl_debug_exception_handler_win.h",
82     ]
84     deps = [
85       ":nacl_common",
86       ":nacl_switches",
87       ":nacl_helper",
88       "//base",
89       "//base/third_party/dynamic_annotations",
90       "//content/public/browser",
91       "//content/public/common",
92       "//ipc",
93       "//native_client/src/trusted/service_runtime:sel_main_chrome",
94       "//net",
95       "//ppapi/host",
96       "//ppapi/proxy:ipc",
97       "//ppapi/shared_impl",
98       "//sandbox/linux:sandbox_services",
99     ]
101     if (is_linux) {
102       sources += [
103         "zygote/nacl_fork_delegate_linux.cc",
104         "zygote/nacl_fork_delegate_linux.h",
105       ]
107       deps += [ "//sandbox/linux:suid_sandbox_client" ]
108     }
109   }
111   source_set("nacl_renderer") {
112     sources = [
113       "renderer/file_downloader.cc",
114       "renderer/file_downloader.h",
115       "renderer/histogram.cc",
116       "renderer/histogram.h",
117       "renderer/json_manifest.cc",
118       "renderer/json_manifest.h",
119       "renderer/manifest_downloader.cc",
120       "renderer/manifest_downloader.h",
121       "renderer/manifest_service_channel.cc",
122       "renderer/manifest_service_channel.h",
123       "renderer/nacl_helper.cc",
124       "renderer/nacl_helper.h",
125       "renderer/nexe_load_manager.cc",
126       "renderer/nexe_load_manager.h",
127       "renderer/platform_info.cc",
128       "renderer/platform_info.h",
129       "renderer/pnacl_translation_resource_host.cc",
130       "renderer/pnacl_translation_resource_host.h",
131       "renderer/ppb_nacl_private_impl.cc",
132       "renderer/ppb_nacl_private_impl.h",
133       "renderer/progress_event.cc",
134       "renderer/progress_event.h",
135       "renderer/trusted_plugin_channel.cc",
136       "renderer/trusted_plugin_channel.h",
137     ]
139     deps = [
140       ":nacl_common",
141       ":nacl_switches",
142       "renderer/plugin:nacl_trusted_plugin",
143       "//base",
144       "//content/public/common",
145       "//content/public/renderer",
146       "//ipc",
147       "//net",
148       "//ppapi/c",
149       "//ppapi/proxy:ipc",
150       "//ppapi/shared_impl",
151       "//third_party/WebKit/public:blink",
152     ]
153   }
155   # TODO(GYP): Delete this after we've converted everything to GN.
156   # The _run targets exist only for compatibility w/ GYP.
157   group("nacl_loader_unittests_run") {
158     testonly = true
159     deps = [
160       ":nacl_loader_unittests",
161     ]
162   }
164   test("nacl_loader_unittests") {
165     sources = [
166       "loader/nacl_ipc_adapter_unittest.cc",
167       "loader/nacl_validation_query_unittest.cc",
168       "loader/run_all_unittests.cc",
169     ]
171     deps = [
172       ":nacl",
173       "//base/test:test_support",
174       "//ipc:test_support",
175       "//testing/gtest",
176     ]
177   }
179   if (is_linux) {
180     executable("nacl_helper") {
181       sources = [
182         "loader/nacl_helper_linux.cc",
183         "loader/nacl_helper_linux.h",
184       ]
186       deps = [
187         ":nacl",
188         ":nacl_linux",
189         ":nacl_switches",
190         "//base",
191         "//build/config/sanitizers:deps",
192         "//content/public/common",
193         "//crypto",
194         "//ipc",
195       ]
197       cflags = [ "-fPIE" ]
199       ldflags = [ "-pie" ]
201       if (!use_openssl) {
202         deps += [ "//sandbox/linux:libc_urandom_override" ]
203       }
204     }
206     source_set("nacl_linux") {
207       sources = [
208         "//ppapi/nacl_irt/irt_manifest.h",
209         "//ppapi/nacl_irt/manifest_service.cc",
210         "//ppapi/nacl_irt/manifest_service.h",
211         "//ppapi/nacl_irt/plugin_main.cc",
212         "//ppapi/nacl_irt/plugin_main.h",
213         "//ppapi/nacl_irt/plugin_startup.cc",
214         "//ppapi/nacl_irt/plugin_startup.h",
215         "//ppapi/nacl_irt/ppapi_dispatcher.cc",
216         "//ppapi/nacl_irt/ppapi_dispatcher.h",
217         "loader/nonsfi/abi_conversion.cc",
218         "loader/nonsfi/abi_conversion.h",
219         "loader/nonsfi/elf_loader.cc",
220         "loader/nonsfi/elf_loader.h",
221         "loader/nonsfi/irt_basic.cc",
222         "loader/nonsfi/irt_clock.cc",
223         "loader/nonsfi/irt_exception_handling.cc",
224         "loader/nonsfi/irt_fdio.cc",
225         "loader/nonsfi/irt_futex.cc",
226         "loader/nonsfi/irt_icache.cc",
227         "loader/nonsfi/irt_interfaces.cc",
228         "loader/nonsfi/irt_interfaces.h",
229         "loader/nonsfi/irt_memory.cc",
230         "loader/nonsfi/irt_ppapi.cc",
231         "loader/nonsfi/irt_random.cc",
232         "loader/nonsfi/irt_resource_open.cc",
233         "loader/nonsfi/irt_thread.cc",
234         "loader/nonsfi/irt_util.h",
235         "loader/nonsfi/nonsfi_listener.cc",
236         "loader/nonsfi/nonsfi_listener.h",
237         "loader/nonsfi/nonsfi_main.cc",
238         "loader/nonsfi/nonsfi_main.h",
239         "loader/nonsfi/nonsfi_sandbox.cc",
240         "loader/nonsfi/nonsfi_sandbox.h",
241         "loader/sandbox_linux/nacl_bpf_sandbox_linux.cc",
242         "loader/sandbox_linux/nacl_sandbox_linux.cc",
243       ]
245       defines = [ "IN_NACL_HELPER=1" ]
247       deps = [
248         ":nacl",
249         ":nacl_common",
250         ":nacl_switches",
251         "//base",
252         "//components/tracing",
253         "//content/public/common",
254         "//crypto",
255         "//ipc",
256         "//ppapi/c",
257         "//ppapi/proxy",
258         "//ppapi/shared_impl",
259         "//sandbox",
260         "//sandbox/linux:sandbox_services_headers",
261       ]
263       if (use_glib) {
264         configs += [ "//build/config/linux:glib" ]
265       }
267       if (use_seccomp_bpf) {
268         defines += [ "USE_SECCOMP_BPF" ]
269       }
270     }
271   }
272 } else {
273   group("nacl") {
274   }
277 source_set("nacl_switches") {
278   sources = [
279     "common/nacl_switches.cc",
280     "common/nacl_switches.h",
281   ]
284 source_set("nacl_common") {
285   sources = [
286     "common/nacl_cmd_line.cc",
287     "common/nacl_cmd_line.h",
288     "common/nacl_constants.cc",
289     "common/nacl_constants.h",
290     "common/nacl_host_messages.cc",
291     "common/nacl_host_messages.h",
292     "common/nacl_messages.cc",
293     "common/nacl_messages.h",
294     "common/nacl_nonsfi_util.cc",
295     "common/nacl_nonsfi_util.h",
296     "common/nacl_process_type.h",
297     "common/nacl_renderer_messages.cc",
298     "common/nacl_renderer_messages.h",
299     "common/nacl_sandbox_type.h",
300     "common/nacl_types.cc",
301     "common/nacl_types.h",
302     "common/nacl_types_param_traits.cc",
303     "common/nacl_types_param_traits.h",
304     "common/pnacl_types.cc",
305     "common/pnacl_types.h",
306   ]
308   deps = [
309     ":nacl_switches",
310     "//base",
311     "//content/public/common",
312     "//ipc",
313     "//url",
314   ]
316   if (is_linux) {
317     sources += [
318       "common/nacl_paths.cc",
319       "common/nacl_paths.h",
320     ]
322     defines = [ "__STDC_LIMIT_MACROS=1" ]
323   }