Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1121)

Side by Side Diff: native_client_sdk/src/build_tools/build_sdk.py

Issue 1655873003: [NaCl SDK] Cleanup references to old newlib toolchain (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@add_pepper_50
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Entry point for both build and try bots. 6 """Entry point for both build and try bots.
7 7
8 This script is invoked from XXX, usually without arguments 8 This script is invoked from XXX, usually without arguments
9 to package an SDK. It automatically determines whether 9 to package an SDK. It automatically determines whether
10 this SDK is for mac, win, linux. 10 this SDK is for mac, win, linux.
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 else: 121 else:
122 lib_suffix = '' 122 lib_suffix = ''
123 123
124 tcdir = 'tc_' + GetToolchainLibc(tcname) 124 tcdir = 'tc_' + GetToolchainLibc(tcname)
125 125
126 if tcname == 'pnacl': 126 if tcname == 'pnacl':
127 if arch is None: 127 if arch is None:
128 lib_suffix = '' 128 lib_suffix = ''
129 tcdir = 'tc_pnacl_newlib' 129 tcdir = 'tc_pnacl_newlib'
130 arch = 'x64' 130 arch = 'x64'
131 else:
132 arch = 'clang-' + arch
133 131
134 return os.path.join(GetNinjaOutDir(arch), 'gen', tcdir, 'lib' + lib_suffix) 132 return os.path.join(GetNinjaOutDir(arch), 'gen', tcdir, 'lib' + lib_suffix)
135 133
136 134
137 def GetToolchainNaClLib(tcname, tcpath, arch): 135 def GetToolchainNaClLib(tcname, tcpath, arch):
138 if arch == 'ia32': 136 if arch == 'ia32':
139 return os.path.join(tcpath, 'x86_64-nacl', 'lib32') 137 return os.path.join(tcpath, 'x86_64-nacl', 'lib32')
140 elif arch == 'x64': 138 elif arch == 'x64':
141 return os.path.join(tcpath, 'x86_64-nacl', 'lib') 139 return os.path.join(tcpath, 'x86_64-nacl', 'lib')
142 elif arch == 'arm': 140 elif arch == 'arm':
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 402
405 InstallFiles(GetNinjaOutDir('x64'), tools_dir, tools_files_64) 403 InstallFiles(GetNinjaOutDir('x64'), tools_dir, tools_files_64)
406 InstallFiles(GetNinjaOutDir('ia32'), tools_dir, tools_files_32) 404 InstallFiles(GetNinjaOutDir('ia32'), tools_dir, tools_files_32)
407 InstallFiles(GetNinjaOutDir('arm'), tools_dir, arm_files) 405 InstallFiles(GetNinjaOutDir('arm'), tools_dir, arm_files)
408 406
409 for tc in toolchains: 407 for tc in toolchains:
410 if tc in ('host', 'clang-newlib'): 408 if tc in ('host', 'clang-newlib'):
411 continue 409 continue
412 elif tc == 'pnacl': 410 elif tc == 'pnacl':
413 xarches = (None, 'ia32', 'x64', 'arm') 411 xarches = (None, 'ia32', 'x64', 'arm')
414 elif tc in ('x86_glibc', 'x86_newlib'): 412 elif tc in ('x86_glibc'):
415 xarches = ('ia32', 'x64') 413 xarches = ('ia32', 'x64')
416 elif tc == 'arm_glibc': 414 elif tc == 'arm_glibc':
417 xarches = ('arm',) 415 xarches = ('arm',)
418 else: 416 else:
419 raise AssertionError('unexpected toolchain value: %s' % tc) 417 raise AssertionError('unexpected toolchain value: %s' % tc)
420 418
421 for xarch in xarches: 419 for xarch in xarches:
422 src_dir = GetGypBuiltLib(tc, xarch) 420 src_dir = GetGypBuiltLib(tc, xarch)
423 dst_dir = GetOutputToolchainLib(pepperdir, tc, xarch) 421 dst_dir = GetOutputToolchainLib(pepperdir, tc, xarch)
424 libc = GetToolchainLibc(tc) 422 libc = GetToolchainLibc(tc)
425 InstallFiles(src_dir, dst_dir, TOOLCHAIN_LIBS[libc]) 423 InstallFiles(src_dir, dst_dir, TOOLCHAIN_LIBS[libc])
426 424
427 425
428 def GypNinjaBuild_NaCl(rel_out_dir): 426 def GypNinjaBuild_NaCl(rel_out_dir):
429 gyp_py = os.path.join(NACL_DIR, 'build', 'gyp_nacl') 427 gyp_py = os.path.join(NACL_DIR, 'build', 'gyp_nacl')
430 nacl_core_sdk_gyp = os.path.join(NACL_DIR, 'build', 'nacl_core_sdk.gyp') 428 nacl_core_sdk_gyp = os.path.join(NACL_DIR, 'build', 'nacl_core_sdk.gyp')
431 all_gyp = os.path.join(NACL_DIR, 'build', 'all.gyp') 429 all_gyp = os.path.join(NACL_DIR, 'build', 'all.gyp')
432 430
433 out_dir_32 = MakeNinjaRelPath(rel_out_dir + '-ia32') 431 out_dir_32 = MakeNinjaRelPath(rel_out_dir + '-ia32')
434 out_dir_64 = MakeNinjaRelPath(rel_out_dir + '-x64') 432 out_dir_64 = MakeNinjaRelPath(rel_out_dir + '-x64')
435 out_dir_arm = MakeNinjaRelPath(rel_out_dir + '-arm') 433 out_dir_arm = MakeNinjaRelPath(rel_out_dir + '-arm')
436 out_dir_clang_32 = MakeNinjaRelPath(rel_out_dir + '-clang-ia32')
437 out_dir_clang_64 = MakeNinjaRelPath(rel_out_dir + '-clang-x64')
438 out_dir_clang_arm = MakeNinjaRelPath(rel_out_dir + '-clang-arm')
439 434
440 GypNinjaBuild('ia32', gyp_py, nacl_core_sdk_gyp, 'nacl_core_sdk', out_dir_32, 435 GypNinjaBuild('ia32', gyp_py, nacl_core_sdk_gyp, 'nacl_core_sdk', out_dir_32)
441 gyp_defines=['use_nacl_clang=0']) 436 GypNinjaBuild('x64', gyp_py, nacl_core_sdk_gyp, 'nacl_core_sdk', out_dir_64)
442 GypNinjaBuild('x64', gyp_py, nacl_core_sdk_gyp, 'nacl_core_sdk', out_dir_64, 437 GypNinjaBuild('arm', gyp_py, nacl_core_sdk_gyp, 'nacl_core_sdk', out_dir_arm)
443 gyp_defines=['use_nacl_clang=0'])
444 GypNinjaBuild('arm', gyp_py, nacl_core_sdk_gyp, 'nacl_core_sdk', out_dir_arm,
445 gyp_defines=['use_nacl_clang=0'])
446 GypNinjaBuild('ia32', gyp_py, nacl_core_sdk_gyp, 'nacl_core_sdk',
447 out_dir_clang_32, gyp_defines=['use_nacl_clang=1'])
448 GypNinjaBuild('x64', gyp_py, nacl_core_sdk_gyp, 'nacl_core_sdk',
449 out_dir_clang_64, gyp_defines=['use_nacl_clang=1'])
450 GypNinjaBuild('arm', gyp_py, nacl_core_sdk_gyp, 'nacl_core_sdk',
451 out_dir_clang_arm, gyp_defines=['use_nacl_clang=1'])
452 GypNinjaBuild('x64', gyp_py, all_gyp, 'ncval_new', out_dir_64) 438 GypNinjaBuild('x64', gyp_py, all_gyp, 'ncval_new', out_dir_64)
453 439
454 440
455 def GypNinjaBuild_Breakpad(rel_out_dir): 441 def GypNinjaBuild_Breakpad(rel_out_dir):
456 # TODO(binji): dump_syms doesn't currently build on Windows. See 442 # TODO(binji): dump_syms doesn't currently build on Windows. See
457 # http://crbug.com/245456 443 # http://crbug.com/245456
458 if getos.GetPlatform() == 'win': 444 if getos.GetPlatform() == 'win':
459 return 445 return
460 446
461 gyp_py = os.path.join(SRC_DIR, 'build', 'gyp_chromium') 447 gyp_py = os.path.join(SRC_DIR, 'build', 'gyp_chromium')
462 out_dir = MakeNinjaRelPath(rel_out_dir) 448 out_dir = MakeNinjaRelPath(rel_out_dir)
463 gyp_file = os.path.join(SRC_DIR, 'breakpad', 'breakpad.gyp') 449 gyp_file = os.path.join(SRC_DIR, 'breakpad', 'breakpad.gyp')
464 build_list = ['dump_syms', 'minidump_dump', 'minidump_stackwalk'] 450 build_list = ['dump_syms', 'minidump_dump', 'minidump_stackwalk']
465 GypNinjaBuild('x64', gyp_py, gyp_file, build_list, out_dir) 451 GypNinjaBuild('x64', gyp_py, gyp_file, build_list, out_dir)
466 452
467 453
468 def GypNinjaBuild_PPAPI(arch, rel_out_dir, gyp_defines=None): 454 def GypNinjaBuild_PPAPI(arch, rel_out_dir):
469 gyp_py = os.path.join(SRC_DIR, 'build', 'gyp_chromium') 455 gyp_py = os.path.join(SRC_DIR, 'build', 'gyp_chromium')
470 out_dir = MakeNinjaRelPath(rel_out_dir) 456 out_dir = MakeNinjaRelPath(rel_out_dir)
471 gyp_file = os.path.join(SRC_DIR, 'ppapi', 'native_client', 457 gyp_file = os.path.join(SRC_DIR, 'ppapi', 'native_client',
472 'native_client.gyp') 458 'native_client.gyp')
473 GypNinjaBuild(arch, gyp_py, gyp_file, 'ppapi_lib', out_dir, 459 GypNinjaBuild(arch, gyp_py, gyp_file, 'ppapi_lib', out_dir)
474 gyp_defines=gyp_defines)
475 460
476 461
477 def GypNinjaBuild_Pnacl(rel_out_dir, target_arch): 462 def GypNinjaBuild_Pnacl(rel_out_dir, target_arch):
478 # TODO(binji): This will build the pnacl_irt_shim twice; once as part of the 463 # TODO(binji): This will build the pnacl_irt_shim twice; once as part of the
479 # Chromium build, and once here. When we move more of the SDK build process 464 # Chromium build, and once here. When we move more of the SDK build process
480 # to gyp, we can remove this. 465 # to gyp, we can remove this.
481 gyp_py = os.path.join(SRC_DIR, 'build', 'gyp_chromium') 466 gyp_py = os.path.join(SRC_DIR, 'build', 'gyp_chromium')
482 467
483 out_dir = MakeNinjaRelPath(rel_out_dir) 468 out_dir = MakeNinjaRelPath(rel_out_dir)
484 gyp_file = os.path.join(SRC_DIR, 'ppapi', 'native_client', 'src', 469 gyp_file = os.path.join(SRC_DIR, 'ppapi', 'native_client', 'src',
485 'untrusted', 'pnacl_irt_shim', 'pnacl_irt_shim.gyp') 470 'untrusted', 'pnacl_irt_shim', 'pnacl_irt_shim.gyp')
486 targets = ['aot'] 471 targets = ['aot']
487 GypNinjaBuild(target_arch, gyp_py, gyp_file, targets, out_dir) 472 GypNinjaBuild(target_arch, gyp_py, gyp_file, targets, out_dir)
488 473
489 474
490 def GypNinjaBuild(arch, gyp_py_script, gyp_file, targets, 475 def GypNinjaBuild(arch, gyp_py_script, gyp_file, targets, out_dir):
491 out_dir, gyp_defines=None):
492 gyp_env = dict(os.environ) 476 gyp_env = dict(os.environ)
493 gyp_env['GYP_GENERATORS'] = 'ninja' 477 gyp_env['GYP_GENERATORS'] = 'ninja'
494 gyp_defines = gyp_defines or [] 478 gyp_defines = ['nacl_allow_thin_archives=0', 'use_nacl_clang=1']
495 gyp_defines.append('nacl_allow_thin_archives=0')
496 if not options.no_use_sysroot:
497 gyp_defines.append('use_sysroot=1')
498 if options.mac_sdk: 479 if options.mac_sdk:
499 gyp_defines.append('mac_sdk=%s' % options.mac_sdk) 480 gyp_defines.append('mac_sdk=%s' % options.mac_sdk)
500 481
501 if arch is not None: 482 if arch is not None:
502 gyp_defines.append('target_arch=%s' % arch) 483 gyp_defines.append('target_arch=%s' % arch)
503 if arch == 'arm': 484 if arch == 'arm':
504 gyp_env['GYP_CROSSCOMPILE'] = '1' 485 gyp_env['GYP_CROSSCOMPILE'] = '1'
505 if options.no_arm_trusted: 486 if options.no_arm_trusted:
506 gyp_defines.append('disable_cross_trusted=1') 487 gyp_defines.append('disable_cross_trusted=1')
507 if getos.GetPlatform() == 'mac':
508 gyp_defines.append('clang=1')
509 488
510 gyp_env['GYP_DEFINES'] = ' '.join(gyp_defines) 489 gyp_env['GYP_DEFINES'] = ' '.join(gyp_defines)
511 # We can't use windows path separators in GYP_GENERATOR_FLAGS since 490 # We can't use windows path separators in GYP_GENERATOR_FLAGS since
512 # gyp uses shlex to parse them and treats '\' as an escape char. 491 # gyp uses shlex to parse them and treats '\' as an escape char.
513 gyp_env['GYP_GENERATOR_FLAGS'] = 'output_dir=%s' % out_dir.replace('\\', '/') 492 gyp_env['GYP_GENERATOR_FLAGS'] = 'output_dir=%s' % out_dir.replace('\\', '/')
514 493
515 # Print relevant environment variables 494 # Print relevant environment variables
516 for key, value in gyp_env.iteritems(): 495 for key, value in gyp_env.iteritems():
517 if key.startswith('GYP') or key in ('CC',): 496 if key.startswith('GYP') or key in ('CC',):
518 print ' %s="%s"' % (key, value) 497 print ' %s="%s"' % (key, value)
(...skipping 18 matching lines...) Expand all
537 516
538 if clean: 517 if clean:
539 for dirname in glob.glob(os.path.join(OUT_DIR, GYPBUILD_DIR + '*')): 518 for dirname in glob.glob(os.path.join(OUT_DIR, GYPBUILD_DIR + '*')):
540 buildbot_common.RemoveDir(dirname) 519 buildbot_common.RemoveDir(dirname)
541 build = True 520 build = True
542 521
543 if build: 522 if build:
544 GypNinjaBuild_NaCl(GYPBUILD_DIR) 523 GypNinjaBuild_NaCl(GYPBUILD_DIR)
545 GypNinjaBuild_Breakpad(GYPBUILD_DIR + '-x64') 524 GypNinjaBuild_Breakpad(GYPBUILD_DIR + '-x64')
546 525
547 if set(toolchains) & set(['x86_glibc', 'x86_newlib']): 526 if 'x86_glibc' in toolchains or 'pnacl' in toolchains:
548 GypNinjaBuild_PPAPI('ia32', GYPBUILD_DIR + '-ia32', 527 GypNinjaBuild_PPAPI('ia32', GYPBUILD_DIR + '-ia32')
549 ['use_nacl_clang=0']) 528 GypNinjaBuild_PPAPI('x64', GYPBUILD_DIR + '-x64')
550 GypNinjaBuild_PPAPI('x64', GYPBUILD_DIR + '-x64',
551 ['use_nacl_clang=0'])
552 529
553 if 'arm_glibc' in toolchains: 530 if 'arm_glibc' in toolchains or 'pnacl' in toolchains:
554 GypNinjaBuild_PPAPI('arm', GYPBUILD_DIR + '-arm', 531 GypNinjaBuild_PPAPI('arm', GYPBUILD_DIR + '-arm')
555 ['use_nacl_clang=0'] )
556 532
557 if 'pnacl' in toolchains: 533 if 'pnacl' in toolchains:
558 GypNinjaBuild_PPAPI('ia32', GYPBUILD_DIR + '-clang-ia32',
559 ['use_nacl_clang=1'])
560 GypNinjaBuild_PPAPI('x64', GYPBUILD_DIR + '-clang-x64',
561 ['use_nacl_clang=1'])
562 GypNinjaBuild_PPAPI('arm', GYPBUILD_DIR + '-clang-arm',
563 ['use_nacl_clang=1'])
564
565 # NOTE: For ia32, gyp builds both x86-32 and x86-64 by default. 534 # NOTE: For ia32, gyp builds both x86-32 and x86-64 by default.
566 for arch in ('ia32', 'arm'): 535 for arch in ('ia32', 'arm'):
567 # Fill in the latest native pnacl shim library from the chrome build. 536 # Fill in the latest native pnacl shim library from the chrome build.
568 build_dir = GYPBUILD_DIR + '-pnacl-' + arch 537 build_dir = GYPBUILD_DIR + '-pnacl-' + arch
569 GypNinjaBuild_Pnacl(build_dir, arch) 538 GypNinjaBuild_Pnacl(build_dir, arch)
570 539
571 GypNinjaInstall(pepperdir, toolchains) 540 GypNinjaInstall(pepperdir, toolchains)
572 541
573 for toolchain in toolchains: 542 for toolchain in toolchains:
574 if toolchain not in ('host', 'clang-newlib'): 543 if toolchain not in ('host', 'clang-newlib'):
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
985 BuildStepArchivePNaClComponent(chrome_revision) 954 BuildStepArchivePNaClComponent(chrome_revision)
986 955
987 return 0 956 return 0
988 957
989 958
990 if __name__ == '__main__': 959 if __name__ == '__main__':
991 try: 960 try:
992 sys.exit(main(sys.argv[1:])) 961 sys.exit(main(sys.argv[1:]))
993 except KeyboardInterrupt: 962 except KeyboardInterrupt:
994 buildbot_common.ErrorExit('build_sdk: interrupted') 963 buildbot_common.ErrorExit('build_sdk: interrupted')
OLDNEW
« no previous file with comments | « native_client_sdk/src/build_tools/build_projects.py ('k') | native_client_sdk/src/build_tools/dsc2gyp.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698