Vectorize website settings icons in omnibox
[chromium-blink-merge.git] / ppapi / native_client / src / untrusted / pnacl_support_extension / BUILD.gn
bloba2160889d9eaa727f65a91370b9e0fe543251765
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.
5 import("//build/config/features.gni")
7 if (enable_nacl && enable_nacl_untrusted && enable_pnacl) {
8   # We could use 'copies', but we want to rename the files
9   # in a white-listed way first.  Thus use an action.
10   action("pnacl_support_extension") {
11     script = "pnacl_component_crx_gen.py"
12     inputs = [
13       "//native_client/build/package_version/package_version.py",
14       "//native_client/pnacl/driver/pnacl_info_template.json",
15       "//native_client/toolchain_revisions/pnacl_translator.json",
16     ]
17     shim_target_dir = "//ppapi/native_client/src/untrusted/pnacl_irt_shim/"
18     shim_target_out_dir =
19         rebase_path(get_path_info(shim_target_dir, "out_dir"), root_build_dir)
20     src_shim_name = "libpnacl_irt_shim_browser.a"
21     desired_shim_name = "libpnacl_irt_shim.a"
22     shim_target_label = "$shim_target_dir:browser"
24     # Use the IRT toolchain to build the shim. We want similar properties
25     # (x86-64 sandbox base address hiding). One thing we don't want is the
26     # IRT's secondary TLS, but that is handled by tls_edit and not compiler
27     # flags (so IRT compiler flags should be fine).
28     shim_toolchain_base = "//native_client/build/toolchain/nacl:irt_"
29     shim_target_tc_label = "$shim_target_label($shim_toolchain_base$target_cpu)"
30     deps = [
31       shim_target_tc_label,
32     ]
34     # Figure out the path of the shim library that we depend upon.
35     # TODO(jvoung): change this to:
36     #   lib_path = rebase_path(
37     #      get_label_info(shim_target_tc_label, "target_out_dir"),
38     #      root_build_dir)
39     # once https://crbug.com/524587 is fixed.
40     # For now, look up the root_out_dir and concatenate the out_dir on top
41     # of that manually.
42     shim_toolchain_root_out =
43         get_label_info(shim_target_tc_label, "root_out_dir")
44     lib_path = rebase_path(
45             "$shim_toolchain_root_out/$shim_target_out_dir/$src_shim_name",
46             root_build_dir)
47     shim_override_args = [
48       "--lib_override",
49       "$target_cpu,$lib_path,$desired_shim_name",
50     ]
52     output_prefix = "$root_out_dir/pnacl/pnacl_public_"
53     outputs = [
54       "${output_prefix}pnacl_json",
55     ]
57     # Files that will be copied from the toolchain to output.
58     outputs_from_toolchain = [
59       "crtbegin_o",
60       "crtend_o",
61       "ld_nexe",
62       "libcrt_platform_a",
63       "libgcc_a",
64       "libpnacl_irt_shim_a",
65       "pnacl_llc_nexe",
66     ]
67     if (target_cpu == "arm") {
68       foreach(output_elem, outputs_from_toolchain) {
69         outputs += [ output_prefix + "arm_" + output_elem ]
70       }
71     } else if (target_cpu == "mipsel") {
72       foreach(output_elem, outputs_from_toolchain) {
73         outputs += [ output_prefix + "mips32_" + output_elem ]
74       }
75     } else if (target_cpu == "x86") {
76       foreach(output_elem, outputs_from_toolchain) {
77         outputs += [ output_prefix + "x86_32_" + output_elem ]
78       }
80       # On Windows, for offline testing (i.e., without component updater
81       # selecting the platform-specific files with multi-CRXes), we need
82       # to stage both x86-32 and x86-64 (because 32-bit chrome on 64-bit
83       # windows will need 64-bit nexes).
84       if (is_win) {
85         foreach(output_elem, outputs_from_toolchain) {
86           outputs += [ output_prefix + "x86_64_" + output_elem ]
87         }
88         shim_target_tc_x64_label =
89             "$shim_target_label(${shim_toolchain_base}x64)"
90         deps += [ shim_target_tc_x64_label ]
92         # TODO(jvoung): change this to:
93         #   lib_x64_path = rebase_path(
94         #      get_label_info(shim_target_tc_x64_label, "target_out_dir"),
95         #      root_build_dir)
96         # once https://crbug.com/524587 is fixed.
97         # For now, look up the root_out_dir and concatenate the out_dir on top
98         # of that manually.
99         shim_toolchain_x64_root_out =
100             get_label_info(shim_target_tc_x64_label, "root_out_dir")
101         lib_x64_path = rebase_path(
102                 "$shim_toolchain_x64_root_out/$shim_target_out_dir/$src_shim_name",
103                 root_build_dir)
104         shim_override_args = [
105           "--lib_override",
106           "x64,$lib_x64_path,$desired_shim_name",
107         ]
108       }
109     } else if (target_cpu == "x64") {
110       foreach(output_elem, outputs_from_toolchain) {
111         outputs += [ output_prefix + "x86_64_" + output_elem ]
112       }
113     } else {
114       assert(false, "unhandled target_cpu")
115     }
116     args = [
117       "--dest",
118       rebase_path("$root_out_dir/pnacl", root_build_dir),
119     ]
120     args += shim_override_args
122     args += [
123       "--target_arch",
124       target_cpu,
125       "--info_template_path",
126       rebase_path("//native_client/pnacl/driver/pnacl_info_template.json",
127                   root_build_dir),
128       "--pnacl_translator_path",
129       rebase_path(
130           "//native_client/toolchain/${current_os}_x86/pnacl_translator",
131           root_build_dir),
132       "--package_version_path",
133       rebase_path("//native_client/build/package_version/package_version.py",
134                   root_build_dir),
135       "--pnacl_package_name",
136       "pnacl_translator",
138       # ABI Version Number
139       "1",
140     ]
141   }