OLD | NEW |
1 # Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import("//mojo/public/mojo_application.gni") | 5 import("//mojo/public/mojo_application.gni") |
| 6 import("//mojo/public/tools/bindings/mojom.gni") |
6 | 7 |
7 # Trusted code | 8 # Trusted code |
8 if (!is_nacl) { | 9 if (!is_nacl) { |
9 mojo_native_application("nacl_content_handler") { | 10 mojo_native_application("content_handler_sfi") { |
10 sources = [ | 11 sources = [ |
11 "content_handler_main.cc", | 12 "content_handler_main.cc", |
12 ] | 13 ] |
13 | 14 |
14 deps = [ | 15 deps = [ |
15 "//base", | 16 "//base", |
16 "//mojo/application:application", | 17 "//mojo/application:application", |
17 "//mojo/application:content_handler", | 18 "//mojo/application:content_handler", |
18 "//mojo/data_pipe_utils", | 19 "//mojo/data_pipe_utils", |
19 "//mojo/message_pump", | 20 "//mojo/message_pump", |
20 "//mojo/public/platform/native:system_impl_private", | 21 "//mojo/public/platform/native:system_impl_private", |
21 "//mojo/services/network/interfaces", | 22 "//mojo/services/network/interfaces", |
22 "//mojo/nacl/sfi/nacl_bindings:monacl_sel", | 23 "//mojo/nacl/sfi/nacl_bindings:monacl_sel", |
23 "//url", | 24 "//url", |
24 ] | 25 ] |
25 | 26 |
26 data_deps = [ | 27 data_deps = [ |
27 "//mojo/nacl/sfi/nacl_bindings:irt_mojo(//build/toolchain/nacl:irt_${targe
t_cpu})", | 28 "//mojo/nacl/sfi/nacl_bindings:irt_mojo(//build/toolchain/nacl:irt_${targe
t_cpu})", |
28 ] | 29 ] |
29 } | 30 } |
30 | 31 |
31 if (current_cpu == "x86" || current_cpu == "arm") { | 32 if (current_cpu == "x86" || current_cpu == "arm") { |
32 # Non-SFI NaCl can only be executed by a 32-bit process, so our | 33 # Non-SFI NaCl can only be executed by a 32-bit process, so our |
33 # content handler must be built and launched as a 32-bit process as well. | 34 # content handler must be built and launched as a 32-bit process as well. |
34 mojo_native_application("nacl_content_handler_nonsfi_32_bit") { | 35 mojo_native_application("content_handler_nonsfi_32_bit") { |
| 36 output_name = "content_handler_nonsfi_nexe" |
35 sources = [ | 37 sources = [ |
36 "content_handler_main_nonsfi.cc", | 38 "content_handler_main_nonsfi.cc", |
37 ] | 39 ] |
38 | 40 |
39 deps = [ | 41 deps = [ |
40 "//base", | 42 "//base", |
41 "//mojo/application:application", | 43 "//mojo/application:application", |
42 "//mojo/application:content_handler", | 44 "//mojo/application:content_handler", |
43 "//mojo/data_pipe_utils", | 45 "//mojo/data_pipe_utils", |
44 "//mojo/public/platform/native:mgl_thunks", | |
45 "//mojo/public/platform/native:mgl_onscreen_thunks", | |
46 "//mojo/message_pump", | 46 "//mojo/message_pump", |
47 "//mojo/nacl/nonsfi:irt_mojo_nonsfi", | 47 "//mojo/nacl/nonsfi:irt_mojo_nonsfi", |
48 "//mojo/public/cpp/application:application", | 48 "//mojo/public/cpp/application:application", |
49 "//native_client/src/nonsfi/loader:elf_loader", | 49 "//native_client/src/nonsfi/loader:elf_loader", |
50 ] | 50 ] |
51 } | 51 } |
| 52 mojo_native_application("content_handler_nonsfi_pexe_32_bit") { |
| 53 output_name = "content_handler_nonsfi_pexe" |
| 54 sources = [ |
| 55 "content_handler_main_nonsfi_pexe.cc", |
| 56 ] |
| 57 |
| 58 deps = [ |
| 59 ":pnacl_translator_bindings", |
| 60 "//base", |
| 61 "//mojo/application:application", |
| 62 "//mojo/application:content_handler", |
| 63 "//mojo/data_pipe_utils", |
| 64 "//mojo/message_pump", |
| 65 "//mojo/nacl/nonsfi:irt_mojo_nonsfi", |
| 66 "//mojo/services/files/c:mojio", |
| 67 "//native_client/src/nonsfi/loader:elf_loader", |
| 68 ] |
| 69 } |
| 70 mojo_native_application("pnacl_compile_32_bit") { |
| 71 output_name = "pnacl_compile" |
| 72 sources = [ |
| 73 "pnacl_compile.cc", |
| 74 ] |
| 75 |
| 76 deps = [ |
| 77 ":pnacl_translator_bindings", |
| 78 "//base", |
| 79 "//mojo/nacl/nonsfi:irt_mojo_nonsfi", |
| 80 "//mojo/public/cpp/application:standalone", |
| 81 "//native_client/src/nonsfi/loader:elf_loader", |
| 82 ] |
| 83 } |
| 84 mojo_native_application("pnacl_link_32_bit") { |
| 85 output_name = "pnacl_link" |
| 86 sources = [ |
| 87 "pnacl_link.cc", |
| 88 ] |
| 89 |
| 90 deps = [ |
| 91 ":pnacl_translator_bindings", |
| 92 "//base", |
| 93 "//mojo/nacl/nonsfi:irt_mojo_nonsfi", |
| 94 "//mojo/public/cpp/application:standalone", |
| 95 "//native_client/src/nonsfi/loader:elf_loader", |
| 96 ] |
| 97 } |
| 98 |
| 99 # Copy all files necessary for pnacl translation into the output directory. |
| 100 copy("pnacl_translation_files") { |
| 101 file_location_prefix = "//native_client/toolchain/linux_x86/pnacl_translat
or/translator/x86-32-nonsfi" |
| 102 sources = [ |
| 103 "${file_location_prefix}/bin/ld.nexe", |
| 104 "${file_location_prefix}/bin/pnacl-llc.nexe", |
| 105 "${file_location_prefix}/lib/crtbegin.o", |
| 106 "${file_location_prefix}/lib/crtbegin_for_eh.o", |
| 107 "${file_location_prefix}/lib/crtend.o", |
| 108 "${file_location_prefix}/lib/libcrt_platform.a", |
| 109 "${file_location_prefix}/lib/libgcc.a", |
| 110 "${file_location_prefix}/lib/libpnacl_irt_shim_dummy.a", |
| 111 ] |
| 112 outputs = [ |
| 113 "${root_build_dir}/pnacl_translation_files/{{source_file_part}}", |
| 114 ] |
| 115 } |
52 | 116 |
53 # Copy to the root build directory so that the '#!' prefix line for invoking | 117 # Copy to the root build directory so that the '#!' prefix line for invoking |
54 # our content handler can simply be "mojo:nacl_content_handler_nonsfi". | 118 # our content handler can simply be "mojo:content_handler_nonsfi". |
55 copy("nacl_content_handler_nonsfi_copy") { | 119 # Either way, build the same dependencies. |
56 sources = [ | 120 shared_deps = [ |
57 "${root_out_dir}/nacl_content_handler_nonsfi_32_bit.mojo", | 121 ":content_handler_nonsfi_32_bit", |
58 ] | 122 ":content_handler_nonsfi_pexe_32_bit", |
59 outputs = [ | 123 ":pnacl_compile_32_bit", |
60 "${root_build_dir}/nacl_content_handler_nonsfi.mojo", | 124 ":pnacl_link_32_bit", |
61 ] | 125 ":pnacl_translation_files", |
62 deps = [ | 126 ] |
63 ":nacl_content_handler_nonsfi_32_bit", | 127 if (root_out_dir != root_build_dir) { |
64 ] | 128 copy("content_handler_nonsfi_copy") { |
| 129 sources = [ |
| 130 "${root_out_dir}/content_handler_nonsfi_nexe.mojo", |
| 131 "${root_out_dir}/content_handler_nonsfi_pexe.mojo", |
| 132 "${root_out_dir}/pnacl_compile.mojo", |
| 133 "${root_out_dir}/pnacl_link.mojo", |
| 134 ] |
| 135 outputs = [ |
| 136 "${root_build_dir}/{{source_file_part}}", |
| 137 ] |
| 138 deps = shared_deps |
| 139 } |
| 140 } else { |
| 141 group("content_handler_nonsfi_copy") { |
| 142 deps = shared_deps |
| 143 } |
65 } | 144 } |
66 } | 145 } |
67 } | 146 } |
68 | 147 |
69 # This group serves as a 64 to 32 bit transformation for Linux. If we are | 148 # This group serves as a 64 to 32 bit transformation for Linux. If we are |
70 # using a 64 bit toolchain, build the nonsfi nacl content handler as 32 bit. | 149 # using a 64 bit toolchain, build the nonsfi nacl content handler as 32 bit. |
71 group("nacl_content_handler_nonsfi") { | 150 group("content_handler_nonsfi") { |
72 deps = [] | 151 deps = [] |
73 if ((target_cpu == "x64" || target_cpu == "x86") && is_linux) { | 152 if ((target_cpu == "x64" || target_cpu == "x86") && is_linux) { |
74 # The toolchain is hardcoded as 32-bit clang here -- although it must | 153 # The toolchain is hardcoded as 32-bit clang here -- although it must |
75 # be 32 bit (for nonsfi), it assumes clang. Ideally, the toolchain would | 154 # be 32 bit (for nonsfi), it assumes clang. Ideally, the toolchain would |
76 # be defined as the 32 bit variant of whatever is being used (be it clang, | 155 # be defined as the 32 bit variant of whatever is being used (be it clang, |
77 # gcc, or something else). | 156 # gcc, or something else). |
78 deps += [ ":nacl_content_handler_nonsfi_copy(//build/toolchain/linux:clang_x
86)" ] | 157 deps += |
| 158 [ ":content_handler_nonsfi_copy(//build/toolchain/linux:clang_x86)" ] |
79 } else { | 159 } else { |
80 deps += [ ":nacl_content_handler_nonsfi_copy" ] | 160 deps += [ ":content_handler_nonsfi_copy" ] |
81 } | 161 } |
82 } | 162 } |
| 163 |
| 164 mojom("pnacl_translator_bindings") { |
| 165 sources = [ |
| 166 "pnacl_compile.mojom", |
| 167 "pnacl_link.mojom", |
| 168 ] |
| 169 } |
OLD | NEW |