Chromium Code Reviews| OLD | NEW |
|---|---|
| 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. |
| 11 | 11 |
| 12 The script inspects the following environment variables: | 12 The script inspects the following environment variables: |
| 13 | 13 |
| 14 BUILDBOT_BUILDERNAME to determine whether the script is run locally | 14 BUILDBOT_BUILDERNAME to determine whether the script is run locally |
| 15 and whether it should upload an SDK to file storage (GSTORE) | 15 and whether it should upload an SDK to file storage (GSTORE) |
| 16 """ | 16 """ |
| 17 | 17 |
| 18 # pylint: disable=W0621 | 18 # pylint: disable=W0621 |
| 19 | 19 |
| 20 # std python includes | 20 # std python includes |
| 21 import copy | |
| 22 import datetime | 21 import datetime |
| 23 import glob | 22 import glob |
| 24 import optparse | 23 import optparse |
| 25 import os | 24 import os |
| 26 import re | 25 import re |
| 27 import sys | 26 import sys |
| 28 | 27 |
| 29 if sys.version_info < (2, 6, 0): | 28 if sys.version_info < (2, 6, 0): |
| 30 sys.stderr.write("python 2.6 or later is required run this script\n") | 29 sys.stderr.write("python 2.6 or later is required run this script\n") |
| 31 sys.exit(1) | 30 sys.exit(1) |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 403 'libpthread.a', | 402 'libpthread.a', |
| 404 ] | 403 ] |
| 405 } | 404 } |
| 406 | 405 |
| 407 | 406 |
| 408 def GypNinjaInstall(pepperdir, toolchains): | 407 def GypNinjaInstall(pepperdir, toolchains): |
| 409 build_dir = GYPBUILD_DIR | 408 build_dir = GYPBUILD_DIR |
| 410 ninja_out_dir = os.path.join(OUT_DIR, build_dir, 'Release') | 409 ninja_out_dir = os.path.join(OUT_DIR, build_dir, 'Release') |
| 411 tools_files = [ | 410 tools_files = [ |
| 412 ['sel_ldr', 'sel_ldr_x86_32'], | 411 ['sel_ldr', 'sel_ldr_x86_32'], |
| 412 ['sel_ldr_x86_64', 'sel_ldr_x86_64'], | |
| 413 ['sel_ldr_arm', 'sel_ldr_arm'], | |
| 413 ['ncval_new', 'ncval'], | 414 ['ncval_new', 'ncval'], |
| 414 ['irt_core_newlib_x32.nexe', 'irt_core_x86_32.nexe'], | 415 ['irt_core_newlib_x32.nexe', 'irt_core_x86_32.nexe'], |
| 415 ['irt_core_newlib_x64.nexe', 'irt_core_x86_64.nexe'], | 416 ['irt_core_newlib_x64.nexe', 'irt_core_x86_64.nexe'], |
| 416 ] | 417 ] |
| 417 | 418 |
| 418 platform = getos.GetPlatform() | 419 platform = getos.GetPlatform() |
| 419 | 420 |
| 420 # TODO(binji): dump_syms doesn't currently build on Windows. See | 421 # TODO(binji): dump_syms doesn't currently build on Windows. See |
| 421 # http://crbug.com/245456 | 422 # http://crbug.com/245456 |
| 422 if platform != 'win': | 423 if platform != 'win': |
| 423 tools_files += [ | 424 tools_files += [ |
| 424 ['dump_syms', 'dump_syms'], | 425 ['dump_syms', 'dump_syms'], |
| 425 ['minidump_dump', 'minidump_dump'], | 426 ['minidump_dump', 'minidump_dump'], |
| 426 ['minidump_stackwalk', 'minidump_stackwalk'] | 427 ['minidump_stackwalk', 'minidump_stackwalk'] |
| 427 ] | 428 ] |
| 428 | 429 |
| 429 tools_files.append(['sel_ldr64', 'sel_ldr_x86_64']) | |
| 430 | |
| 431 if platform == 'linux': | 430 if platform == 'linux': |
| 432 tools_files.append(['nacl_helper_bootstrap', | 431 tools_files.append(['nacl_helper_bootstrap', |
| 433 'nacl_helper_bootstrap_x86_32']) | 432 'nacl_helper_bootstrap_x86_32']) |
| 434 tools_files.append(['nacl_helper_bootstrap64', | 433 tools_files.append(['nacl_helper_bootstrap_x86_64', |
| 435 'nacl_helper_bootstrap_x86_64']) | 434 'nacl_helper_bootstrap_x86_64']) |
| 435 tools_files.append(['nacl_helper_bootstrap_arm', | |
| 436 'nacl_helper_bootstrap_arm']) | |
| 436 | 437 |
| 437 buildbot_common.MakeDir(os.path.join(pepperdir, 'tools')) | 438 buildbot_common.MakeDir(os.path.join(pepperdir, 'tools')) |
| 438 | 439 |
| 439 # Add .exe extensions to all windows tools | 440 # Add .exe extensions to all windows tools |
| 440 for pair in tools_files: | 441 for pair in tools_files: |
| 441 if platform == 'win' and not pair[0].endswith('.nexe'): | 442 if platform == 'win' and not pair[0].endswith('.nexe'): |
| 442 pair[0] += '.exe' | 443 pair[0] += '.exe' |
| 443 pair[1] += '.exe' | 444 pair[1] += '.exe' |
| 444 | 445 |
| 445 InstallFiles(ninja_out_dir, os.path.join(pepperdir, 'tools'), tools_files) | 446 InstallFiles(ninja_out_dir, os.path.join(pepperdir, 'tools'), tools_files) |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 474 GypNinjaBuild('arm', gyp_py, nacl_core_sdk_gyp, 'nacl_core_sdk', out_dir_arm) | 475 GypNinjaBuild('arm', gyp_py, nacl_core_sdk_gyp, 'nacl_core_sdk', out_dir_arm) |
| 475 GypNinjaBuild('ia32', gyp_py, all_gyp, 'ncval_new', out_dir) | 476 GypNinjaBuild('ia32', gyp_py, all_gyp, 'ncval_new', out_dir) |
| 476 | 477 |
| 477 platform = getos.GetPlatform() | 478 platform = getos.GetPlatform() |
| 478 if platform == 'win': | 479 if platform == 'win': |
| 479 NinjaBuild('sel_ldr64', out_dir) | 480 NinjaBuild('sel_ldr64', out_dir) |
| 480 else: | 481 else: |
| 481 out_dir_64 = MakeNinjaRelPath(rel_out_dir + '-64') | 482 out_dir_64 = MakeNinjaRelPath(rel_out_dir + '-64') |
| 482 GypNinjaBuild('x64', gyp_py, nacl_core_sdk_gyp, 'sel_ldr', out_dir_64) | 483 GypNinjaBuild('x64', gyp_py, nacl_core_sdk_gyp, 'sel_ldr', out_dir_64) |
| 483 | 484 |
| 484 # We only need sel_ldr from the 64-bit out directory. | 485 files_to_copy = ['sel_ldr'] |
| 485 # sel_ldr needs to be renamed, so we'll call it sel_ldr64. | |
| 486 files_to_copy = [('sel_ldr', 'sel_ldr64')] | |
| 487 if platform == 'linux': | 486 if platform == 'linux': |
| 488 files_to_copy.append(('nacl_helper_bootstrap', 'nacl_helper_bootstrap64')) | 487 files_to_copy.append('nacl_helper_bootstrap') |
| 489 | 488 |
| 490 for src, dst in files_to_copy: | 489 out_dir = os.path.join(SRC_DIR, out_dir, 'Release') |
| 490 out_dir_64 = os.path.join(SRC_DIR, out_dir_64, 'Release') | |
| 491 out_dir_arm = os.path.join(SRC_DIR, out_dir_arm, 'Release') | |
| 492 | |
| 493 for src in files_to_copy: | |
| 491 buildbot_common.CopyFile( | 494 buildbot_common.CopyFile( |
| 492 os.path.join(SRC_DIR, out_dir_64, 'Release', src), | 495 os.path.join(out_dir_64, src), os.path.join(out_dir, src + '_x86_64')) |
| 493 os.path.join(SRC_DIR, out_dir, 'Release', dst)) | 496 buildbot_common.CopyFile( |
| 497 os.path.join(out_dir_arm, src), os.path.join(out_dir, src + '_arm')) | |
| 498 | |
| 499 if platform == 'linux': | |
| 500 buildbot_common.CopyFile( | |
| 501 os.path.join(out_dir_arm, 'irt_core_newlib_arm.nexe'), | |
| 502 os.path.join(out_dir, 'irt_core_newlib_arm.nexe')) | |
| 494 | 503 |
| 495 | 504 |
| 496 def GypNinjaBuild_Breakpad(rel_out_dir): | 505 def GypNinjaBuild_Breakpad(rel_out_dir): |
| 497 # TODO(binji): dump_syms doesn't currently build on Windows. See | 506 # TODO(binji): dump_syms doesn't currently build on Windows. See |
| 498 # http://crbug.com/245456 | 507 # http://crbug.com/245456 |
| 499 if getos.GetPlatform() == 'win': | 508 if getos.GetPlatform() == 'win': |
| 500 return | 509 return |
| 501 | 510 |
| 502 gyp_py = os.path.join(SRC_DIR, 'build', 'gyp_chromium') | 511 gyp_py = os.path.join(SRC_DIR, 'build', 'gyp_chromium') |
| 503 out_dir = MakeNinjaRelPath(rel_out_dir) | 512 out_dir = MakeNinjaRelPath(rel_out_dir) |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 522 | 531 |
| 523 out_dir = MakeNinjaRelPath(rel_out_dir) | 532 out_dir = MakeNinjaRelPath(rel_out_dir) |
| 524 gyp_file = os.path.join(SRC_DIR, 'ppapi', 'native_client', 'src', | 533 gyp_file = os.path.join(SRC_DIR, 'ppapi', 'native_client', 'src', |
| 525 'untrusted', 'pnacl_irt_shim', 'pnacl_irt_shim.gyp') | 534 'untrusted', 'pnacl_irt_shim', 'pnacl_irt_shim.gyp') |
| 526 targets = ['pnacl_irt_shim'] | 535 targets = ['pnacl_irt_shim'] |
| 527 GypNinjaBuild(target_arch, gyp_py, gyp_file, targets, out_dir, False) | 536 GypNinjaBuild(target_arch, gyp_py, gyp_file, targets, out_dir, False) |
| 528 | 537 |
| 529 | 538 |
| 530 def GypNinjaBuild(arch, gyp_py_script, gyp_file, targets, | 539 def GypNinjaBuild(arch, gyp_py_script, gyp_file, targets, |
| 531 out_dir, force_arm_gcc=True): | 540 out_dir, force_arm_gcc=True): |
| 532 gyp_env = copy.copy(os.environ) | 541 gyp_env = dict(os.environ) |
| 533 gyp_env['GYP_GENERATORS'] = 'ninja' | 542 gyp_env['GYP_GENERATORS'] = 'ninja' |
| 534 gyp_defines = [] | 543 gyp_defines = [] |
| 535 if options.mac_sdk: | 544 if options.mac_sdk: |
| 536 gyp_defines.append('mac_sdk=%s' % options.mac_sdk) | 545 gyp_defines.append('mac_sdk=%s' % options.mac_sdk) |
| 537 if arch: | 546 if arch: |
| 538 gyp_defines.append('target_arch=%s' % arch) | 547 gyp_defines.append('target_arch=%s' % arch) |
| 539 if arch == 'arm': | 548 if arch == 'arm': |
| 540 gyp_defines += ['armv7=1', 'arm_thumb=0', 'arm_neon=1'] | 549 if getos.GetPlatform() == 'linux': |
| 550 gyp_env['CC'] = 'arm-linux-gnueabihf-gcc' | |
| 551 gyp_env['CXX'] = 'arm-linux-gnueabihf-g++' | |
| 552 gyp_env['AR'] = 'arm-linux-gnueabihf-ar' | |
| 553 gyp_env['AS'] = 'arm-linux-gnueabihf-as' | |
| 554 gyp_env['CC_host'] = 'cc' | |
| 555 gyp_env['CXX_host'] = 'c++' | |
|
binji
2014/01/08 23:01:15
requires installing arm cross toolchain
| |
| 556 gyp_defines += ['armv7=1', 'arm_thumb=0', 'arm_neon=1', | |
| 557 'arm_float_abi=hard'] | |
| 541 if force_arm_gcc: | 558 if force_arm_gcc: |
| 542 gyp_defines.append('nacl_enable_arm_gcc=1') | 559 gyp_defines.append('nacl_enable_arm_gcc=1') |
| 543 if getos.GetPlatform() == 'mac': | 560 if getos.GetPlatform() == 'mac': |
| 544 gyp_defines.append('clang=1') | 561 gyp_defines.append('clang=1') |
| 545 | 562 |
| 546 gyp_env['GYP_DEFINES'] = ' '.join(gyp_defines) | 563 gyp_env['GYP_DEFINES'] = ' '.join(gyp_defines) |
| 547 for key in ['GYP_GENERATORS', 'GYP_DEFINES']: | 564 for key in ['GYP_GENERATORS', 'GYP_DEFINES', 'CC']: |
| 548 value = gyp_env[key] | 565 value = gyp_env.get(key) |
| 549 print '%s="%s"' % (key, value) | 566 if value is not None: |
| 567 print '%s="%s"' % (key, value) | |
| 550 gyp_generator_flags = ['-G', 'output_dir=%s' % (out_dir,)] | 568 gyp_generator_flags = ['-G', 'output_dir=%s' % (out_dir,)] |
| 551 gyp_depth = '--depth=.' | 569 gyp_depth = '--depth=.' |
| 552 buildbot_common.Run( | 570 buildbot_common.Run( |
| 553 [sys.executable, gyp_py_script, gyp_file, gyp_depth] + \ | 571 [sys.executable, gyp_py_script, gyp_file, gyp_depth] + \ |
| 554 gyp_generator_flags, | 572 gyp_generator_flags, |
| 555 cwd=SRC_DIR, | 573 cwd=SRC_DIR, |
| 556 env=gyp_env) | 574 env=gyp_env) |
| 557 NinjaBuild(targets, out_dir) | 575 NinjaBuild(targets, out_dir) |
| 558 | 576 |
| 559 | 577 |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 984 BuildStepArchiveSDKTools() | 1002 BuildStepArchiveSDKTools() |
| 985 | 1003 |
| 986 return 0 | 1004 return 0 |
| 987 | 1005 |
| 988 | 1006 |
| 989 if __name__ == '__main__': | 1007 if __name__ == '__main__': |
| 990 try: | 1008 try: |
| 991 sys.exit(main(sys.argv)) | 1009 sys.exit(main(sys.argv)) |
| 992 except KeyboardInterrupt: | 1010 except KeyboardInterrupt: |
| 993 buildbot_common.ErrorExit('build_sdk: interrupted') | 1011 buildbot_common.ErrorExit('build_sdk: interrupted') |
| OLD | NEW |