| 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 # Trusted code | |
| 6 if (!is_nacl) { | |
| 7 # A simple shell for running untrusted binaries that talk to the Mojo | |
| 8 # embedder. (No services.) | |
| 9 executable("monacl_shell") { | |
| 10 testonly = true | |
| 11 sources = [ | |
| 12 "monacl_shell.cc", | |
| 13 ] | |
| 14 deps = [ | |
| 15 "//base:base", | |
| 16 "//mojo/edk/system:system", | |
| 17 "//nacl_bindings:monacl_sel", | |
| 18 ] | |
| 19 | |
| 20 data_deps = | |
| 21 [ "//nacl_bindings:irt_mojo(//build/toolchain/nacl:irt_${target_cpu})" ] | |
| 22 } | |
| 23 | |
| 24 if (current_cpu == "x86" || current_cpu == "arm") { | |
| 25 # Non-SFI NaCl currently supports x86-32 and ARMv7, but not anything 64-bit. | |
| 26 # Additionally, PNaCl pexes assume 32-bit pointers. | |
| 27 executable("monacl_shell_nonsfi") { | |
| 28 testonly = true | |
| 29 sources = [ | |
| 30 "monacl_shell_nonsfi.cc", | |
| 31 ] | |
| 32 deps = [ | |
| 33 ":irt_mojo_nonsfi", | |
| 34 "//mojo/edk/system", | |
| 35 "//native_client/src/nonsfi/loader:elf_loader", | |
| 36 ] | |
| 37 } | |
| 38 } | |
| 39 } | |
| 40 | |
| 41 group("monacl_shell_nonsfi_x86") { | |
| 42 testonly = true | |
| 43 deps = [] | |
| 44 if ((target_cpu == "x64" || target_cpu == "x86") && is_linux) { | |
| 45 # Even when Mojo is built for x86-64 by default, we want to use x86-32 | |
| 46 # for running programs under Non-SFI NaCl. | |
| 47 # The toolchain is hardcoded as 32-bit clang here -- although it must | |
| 48 # be 32 bit (for nonsfi), it assumes clang. Ideally, the toolchain would | |
| 49 # be defined as the 32 bit variant of whatever is being used (be it clang, | |
| 50 # gcc, or something else). | |
| 51 deps += [ ":monacl_shell_nonsfi(//build/toolchain/linux:clang_x86)" ] | |
| 52 } | |
| 53 } | |
| 54 | |
| 55 # Untrusted code | 5 # Untrusted code |
| 56 if (is_nacl) { | 6 if (is_nacl) { |
| 57 # Unit test for the Mojo public API. | 7 # Unit test for the Mojo public API. |
| 58 executable("monacl_test") { | 8 executable("monacl_test") { |
| 59 testonly = true | 9 testonly = true |
| 60 sources = [ | 10 sources = [ |
| 61 "//mojo/public/cpp/system/tests/core_unittest.cc", | 11 "//mojo/public/cpp/system/tests/core_unittest.cc", |
| 62 "//mojo/public/cpp/system/tests/macros_unittest.cc", | 12 "//mojo/public/cpp/system/tests/macros_unittest.cc", |
| 63 ] | 13 ] |
| 64 deps = [ | 14 deps = [ |
| (...skipping 16 matching lines...) Expand all Loading... |
| 81 "//services/files:apptests", | 31 "//services/files:apptests", |
| 82 "//services/http_server", | 32 "//services/http_server", |
| 83 "//services/http_server:apptests", | 33 "//services/http_server:apptests", |
| 84 "//services/view_manager:mojo_view_manager_client_apptests", | 34 "//services/view_manager:mojo_view_manager_client_apptests", |
| 85 "//services/view_manager:view_manager_service_apptests", | 35 "//services/view_manager:view_manager_service_apptests", |
| 86 "//services/window_manager:window_manager_apptests", | 36 "//services/window_manager:window_manager_apptests", |
| 87 "//shell:apptests", | 37 "//shell:apptests", |
| 88 ] | 38 ] |
| 89 } | 39 } |
| 90 } | 40 } |
| 91 | |
| 92 static_library("irt_mojo_nonsfi") { | |
| 93 sources = [ | |
| 94 "irt_mojo_nonsfi.cc", | |
| 95 "irt_mojo_nonsfi.h", | |
| 96 "nexe_launcher_nonsfi.cc", | |
| 97 ] | |
| 98 | |
| 99 deps = [ | |
| 100 "//base", | |
| 101 "//mojo/public/c/system", | |
| 102 "//mojo/public/platform/nacl:mojo_irt_header", | |
| 103 "//native_client/src/nonsfi/irt:irt_interfaces", | |
| 104 ] | |
| 105 } | |
| 106 | |
| 107 group("mojo_nacl") { | |
| 108 deps = [ | |
| 109 "//services/nacl:nacl_content_handler", | |
| 110 ] | |
| 111 } | |
| 112 | |
| 113 group("mojo_nacl_nonsfi") { | |
| 114 deps = [ | |
| 115 "//services/nacl:nacl_content_handler_nonsfi", | |
| 116 ] | |
| 117 } | |
| 118 | |
| 119 group("mojo_pnacl_tests") { | |
| 120 testonly = true | |
| 121 deps = [ | |
| 122 ":monacl_test(//build/toolchain/nacl:newlib_pnacl)", | |
| 123 ] | |
| 124 } | |
| 125 | |
| 126 action("translate_mojo_pnacl_tests_to_native") { | |
| 127 testonly = true | |
| 128 | |
| 129 # Leaving default as linux for OSes which are similar to linux, but do | |
| 130 # not self-identify as linux through host_os. | |
| 131 nacl_toolchain_host_os = "linux" | |
| 132 if (host_os == "mac") { | |
| 133 nacl_toolchain_host_os = "mac" | |
| 134 } | |
| 135 script = rebase_path("//") + "native_client/toolchain/${nacl_toolchain_host_os
}_x86/pnacl_newlib/bin/pydir/loader.py" | |
| 136 input = rebase_path(root_build_dir) + "/newlib_pnacl/monacl_test.pexe" | |
| 137 inputs = [ | |
| 138 input, | |
| 139 ] | |
| 140 output = "monacl_test_nonsfi.nexe" | |
| 141 outputs = [ | |
| 142 "$root_out_dir/${output}", | |
| 143 ] | |
| 144 args = [ | |
| 145 "pnacl-translate", | |
| 146 "$input", | |
| 147 "-o", | |
| 148 "$output", | |
| 149 "-arch", | |
| 150 ] | |
| 151 if (target_cpu == "x86" || target_cpu == "x64") { | |
| 152 args += [ "x86-32-nonsfi" ] | |
| 153 } else if (target_cpu == "arm") { | |
| 154 args += [ "arm-nonsfi" ] | |
| 155 } else { | |
| 156 assert(false, "Unrecognized target CPU for Non-SFI NaCl translation") | |
| 157 } | |
| 158 deps = [ | |
| 159 ":mojo_pnacl_tests", | |
| 160 ] | |
| 161 } | |
| 162 | |
| 163 action("prepend_shebang_to_nexe") { | |
| 164 testonly = true | |
| 165 | |
| 166 script = rebase_path("//") + "mojo/public/tools/prepend.py" | |
| 167 nexe_path = "$root_out_dir/monacl_test_nonsfi" | |
| 168 input = "${nexe_path}.nexe" | |
| 169 inputs = [ | |
| 170 input, | |
| 171 ] | |
| 172 output = "${nexe_path}.mojo" | |
| 173 outputs = [ | |
| 174 output, | |
| 175 ] | |
| 176 | |
| 177 line = "#!mojo mojo:nacl_content_handler_nonsfi" | |
| 178 args = [ | |
| 179 "--input=" + rebase_path(input, root_build_dir), | |
| 180 "--output=" + rebase_path(output, root_build_dir), | |
| 181 "--line=$line", | |
| 182 ] | |
| 183 deps = [ | |
| 184 ":translate_mojo_pnacl_tests_to_native", | |
| 185 ] | |
| 186 } | |
| 187 | |
| 188 group("monacl_test_nonsfi_nexes") { | |
| 189 testonly = true | |
| 190 deps = [ | |
| 191 ":translate_mojo_pnacl_tests_to_native", | |
| 192 ":prepend_shebang_to_nexe", | |
| 193 ] | |
| 194 } | |
| 195 | |
| 196 group("mojo_nacl_tests") { | |
| 197 testonly = true | |
| 198 deps = [ | |
| 199 ":mojo_nacl_tests_untrusted(//build/toolchain/nacl:clang_newlib_${current_cp
u})", | |
| 200 ":monacl_shell", | |
| 201 ] | |
| 202 } | |
| 203 | |
| 204 group("mojo_nacl_tests_nonsfi") { | |
| 205 testonly = true | |
| 206 deps = [ | |
| 207 ":monacl_shell_nonsfi_x86", | |
| 208 ":monacl_test_nonsfi_nexes", | |
| 209 ] | |
| 210 } | |
| OLD | NEW |