| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 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 """Script to build binary components of the SDK. | 6 """Script to build binary components of the SDK. |
| 7 | 7 |
| 8 This script builds binary components of the Native Client SDK, create tarballs | 8 This script builds binary components of the Native Client SDK, create tarballs |
| 9 for them, and uploads them to Google Cloud Storage. | 9 for them, and uploads them to Google Cloud Storage. |
| 10 | 10 |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 | 202 |
| 203 def GypNinjaBuild(arch, gyp_py_script, gyp_file, targets, out_dir): | 203 def GypNinjaBuild(arch, gyp_py_script, gyp_file, targets, out_dir): |
| 204 gyp_env = dict(os.environ) | 204 gyp_env = dict(os.environ) |
| 205 gyp_env['GYP_GENERATORS'] = 'ninja' | 205 gyp_env['GYP_GENERATORS'] = 'ninja' |
| 206 gyp_defines = [] | 206 gyp_defines = [] |
| 207 if options.mac_sdk: | 207 if options.mac_sdk: |
| 208 gyp_defines.append('mac_sdk=%s' % options.mac_sdk) | 208 gyp_defines.append('mac_sdk=%s' % options.mac_sdk) |
| 209 if arch: | 209 if arch: |
| 210 gyp_defines.append('target_arch=%s' % arch) | 210 gyp_defines.append('target_arch=%s' % arch) |
| 211 if arch == 'arm': | 211 if arch == 'arm': |
| 212 if PLATFORM == 'linux': | 212 gyp_env['GYP_CROSSCOMPILE'] = '1' |
| 213 gyp_env['CC'] = 'arm-linux-gnueabihf-gcc' | 213 gyp_defines += ['arm_float_abi=hard'] |
| 214 gyp_env['CXX'] = 'arm-linux-gnueabihf-g++' | |
| 215 gyp_env['AR'] = 'arm-linux-gnueabihf-ar' | |
| 216 gyp_env['AS'] = 'arm-linux-gnueabihf-as' | |
| 217 gyp_env['CC_host'] = 'cc' | |
| 218 gyp_env['CXX_host'] = 'c++' | |
| 219 gyp_defines += ['armv7=1', 'arm_thumb=0', 'arm_neon=1', | |
| 220 'arm_float_abi=hard', 'nacl_enable_arm_gcc=1'] | |
| 221 if options.no_arm_trusted: | 214 if options.no_arm_trusted: |
| 222 gyp_defines.append('disable_cross_trusted=1') | 215 gyp_defines.append('disable_cross_trusted=1') |
| 223 if PLATFORM == 'mac': | 216 if PLATFORM == 'mac': |
| 224 gyp_defines.append('clang=1') | 217 gyp_defines.append('clang=1') |
| 225 | 218 |
| 226 gyp_env['GYP_DEFINES'] = ' '.join(gyp_defines) | 219 gyp_env['GYP_DEFINES'] = ' '.join(gyp_defines) |
| 227 generator_flags = ['-G', 'output_dir=%s' % out_dir] | 220 generator_flags = ['-G', 'output_dir=%s' % out_dir] |
| 228 depth = '--depth=.' | 221 depth = '--depth=.' |
| 229 cmd = [sys.executable, gyp_py_script, gyp_file, depth] + generator_flags | 222 cmd = [sys.executable, gyp_py_script, gyp_file, depth] + generator_flags |
| 230 buildbot_common.Run(cmd, cwd=SRC_DIR, env=gyp_env) | 223 buildbot_common.Run(cmd, cwd=SRC_DIR, env=gyp_env) |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 else: | 344 else: |
| 352 toolchain = tcname | 345 toolchain = tcname |
| 353 | 346 |
| 354 tcpath = os.path.join(root, 'Release', 'gen', 'sdk', '%s_x86' % PLATFORM, | 347 tcpath = os.path.join(root, 'Release', 'gen', 'sdk', '%s_x86' % PLATFORM, |
| 355 TOOLCHAIN_PACKAGE_MAP[toolchain]) | 348 TOOLCHAIN_PACKAGE_MAP[toolchain]) |
| 356 return GetToolchainNaClLib(tcname, tcpath, xarch) | 349 return GetToolchainNaClLib(tcname, tcpath, xarch) |
| 357 | 350 |
| 358 | 351 |
| 359 def MakeGypArchives(): | 352 def MakeGypArchives(): |
| 360 join = os.path.join | 353 join = os.path.join |
| 361 gyp_nacl = join(NACL_DIR, 'build', 'gyp_nacl') | |
| 362 gyp_chromium = join(SRC_DIR, 'build', 'gyp_chromium') | 354 gyp_chromium = join(SRC_DIR, 'build', 'gyp_chromium') |
| 355 # TODO(binji): gyp_nacl doesn't build properly on Windows anymore; it only |
| 356 # can use VS2010, not VS2013 which is now required by the Chromium repo. NaCl |
| 357 # needs to be updated to perform the same logic as Chromium in detecting VS, |
| 358 # which can now exist in the depot_tools directory. |
| 359 # See https://code.google.com/p/nativeclient/issues/detail?id=4022 |
| 360 # |
| 361 # For now, let's use gyp_chromium to build these components. |
| 362 # gyp_nacl = join(NACL_DIR, 'build', 'gyp_nacl') |
| 363 gyp_nacl = gyp_chromium |
| 364 |
| 363 nacl_core_sdk_gyp = join(NACL_DIR, 'build', 'nacl_core_sdk.gyp') | 365 nacl_core_sdk_gyp = join(NACL_DIR, 'build', 'nacl_core_sdk.gyp') |
| 364 all_gyp = join(NACL_DIR, 'build', 'all.gyp') | 366 all_gyp = join(NACL_DIR, 'build', 'all.gyp') |
| 365 breakpad_gyp = join(SRC_DIR, 'breakpad', 'breakpad.gyp') | 367 breakpad_gyp = join(SRC_DIR, 'breakpad', 'breakpad.gyp') |
| 366 ppapi_gyp = join(SRC_DIR, 'ppapi', 'native_client', 'native_client.gyp') | 368 ppapi_gyp = join(SRC_DIR, 'ppapi', 'native_client', 'native_client.gyp') |
| 367 breakpad_targets = ['dump_syms', 'minidump_dump', 'minidump_stackwalk'] | 369 breakpad_targets = ['dump_syms', 'minidump_dump', 'minidump_stackwalk'] |
| 368 | 370 |
| 369 # Build | 371 # Build |
| 370 tmpdir_obj = TempDir('nacl_core_sdk_', dont_remove=True).Create() | 372 tmpdir_obj = TempDir('nacl_core_sdk_', dont_remove=True).Create() |
| 371 tmpdir = tmpdir_obj.name | 373 tmpdir = tmpdir_obj.name |
| 372 GypNinjaBuild('ia32', gyp_nacl, nacl_core_sdk_gyp, 'nacl_core_sdk', tmpdir) | 374 GypNinjaBuild('ia32', gyp_nacl, nacl_core_sdk_gyp, 'nacl_core_sdk', tmpdir) |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 578 if options.upload: | 580 if options.upload: |
| 579 UploadArchives() | 581 UploadArchives() |
| 580 | 582 |
| 581 return 0 | 583 return 0 |
| 582 | 584 |
| 583 if __name__ == '__main__': | 585 if __name__ == '__main__': |
| 584 try: | 586 try: |
| 585 sys.exit(main(sys.argv[1:])) | 587 sys.exit(main(sys.argv[1:])) |
| 586 except KeyboardInterrupt: | 588 except KeyboardInterrupt: |
| 587 buildbot_common.ErrorExit('build_artifacts: interrupted') | 589 buildbot_common.ErrorExit('build_artifacts: interrupted') |
| OLD | NEW |