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 # This target copies files from the prebuilt/DEPS'ed in pnacl_translator
9 # toolchain and copies the latest PNaCl IRT shim library.
10 # We could use 'copies', but we want to rename the files in a white-listed
11 # way first. Thus use an action.
12 action("pnacl_support_extension") {
13 script = "pnacl_component_crx_gen.py"
15 "//native_client/build/package_version/package_version.py",
16 "//native_client/pnacl/driver/pnacl_info_template.json",
17 "//native_client/toolchain_revisions/pnacl_translator.json",
20 "//ppapi/native_client/src/untrusted/pnacl_irt_shim:browser"
21 src_shim_name = "libpnacl_irt_shim_browser.a"
22 desired_shim_name = "libpnacl_irt_shim.a"
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 = "//build/toolchain/nacl:irt_"
30 shim_target_tc_label = "$shim_target_label($shim_toolchain_base$target_cpu)"
35 rebase_path(get_label_info(shim_target_tc_label, "target_out_dir") +
38 shim_override_args = [
40 "$target_cpu,$shim_lib_path,$desired_shim_name",
43 output_prefix = "$root_out_dir/pnacl/pnacl_public_"
45 "${output_prefix}pnacl_json",
48 # Files that will be copied from the toolchain to output.
49 outputs_from_toolchain = [
55 "libpnacl_irt_shim_a",
58 if (target_cpu == "arm") {
59 foreach(output_elem, outputs_from_toolchain) {
60 outputs += [ output_prefix + "arm_" + output_elem ]
62 } else if (target_cpu == "mipsel") {
63 foreach(output_elem, outputs_from_toolchain) {
64 outputs += [ output_prefix + "mips32_" + output_elem ]
66 } else if (target_cpu == "x86") {
67 foreach(output_elem, outputs_from_toolchain) {
68 outputs += [ output_prefix + "x86_32_" + output_elem ]
71 # On Windows, for offline testing (i.e., without component updater
72 # selecting the platform-specific files with multi-CRXes), we need
73 # to stage both x86-32 and x86-64 (because 32-bit chrome on 64-bit
74 # windows will need 64-bit nexes).
76 foreach(output_elem, outputs_from_toolchain) {
77 outputs += [ output_prefix + "x86_64_" + output_elem ]
79 shim_target_tc_x64_label =
80 "$shim_target_label(${shim_toolchain_base}x64)"
81 deps += [ shim_target_tc_x64_label ]
83 rebase_path(get_label_info(shim_target_tc_x64_label,
84 "target_out_dir") + "/$src_shim_name",
86 shim_override_args = [
88 "x64,$shim_lib_x64_path,$desired_shim_name",
91 } else if (target_cpu == "x64") {
92 foreach(output_elem, outputs_from_toolchain) {
93 outputs += [ output_prefix + "x86_64_" + output_elem ]
96 assert(false, "unhandled target_cpu")
100 rebase_path("$root_out_dir/pnacl", root_build_dir),
102 args += shim_override_args
107 "--info_template_path",
108 rebase_path("//native_client/pnacl/driver/pnacl_info_template.json",
110 "--pnacl_translator_path",
112 "//native_client/toolchain/${current_os}_x86/pnacl_translator",
114 "--package_version_path",
115 rebase_path("//native_client/build/package_version/package_version.py",
117 "--pnacl_package_name",