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", | |
81 "//mojo/public/cpp/application:standalone", | |
82 "//native_client/src/nonsfi/loader:elf_loader", | |
83 "//url", | |
84 ] | |
85 } | |
86 mojo_native_application("pnacl_link_32_bit") { | |
87 output_name = "pnacl_link" | |
88 sources = [ | |
89 "pnacl_link.cc", | |
90 ] | |
91 | |
92 deps = [ | |
93 ":pnacl_translator_bindings", | |
94 "//base", | |
95 "//mojo/nacl/nonsfi:irt_mojo_nonsfi", | |
96 "//mojo/public/cpp/application", | |
97 "//mojo/public/cpp/application:standalone", | |
98 "//native_client/src/nonsfi/loader:elf_loader", | |
99 "//url", | |
100 ] | |
101 } | |
102 | |
103 # Copy all files necessary for pnacl translation into the output directory. | |
104 copy("pnacl_translation_files") { | |
105 file_location_prefix = "//native_client/toolchain/linux_x86/pnacl_translat or/translator/x86-32-nonsfi" | |
106 sources = [ | |
107 "${file_location_prefix}/bin/ld.nexe", | |
108 "${file_location_prefix}/bin/pnacl-llc.nexe", | |
109 "${file_location_prefix}/lib/crtbegin.o", | |
110 "${file_location_prefix}/lib/crtbegin_for_eh.o", | |
111 "${file_location_prefix}/lib/crtend.o", | |
112 "${file_location_prefix}/lib/libcrt_platform.a", | |
113 "${file_location_prefix}/lib/libgcc.a", | |
114 "${file_location_prefix}/lib/libpnacl_irt_shim_dummy.a", | |
115 ] | |
116 outputs = [ | |
117 "${root_build_dir}/pnacl_translation_files/{{source_file_part}}", | |
118 ] | |
119 } | |
52 | 120 |
53 # Copy to the root build directory so that the '#!' prefix line for invoking | 121 # 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". | 122 # our content handler can simply be "mojo:content_handler_nonsfi". |
55 copy("nacl_content_handler_nonsfi_copy") { | 123 # Either way, build the same dependencies. |
56 sources = [ | 124 shared_deps = [ |
57 "${root_out_dir}/nacl_content_handler_nonsfi_32_bit.mojo", | 125 ":content_handler_nonsfi_32_bit", |
58 ] | 126 ":content_handler_nonsfi_pexe_32_bit", |
59 outputs = [ | 127 ":pnacl_compile_32_bit", |
60 "${root_build_dir}/nacl_content_handler_nonsfi.mojo", | 128 ":pnacl_link_32_bit", |
61 ] | 129 ":pnacl_translation_files", |
62 deps = [ | 130 ] |
63 ":nacl_content_handler_nonsfi_32_bit", | 131 if (root_out_dir != root_build_dir) { |
64 ] | 132 copy("content_handler_nonsfi_copy") { |
133 print(rebase_path("//")) | |
Mark Seaborn
2015/10/28 18:31:43
Is this debugging code you forgot to take out?
Sean Klein
2015/10/28 21:39:59
Yup. Deleted.
| |
134 sources = [ | |
135 "${root_out_dir}/content_handler_nonsfi_nexe.mojo", | |
136 "${root_out_dir}/content_handler_nonsfi_pexe.mojo", | |
137 "${root_out_dir}/pnacl_compile.mojo", | |
138 "${root_out_dir}/pnacl_link.mojo", | |
139 ] | |
140 outputs = [ | |
141 "${root_build_dir}/{{source_file_part}}", | |
142 ] | |
143 deps = shared_deps | |
144 } | |
145 } else { | |
146 group("content_handler_nonsfi_copy") { | |
147 deps = shared_deps | |
148 } | |
65 } | 149 } |
66 } | 150 } |
67 } | 151 } |
68 | 152 |
69 # This group serves as a 64 to 32 bit transformation for Linux. If we are | 153 # 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. | 154 # using a 64 bit toolchain, build the nonsfi nacl content handler as 32 bit. |
71 group("nacl_content_handler_nonsfi") { | 155 group("content_handler_nonsfi") { |
72 deps = [] | 156 deps = [] |
73 if ((target_cpu == "x64" || target_cpu == "x86") && is_linux) { | 157 if ((target_cpu == "x64" || target_cpu == "x86") && is_linux) { |
74 # The toolchain is hardcoded as 32-bit clang here -- although it must | 158 # 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 | 159 # 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, | 160 # be defined as the 32 bit variant of whatever is being used (be it clang, |
77 # gcc, or something else). | 161 # gcc, or something else). |
78 deps += [ ":nacl_content_handler_nonsfi_copy(//build/toolchain/linux:clang_x 86)" ] | 162 deps += |
163 [ ":content_handler_nonsfi_copy(//build/toolchain/linux:clang_x86)" ] | |
79 } else { | 164 } else { |
80 deps += [ ":nacl_content_handler_nonsfi_copy" ] | 165 deps += [ ":content_handler_nonsfi_copy" ] |
81 } | 166 } |
82 } | 167 } |
168 | |
169 mojom("pnacl_translator_bindings") { | |
170 sources = [ | |
171 "pnacl_compile.mojom", | |
172 "pnacl_link.mojom", | |
173 ] | |
174 } | |
OLD | NEW |