| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 copy("copy_test_files") { | 5 copy("copy_test_files") { |
| 6 visibility = [ ":*" ] | 6 visibility = [ ":*" ] |
| 7 sources = [ | 7 sources = [ |
| 8 # Keep "test_case.html.mock-http-headers" with "test_case.html". | 8 # Keep "test_case.html.mock-http-headers" with "test_case.html". |
| 9 "tests/ppapi_nacl_tests_newlib.nmf", | 9 "tests/ppapi_nacl_tests_newlib.nmf", |
| 10 "tests/test_case.html", | 10 "tests/test_case.html", |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 "//build/config/nacl:nacl_base", | 202 "//build/config/nacl:nacl_base", |
| 203 "//ppapi/native_client:ppapi_lib", | 203 "//ppapi/native_client:ppapi_lib", |
| 204 ] | 204 ] |
| 205 if (is_nacl_glibc) { | 205 if (is_nacl_glibc) { |
| 206 deps += [ ":ppapi_cpp_lib_shared" ] | 206 deps += [ ":ppapi_cpp_lib_shared" ] |
| 207 } else { | 207 } else { |
| 208 deps += [ ":ppapi_cpp_lib" ] | 208 deps += [ ":ppapi_cpp_lib" ] |
| 209 } | 209 } |
| 210 } | 210 } |
| 211 | 211 |
| 212 if (current_cpu == "pnacl") { |
| 213 action("translate_pexe_to_nexe") { |
| 214 pexe = "${root_out_dir}/ppapi_nacl_tests.pexe" |
| 215 nexe = "${root_out_dir}/ppapi_nacl_tests.nexe" |
| 216 |
| 217 script = "${nacl_toolchain_dir}/pnacl_newlib/bin/pydir/loader.py" |
| 218 sources = [ |
| 219 pexe, |
| 220 ] |
| 221 outputs = [ |
| 222 nexe, |
| 223 ] |
| 224 |
| 225 # TODO(phosek): remove the following once change 1360243003 is rolled |
| 226 # into Chrome and use $target_cpu directly. |
| 227 if (target_cpu == "x86") { |
| 228 arch = "i686" |
| 229 } else if (target_cpu == "x64") { |
| 230 arch = "x86-64" |
| 231 } else if (target_cpu == "arm") { |
| 232 arch = "armv7" |
| 233 } |
| 234 |
| 235 # The pre-translated object file has to be linked with an IRT shim to |
| 236 # get a runnable nexe. This is handled by pnacl-translate, which passes |
| 237 # -l:libpnacl_irt_shim.a to native linker, and we need to ensure the |
| 238 # linker can find the correct library. |
| 239 pnacl_irt_shim = "//ppapi/native_client/src/untrusted/pnacl_irt_shim:aot
(//build/toolchain/nacl:clang_newlib_${target_cpu})" |
| 240 |
| 241 args = [ |
| 242 "pnacl-translate", |
| 243 rebase_path(pexe, root_build_dir), |
| 244 "-o", |
| 245 rebase_path(nexe, root_build_dir), |
| 246 "-arch", |
| 247 arch, |
| 248 "-Wl,-L" + |
| 249 rebase_path(get_label_info(pnacl_irt_shim, "target_out_dir")), |
| 250 ] |
| 251 deps = [ |
| 252 ":ppapi_nacl_tests", |
| 253 ] |
| 254 data_deps = [ |
| 255 pnacl_irt_shim, |
| 256 ] |
| 257 } |
| 258 } |
| 259 |
| 212 copy("nacl_tests_copy") { | 260 copy("nacl_tests_copy") { |
| 213 sources = [ | 261 sources = [ |
| 214 "${root_out_dir}/ppapi_nacl_tests.nexe", | 262 "${root_out_dir}/ppapi_nacl_tests.nexe", |
| 215 ] | 263 ] |
| 216 if (is_nacl_glibc) { | |
| 217 suffix = "glibc" | |
| 218 } else { | |
| 219 suffix = "newlib" | |
| 220 } | |
| 221 | 264 |
| 222 # The CPU names used in tests/ppapi_nacl_tests_newlib.nmf | 265 # The CPU names used in tests/ppapi_nacl_tests_newlib.nmf |
| 223 # are the ones used in GYP (x32 for x86). | 266 # are the ones used in GYP (x32 for x86). |
| 224 if (target_cpu == "x86") { | 267 if (target_cpu == "x86") { |
| 225 nmf_cpu = "x32" | 268 nmf_cpu = "x32" |
| 226 } else { | 269 } else if (current_cpu != "pnacl") { |
| 227 nmf_cpu = target_cpu | 270 nmf_cpu = target_cpu |
| 228 } | 271 } |
| 272 if (is_nacl_glibc) { |
| 273 suffix = "glibc_${nmf_cpu}" |
| 274 } else if (current_cpu == "pnacl") { |
| 275 suffix = "pnacl" |
| 276 } else { |
| 277 suffix = "newlib_${nmf_cpu}" |
| 278 } |
| 229 outputs = [ | 279 outputs = [ |
| 230 "${root_build_dir}/{{source_name_part}}_${suffix}_${nmf_cpu}.nexe", | 280 "${root_build_dir}/{{source_name_part}}_${suffix}.nexe", |
| 231 ] | 281 ] |
| 232 deps = [ | 282 if (current_cpu == "pnacl") { |
| 233 ":ppapi_nacl_tests", | 283 deps = [ |
| 234 ] | 284 ":translate_pexe_to_nexe", |
| 285 ] |
| 286 } else { |
| 287 deps = [ |
| 288 ":ppapi_nacl_tests", |
| 289 ] |
| 290 } |
| 235 } | 291 } |
| 236 | 292 |
| 237 action("generate_nmf") { | 293 action("generate_nmf") { |
| 238 nacl_toolchain_dir = rebase_path("//native_client/toolchain") | |
| 239 os_toolchain_dir = "${nacl_toolchain_dir}/${host_os}_x86" | |
| 240 if (is_nacl_glibc) { | 294 if (is_nacl_glibc) { |
| 241 toolchain_dir = "${os_toolchain_dir}/nacl_x86_glibc" | 295 toolchain_dir = "${nacl_toolchain_dir}/nacl_x86_glibc" |
| 242 nmf = "${root_build_dir}/ppapi_nacl_tests_glibc.nmf" | 296 nmf = "${root_build_dir}/ppapi_nacl_tests_glibc.nmf" |
| 297 } else if (current_cpu == "pnacl") { |
| 298 toolchain_dir = "${nacl_toolchain_dir}/pnacl_newlib" |
| 299 nmf = "${root_build_dir}/ppapi_nacl_tests_pnacl.nmf" |
| 243 } else { | 300 } else { |
| 244 toolchain_dir = "${os_toolchain_dir}/nacl_x86_newlib" | 301 toolchain_dir = "${nacl_toolchain_dir}/nacl_x86_newlib" |
| 245 nmf = "${root_build_dir}/ppapi_nacl_tests_newlib.nmf" | 302 nmf = "${root_build_dir}/ppapi_nacl_tests_newlib.nmf" |
| 246 } | 303 } |
| 304 nexe = "${root_out_dir}/ppapi_nacl_tests.nexe" |
| 305 |
| 247 script = "//native_client_sdk/src/tools/create_nmf.py" | 306 script = "//native_client_sdk/src/tools/create_nmf.py" |
| 248 sources = get_target_outputs(":nacl_tests_copy") | 307 sources = [ |
| 308 nexe, |
| 309 ] |
| 249 outputs = [ | 310 outputs = [ |
| 250 nmf, | 311 nmf, |
| 251 ] | 312 ] |
| 313 data = [ |
| 314 nexe, |
| 315 ] |
| 252 nmf_flags = [] | 316 nmf_flags = [] |
| 253 if (is_nacl_glibc) { | 317 if (is_nacl_glibc) { |
| 254 nmf_flags += [ "--library-path=" + rebase_path(root_out_dir) ] | 318 nmf_flags += [ "--library-path=" + rebase_path(root_out_dir) ] |
| 255 if (current_cpu == "x86") { | 319 if (current_cpu == "x86") { |
| 256 nmf_flags += [ "--library-path=" + | 320 nmf_flags += [ "--library-path=" + |
| 257 rebase_path("${toolchain_dir}/x86_64-nacl/lib32", | 321 rebase_path("${toolchain_dir}/x86_64-nacl/lib32") ] |
| 258 root_build_dir) ] | 322 data += [ "$root_build_dir/lib32/" ] |
| 259 data = [ | |
| 260 "$root_build_dir/lib32/", | |
| 261 ] | |
| 262 } | 323 } |
| 263 if (target_cpu == "x64" || (target_cpu == "x86" && is_win)) { | 324 if (target_cpu == "x64" || (target_cpu == "x86" && is_win)) { |
| 264 nmf_flags += [ "--library-path=" + | 325 nmf_flags += [ "--library-path=" + |
| 265 rebase_path("${toolchain_dir}/x86_64-nacl/lib", | 326 rebase_path("${toolchain_dir}/x86_64-nacl/lib") ] |
| 266 root_build_dir) ] | 327 data += [ "$root_build_dir/lib64/" ] |
| 267 data = [ | |
| 268 "$root_build_dir/lib64/", | |
| 269 ] | |
| 270 } | 328 } |
| 271 } | 329 } |
| 272 args = [ | 330 args = [ |
| 273 "--no-default-libpath", | 331 "--no-default-libpath", |
| 274 "--objdump=${toolchain_dir}/bin/x86_64-nacl-objdump", | 332 "--objdump=" + |
| 333 rebase_path("${toolchain_dir}/bin/x86_64-nacl-objdump"), |
| 275 "--output=" + rebase_path(nmf, root_build_dir), | 334 "--output=" + rebase_path(nmf, root_build_dir), |
| 276 "--stage-dependencies=" + rebase_path(root_build_dir), | 335 "--stage-dependencies=" + rebase_path(root_build_dir), |
| 277 ] + nmf_flags + rebase_path(sources, root_build_dir) | 336 ] + nmf_flags + rebase_path(sources, root_build_dir) |
| 278 deps = [ | 337 if (current_cpu == "pnacl") { |
| 279 ":nacl_tests_copy", | 338 deps = [ |
| 280 ] | 339 ":translate_pexe_to_nexe", |
| 281 data_deps = [ | 340 ] |
| 282 ":nacl_tests_copy", | 341 } else { |
| 283 ] | 342 deps = [ |
| 343 ":ppapi_nacl_tests", |
| 344 ] |
| 345 } |
| 284 } | 346 } |
| 285 } | 347 } |
| 286 | 348 |
| 287 group("ppapi_nacl_tests_all") { | 349 group("ppapi_nacl_tests_all") { |
| 288 data_deps = [] | 350 data_deps = [] |
| 289 if (target_cpu == "x86" || target_cpu == "x64") { | 351 if (target_cpu == "x86" || target_cpu == "x64") { |
| 290 data_deps += [ | 352 data_deps += [ |
| 291 ":copy_test_files", | 353 ":copy_test_files", |
| 292 ":nacl_tests_copy(//build/toolchain/nacl:clang_newlib_${target_cpu})", | 354 ":nacl_tests_copy(//build/toolchain/nacl:clang_newlib_${target_cpu})", |
| 293 ":generate_nmf(//build/toolchain/nacl:glibc_${target_cpu})", | 355 ":generate_nmf(//build/toolchain/nacl:glibc_${target_cpu})", |
| 356 ":generate_nmf(//build/toolchain/nacl:newlib_pnacl)", |
| 294 ] | 357 ] |
| 295 } | 358 } |
| 296 } | 359 } |
| 297 } | 360 } |
| OLD | NEW |