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