Roll src/third_party/WebKit f298044:aa8346d (svn 202628:202629)
[chromium-blink-merge.git] / components / nacl / BUILD.gn
blobdbc32ee935029acfdfc8bf99ea13e57848f9781c
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 = [ "//ppapi/native_client:irt" ]
46     }
47     if (enable_pnacl) {
48       data_deps +=
49           [ "//ppapi/native_client/src/untrusted/pnacl_support_extension" ]
50     }
51   }
53   source_set("nacl_browser") {
54     sources = [
55       "browser/bad_message.cc",
56       "browser/bad_message.h",
57       "browser/nacl_broker_host_win.cc",
58       "browser/nacl_broker_host_win.h",
59       "browser/nacl_broker_service_win.cc",
60       "browser/nacl_broker_service_win.h",
61       "browser/nacl_browser.cc",
62       "browser/nacl_browser.h",
63       "browser/nacl_file_host.cc",
64       "browser/nacl_file_host.h",
65       "browser/nacl_host_message_filter.cc",
66       "browser/nacl_host_message_filter.h",
67       "browser/nacl_process_host.cc",
68       "browser/nacl_process_host.h",
69       "browser/nacl_validation_cache.cc",
70       "browser/nacl_validation_cache.h",
71       "browser/pnacl_host.cc",
72       "browser/pnacl_host.h",
73       "browser/pnacl_translation_cache.cc",
74       "browser/pnacl_translation_cache.h",
75       "common/nacl_debug_exception_handler_win.cc",
76       "common/nacl_debug_exception_handler_win.h",
77     ]
79     deps = [
80       ":nacl_common",
81       ":nacl_switches",
82       ":nacl_helper",
83       "//base",
84       "//base/third_party/dynamic_annotations",
85       "//content/public/browser",
86       "//content/public/common",
87       "//ipc",
88       "//native_client/src/trusted/service_runtime:sel_main_chrome",
89       "//net",
90       "//ppapi/host",
91       "//ppapi/proxy:ipc",
92       "//ppapi/shared_impl",
93       "//sandbox/linux:sandbox_services",
94     ]
96     if (is_linux) {
97       sources += [
98         "zygote/nacl_fork_delegate_linux.cc",
99         "zygote/nacl_fork_delegate_linux.h",
100       ]
102       deps += [ "//sandbox/linux:suid_sandbox_client" ]
103     }
104   }
106   source_set("nacl_renderer") {
107     sources = [
108       "renderer/file_downloader.cc",
109       "renderer/file_downloader.h",
110       "renderer/histogram.cc",
111       "renderer/histogram.h",
112       "renderer/json_manifest.cc",
113       "renderer/json_manifest.h",
114       "renderer/manifest_downloader.cc",
115       "renderer/manifest_downloader.h",
116       "renderer/manifest_service_channel.cc",
117       "renderer/manifest_service_channel.h",
118       "renderer/nacl_helper.cc",
119       "renderer/nacl_helper.h",
120       "renderer/nexe_load_manager.cc",
121       "renderer/nexe_load_manager.h",
122       "renderer/platform_info.cc",
123       "renderer/platform_info.h",
124       "renderer/pnacl_translation_resource_host.cc",
125       "renderer/pnacl_translation_resource_host.h",
126       "renderer/ppb_nacl_private_impl.cc",
127       "renderer/ppb_nacl_private_impl.h",
128       "renderer/progress_event.cc",
129       "renderer/progress_event.h",
130       "renderer/trusted_plugin_channel.cc",
131       "renderer/trusted_plugin_channel.h",
132     ]
134     deps = [
135       ":nacl_common",
136       ":nacl_switches",
137       "renderer/plugin:nacl_trusted_plugin",
138       "//base",
139       "//content/public/common",
140       "//content/public/renderer",
141       "//ipc",
142       "//net",
143       "//ppapi/c",
144       "//ppapi/proxy:ipc",
145       "//ppapi/shared_impl",
146       "//third_party/WebKit/public:blink",
147     ]
148   }
150   # TODO(GYP): Delete this after we've converted everything to GN.
151   # The _run targets exist only for compatibility w/ GYP.
152   group("nacl_loader_unittests_run") {
153     testonly = true
154     deps = [
155       ":nacl_loader_unittests",
156     ]
157   }
159   test("nacl_loader_unittests") {
160     sources = [
161       "loader/nacl_ipc_adapter_unittest.cc",
162       "loader/nacl_validation_query_unittest.cc",
163       "loader/run_all_unittests.cc",
164     ]
166     deps = [
167       ":nacl",
168       "//base/test:test_support",
169       "//ipc:test_support",
170       "//testing/gtest",
171     ]
172   }
174   if (is_linux) {
175     executable("nacl_helper") {
176       sources = [
177         "loader/nacl_helper_linux.cc",
178         "loader/nacl_helper_linux.h",
179       ]
181       deps = [
182         ":nacl",
183         ":nacl_linux",
184         ":nacl_switches",
185         "//base",
186         "//build/config/sanitizers:deps",
187         "//content/public/common",
188         "//crypto",
189         "//ipc",
190       ]
192       cflags = [ "-fPIE" ]
194       ldflags = [ "-pie" ]
196       if (!use_openssl) {
197         deps += [ "//sandbox/linux:libc_urandom_override" ]
198       }
199     }
201     source_set("nacl_linux") {
202       sources = [
203         "//ppapi/nacl_irt/irt_manifest.h",
204         "//ppapi/nacl_irt/manifest_service.cc",
205         "//ppapi/nacl_irt/manifest_service.h",
206         "//ppapi/nacl_irt/plugin_main.cc",
207         "//ppapi/nacl_irt/plugin_main.h",
208         "//ppapi/nacl_irt/plugin_startup.cc",
209         "//ppapi/nacl_irt/plugin_startup.h",
210         "//ppapi/nacl_irt/ppapi_dispatcher.cc",
211         "//ppapi/nacl_irt/ppapi_dispatcher.h",
212         "loader/nonsfi/abi_conversion.cc",
213         "loader/nonsfi/abi_conversion.h",
214         "loader/nonsfi/elf_loader.cc",
215         "loader/nonsfi/elf_loader.h",
216         "loader/nonsfi/irt_basic.cc",
217         "loader/nonsfi/irt_clock.cc",
218         "loader/nonsfi/irt_exception_handling.cc",
219         "loader/nonsfi/irt_fdio.cc",
220         "loader/nonsfi/irt_futex.cc",
221         "loader/nonsfi/irt_icache.cc",
222         "loader/nonsfi/irt_interfaces.cc",
223         "loader/nonsfi/irt_interfaces.h",
224         "loader/nonsfi/irt_memory.cc",
225         "loader/nonsfi/irt_ppapi.cc",
226         "loader/nonsfi/irt_random.cc",
227         "loader/nonsfi/irt_resource_open.cc",
228         "loader/nonsfi/irt_thread.cc",
229         "loader/nonsfi/irt_util.h",
230         "loader/nonsfi/nonsfi_listener.cc",
231         "loader/nonsfi/nonsfi_listener.h",
232         "loader/nonsfi/nonsfi_main.cc",
233         "loader/nonsfi/nonsfi_main.h",
234         "loader/nonsfi/nonsfi_sandbox.cc",
235         "loader/nonsfi/nonsfi_sandbox.h",
236         "loader/sandbox_linux/nacl_bpf_sandbox_linux.cc",
237         "loader/sandbox_linux/nacl_sandbox_linux.cc",
238       ]
240       defines = [ "IN_NACL_HELPER=1" ]
242       deps = [
243         ":nacl",
244         ":nacl_common",
245         ":nacl_switches",
246         "//base",
247         "//components/tracing",
248         "//content/public/common",
249         "//crypto",
250         "//ipc",
251         "//ppapi/c",
252         "//ppapi/proxy",
253         "//ppapi/shared_impl",
254         "//sandbox",
255         "//sandbox/linux:sandbox_services_headers",
256       ]
258       if (use_glib) {
259         configs += [ "//build/config/linux:glib" ]
260       }
262       if (use_seccomp_bpf) {
263         defines += [ "USE_SECCOMP_BPF" ]
264       }
265     }
266   }
267 } else {
268   group("nacl") {
269   }
270   group("nacl_helper") {
271   }
274 source_set("nacl_switches") {
275   sources = [
276     "common/nacl_switches.cc",
277     "common/nacl_switches.h",
278   ]
281 source_set("nacl_common") {
282   sources = [
283     "common/nacl_cmd_line.cc",
284     "common/nacl_cmd_line.h",
285     "common/nacl_constants.cc",
286     "common/nacl_constants.h",
287     "common/nacl_host_messages.cc",
288     "common/nacl_host_messages.h",
289     "common/nacl_messages.cc",
290     "common/nacl_messages.h",
291     "common/nacl_nonsfi_util.cc",
292     "common/nacl_nonsfi_util.h",
293     "common/nacl_process_type.h",
294     "common/nacl_renderer_messages.cc",
295     "common/nacl_renderer_messages.h",
296     "common/nacl_sandbox_type.h",
297     "common/nacl_types.cc",
298     "common/nacl_types.h",
299     "common/nacl_types_param_traits.cc",
300     "common/nacl_types_param_traits.h",
301     "common/pnacl_types.cc",
302     "common/pnacl_types.h",
303   ]
305   deps = [
306     ":nacl_switches",
307     "//base",
308     "//content/public/common",
309     "//ipc",
310     "//url",
311   ]
313   if (is_linux) {
314     sources += [
315       "common/nacl_paths.cc",
316       "common/nacl_paths.h",
317     ]
319     defines = [ "__STDC_LIMIT_MACROS=1" ]
320   }