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. |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 import getos | 49 import getos |
50 import oshelpers | 50 import oshelpers |
51 | 51 |
52 BUILD_DIR = os.path.join(NACL_DIR, 'build') | 52 BUILD_DIR = os.path.join(NACL_DIR, 'build') |
53 NACL_TOOLCHAIN_DIR = os.path.join(NACL_DIR, 'toolchain') | 53 NACL_TOOLCHAIN_DIR = os.path.join(NACL_DIR, 'toolchain') |
54 NACL_TOOLCHAINTARS_DIR = os.path.join(NACL_TOOLCHAIN_DIR, '.tars') | 54 NACL_TOOLCHAINTARS_DIR = os.path.join(NACL_TOOLCHAIN_DIR, '.tars') |
55 | 55 |
56 CYGTAR = os.path.join(BUILD_DIR, 'cygtar.py') | 56 CYGTAR = os.path.join(BUILD_DIR, 'cygtar.py') |
57 PKGVER = os.path.join(BUILD_DIR, 'package_version', 'package_version.py') | 57 PKGVER = os.path.join(BUILD_DIR, 'package_version', 'package_version.py') |
58 | 58 |
59 GYPBUILD_DIR = 'gypbuild' | 59 GNBUILD_DIR = 'gnbuild' |
60 | 60 |
61 options = None | 61 options = None |
62 | 62 |
63 # Map of: ToolchainName: (PackageName, SDKDir, arch). | 63 # Map of: ToolchainName: (PackageName, SDKDir, arch). |
64 TOOLCHAIN_PACKAGE_MAP = { | 64 TOOLCHAIN_PACKAGE_MAP = { |
65 'arm_glibc': ('nacl_arm_glibc', '%(platform)s_arm_glibc', 'arm'), | 65 'arm_glibc': ('nacl_arm_glibc', '%(platform)s_arm_glibc', 'arm'), |
66 'x86_glibc': ('nacl_x86_glibc', '%(platform)s_x86_glibc', 'x86'), | 66 'x86_glibc': ('nacl_x86_glibc', '%(platform)s_x86_glibc', 'x86'), |
67 'pnacl': ('pnacl_newlib', '%(platform)s_pnacl', 'pnacl') | 67 'pnacl': ('pnacl_newlib', '%(platform)s_pnacl', 'pnacl') |
68 } | 68 } |
69 | 69 |
(...skipping 23 matching lines...) Expand all Loading... |
93 if arch == 'x86': | 93 if arch == 'x86': |
94 return os.path.join(tcpath, 'x86_64-nacl', 'include') | 94 return os.path.join(tcpath, 'x86_64-nacl', 'include') |
95 elif arch == 'pnacl': | 95 elif arch == 'pnacl': |
96 return os.path.join(tcpath, 'le32-nacl', 'include') | 96 return os.path.join(tcpath, 'le32-nacl', 'include') |
97 elif arch == 'arm': | 97 elif arch == 'arm': |
98 return os.path.join(tcpath, 'arm-nacl', 'include') | 98 return os.path.join(tcpath, 'arm-nacl', 'include') |
99 else: | 99 else: |
100 buildbot_common.ErrorExit('Unknown architecture: %s' % arch) | 100 buildbot_common.ErrorExit('Unknown architecture: %s' % arch) |
101 | 101 |
102 | 102 |
103 def GetConfigDir(arch): | 103 def GetNinjaOutDir(arch): |
104 if arch.endswith('x64') and getos.GetPlatform() == 'win': | 104 return os.path.join(OUT_DIR, GNBUILD_DIR + '-' + arch) |
105 return 'Release_x64' | |
106 else: | |
107 return 'Release' | |
108 | 105 |
109 | 106 |
110 def GetNinjaOutDir(arch): | 107 def GetGnBuiltLib(tc, arch): |
111 return os.path.join(OUT_DIR, GYPBUILD_DIR + '-' + arch, GetConfigDir(arch)) | 108 if 'glibc' in tc: |
112 | 109 out_dir = 'glibc_%s' % arch |
113 | 110 elif arch == 'pnacl': |
114 def GetGypBuiltLib(tcname, arch): | 111 out_dir = 'newlib_pnacl' |
115 if arch == 'ia32': | |
116 lib_suffix = '32' | |
117 elif arch == 'x64': | |
118 lib_suffix = '64' | |
119 elif arch == 'arm': | |
120 lib_suffix = 'arm' | |
121 else: | 112 else: |
122 lib_suffix = '' | 113 out_dir = 'clang_newlib_%s' % arch |
123 | 114 return os.path.join(GetNinjaOutDir('x64'), out_dir) |
124 tcdir = 'tc_' + GetToolchainLibc(tcname) | |
125 | |
126 if tcname == 'pnacl': | |
127 if arch is None: | |
128 lib_suffix = '' | |
129 tcdir = 'tc_pnacl_newlib' | |
130 arch = 'x64' | |
131 | |
132 return os.path.join(GetNinjaOutDir(arch), 'gen', tcdir, 'lib' + lib_suffix) | |
133 | 115 |
134 | 116 |
135 def GetToolchainNaClLib(tcname, tcpath, arch): | 117 def GetToolchainNaClLib(tcname, tcpath, arch): |
136 if arch == 'ia32': | 118 if arch == 'x86': |
137 return os.path.join(tcpath, 'x86_64-nacl', 'lib32') | 119 return os.path.join(tcpath, 'x86_64-nacl', 'lib32') |
138 elif arch == 'x64': | 120 elif arch == 'x64': |
139 return os.path.join(tcpath, 'x86_64-nacl', 'lib') | 121 return os.path.join(tcpath, 'x86_64-nacl', 'lib') |
140 elif arch == 'arm': | 122 elif arch == 'arm': |
141 return os.path.join(tcpath, 'arm-nacl', 'lib') | 123 return os.path.join(tcpath, 'arm-nacl', 'lib') |
142 elif tcname == 'pnacl': | 124 elif tcname == 'pnacl': |
143 return os.path.join(tcpath, 'le32-nacl', 'lib') | 125 return os.path.join(tcpath, 'le32-nacl', 'lib') |
144 | 126 |
145 | 127 |
146 | |
147 def GetOutputToolchainLib(pepperdir, tcname, arch): | 128 def GetOutputToolchainLib(pepperdir, tcname, arch): |
148 tcpath = os.path.join(pepperdir, 'toolchain', GetToolchainDirName(tcname)) | 129 tcpath = os.path.join(pepperdir, 'toolchain', GetToolchainDirName(tcname)) |
149 return GetToolchainNaClLib(tcname, tcpath, arch) | 130 return GetToolchainNaClLib(tcname, tcpath, arch) |
150 | 131 |
151 | 132 |
152 def GetPNaClTranslatorLib(tcpath, arch): | 133 def GetPNaClTranslatorLib(tcpath, arch): |
153 if arch not in ['arm', 'x86-32', 'x86-64']: | 134 if arch not in ['arm', 'x86', 'x64']: |
154 buildbot_common.ErrorExit('Unknown architecture %s.' % arch) | 135 buildbot_common.ErrorExit('Unknown architecture %s.' % arch) |
| 136 if arch == 'x86': |
| 137 arch = 'x86-32' |
| 138 elif arch == 'x64': |
| 139 arch = 'x86-64' |
155 return os.path.join(tcpath, 'translator', arch, 'lib') | 140 return os.path.join(tcpath, 'translator', arch, 'lib') |
156 | 141 |
157 | 142 |
158 def BuildStepDownloadToolchains(toolchains): | 143 def BuildStepDownloadToolchains(toolchains): |
159 buildbot_common.BuildStep('Running package_version.py') | 144 buildbot_common.BuildStep('Running package_version.py') |
160 args = [sys.executable, PKGVER, '--mode', 'nacl_core_sdk'] | 145 args = [sys.executable, PKGVER, '--mode', 'nacl_core_sdk'] |
161 args.extend(['sync', '--extract']) | 146 args.extend(['sync', '--extract']) |
162 buildbot_common.Run(args, cwd=NACL_DIR) | 147 buildbot_common.Run(args, cwd=NACL_DIR) |
163 | 148 |
164 | 149 |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 if not os.path.isdir(os.path.dirname(dest)): | 309 if not os.path.isdir(os.path.dirname(dest)): |
325 buildbot_common.MakeDir(os.path.dirname(dest)) | 310 buildbot_common.MakeDir(os.path.dirname(dest)) |
326 buildbot_common.CopyFile(source, dest) | 311 buildbot_common.CopyFile(source, dest) |
327 | 312 |
328 | 313 |
329 def InstallNaClHeaders(tc_dst_inc, tcname): | 314 def InstallNaClHeaders(tc_dst_inc, tcname): |
330 """Copies NaCl headers to expected locations in the toolchain.""" | 315 """Copies NaCl headers to expected locations in the toolchain.""" |
331 InstallFiles(SRC_DIR, tc_dst_inc, NACL_HEADER_MAP[GetToolchainLibc(tcname)]) | 316 InstallFiles(SRC_DIR, tc_dst_inc, NACL_HEADER_MAP[GetToolchainLibc(tcname)]) |
332 | 317 |
333 | 318 |
334 def MakeNinjaRelPath(path): | 319 def GnNinjaInstall(pepperdir, toolchains): |
335 return os.path.join(os.path.relpath(OUT_DIR, SRC_DIR), path) | 320 tools_files_x86 = [ |
336 | 321 ['sel_ldr', 'sel_ldr_x86_32'], |
337 | |
338 TOOLCHAIN_LIBS = { | |
339 'newlib' : [ | |
340 'libppapi.a', | |
341 'libppapi_stub.a', | |
342 ], | |
343 'glibc': [ | |
344 'libppapi.a', | |
345 'libppapi.so', | |
346 'libppapi_stub.a', | |
347 ] | 322 ] |
348 } | 323 tools_files_x64 = [ |
349 | 324 ['sel_ldr', 'sel_ldr_x86_64'], |
350 | 325 ['ncval_new', 'ncval'], |
351 def GypNinjaInstall(pepperdir, toolchains): | 326 ['clang_newlib_arm/elf_loader.nexe', 'elf_loader_arm.nexe'], |
352 tools_files_32 = [ | 327 ['irt_x86/irt_core.nexe', 'irt_core_x86_32.nexe'], |
353 ['sel_ldr', 'sel_ldr_x86_32'], | 328 ['irt_x64/irt_core.nexe', 'irt_core_x86_64.nexe'], |
354 ['irt_core_newlib_x32.nexe', 'irt_core_x86_32.nexe'], | |
355 ['irt_core_newlib_x64.nexe', 'irt_core_x86_64.nexe'], | |
356 ] | 329 ] |
357 arm_files = [ | 330 tools_files_arm = [] |
358 ['elf_loader_newlib_arm.nexe', 'elf_loader_arm.nexe'], | |
359 ] | |
360 | |
361 tools_files_64 = [] | |
362 | 331 |
363 platform = getos.GetPlatform() | 332 platform = getos.GetPlatform() |
364 | 333 |
365 # TODO(binji): dump_syms doesn't currently build on Windows. See | 334 # TODO(binji): dump_syms doesn't currently build on Windows. See |
366 # http://crbug.com/245456 | 335 # http://crbug.com/245456 |
367 if platform != 'win': | 336 if platform != 'win': |
368 tools_files_64 += [ | 337 tools_files_x64 += [ |
369 ['dump_syms', 'dump_syms'], | 338 ['dump_syms', 'dump_syms'], |
370 ['minidump_dump', 'minidump_dump'], | 339 ['minidump_dump', 'minidump_dump'], |
371 ['minidump_stackwalk', 'minidump_stackwalk'] | 340 ['minidump_stackwalk', 'minidump_stackwalk'] |
372 ] | 341 ] |
373 | 342 |
374 tools_files_64.append(['sel_ldr', 'sel_ldr_x86_64']) | |
375 tools_files_64.append(['ncval_new', 'ncval']) | |
376 | 343 |
377 if platform == 'linux': | 344 if platform == 'linux': |
378 tools_files_32.append(['nacl_helper_bootstrap', | 345 tools_files_x86 += [['nonsfi_loader', 'nonsfi_loader_x86_32'], |
379 'nacl_helper_bootstrap_x86_32']) | 346 ['nacl_helper_bootstrap', |
380 tools_files_64.append(['nacl_helper_bootstrap', | 347 'nacl_helper_bootstrap_x86_32']] |
381 'nacl_helper_bootstrap_x86_64']) | 348 tools_files_x64 += [['nacl_helper_bootstrap', |
382 tools_files_32.append(['nonsfi_loader_newlib_x32_nonsfi.nexe', | 349 'nacl_helper_bootstrap_x86_64']] |
383 'nonsfi_loader_x86_32']) | 350 |
| 351 |
| 352 # Add ARM trusted binaries (linux only) |
| 353 if not options.no_arm_trusted: |
| 354 tools_files_x64 += [ |
| 355 ['irt_arm/irt_core.nexe', 'irt_core_arm.nexe'], |
| 356 ] |
| 357 tools_files_arm += [ |
| 358 ['nacl_helper_bootstrap', 'nacl_helper_bootstrap_arm'], |
| 359 ['nonsfi_loader', 'nonsfi_loader_arm'], |
| 360 ['sel_ldr', 'sel_ldr_arm'] |
| 361 ] |
384 | 362 |
385 tools_dir = os.path.join(pepperdir, 'tools') | 363 tools_dir = os.path.join(pepperdir, 'tools') |
386 buildbot_common.MakeDir(tools_dir) | 364 buildbot_common.MakeDir(tools_dir) |
387 | 365 |
388 # Add .exe extensions to all windows tools | 366 # Add .exe extensions to all windows tools |
389 for pair in tools_files_32 + tools_files_64: | 367 for pair in tools_files_x86 + tools_files_x64: |
390 if platform == 'win' and not pair[0].endswith('.nexe'): | 368 if platform == 'win' and not os.path.splitext(pair[0])[1]: |
391 pair[0] += '.exe' | 369 pair[0] += '.exe' |
392 pair[1] += '.exe' | 370 pair[1] += '.exe' |
393 | 371 |
394 # Add ARM binaries | 372 InstallFiles(GetNinjaOutDir('x64'), tools_dir, tools_files_x64) |
395 if platform == 'linux' and not options.no_arm_trusted: | 373 InstallFiles(GetNinjaOutDir('x86'), tools_dir, tools_files_x86) |
396 arm_files += [ | 374 if platform == 'linux': |
397 ['irt_core_newlib_arm.nexe', 'irt_core_arm.nexe'], | 375 InstallFiles(GetNinjaOutDir('arm'), tools_dir, tools_files_arm) |
398 ['nacl_helper_bootstrap', 'nacl_helper_bootstrap_arm'], | |
399 ['nonsfi_loader_newlib_arm_nonsfi.nexe', 'nonsfi_loader_arm'], | |
400 ['sel_ldr', 'sel_ldr_arm'] | |
401 ] | |
402 | 376 |
403 InstallFiles(GetNinjaOutDir('x64'), tools_dir, tools_files_64) | 377 stub_dir = os.path.join(SRC_DIR, 'ppapi/native_client/src/untrusted/irt_stub') |
404 InstallFiles(GetNinjaOutDir('ia32'), tools_dir, tools_files_32) | |
405 InstallFiles(GetNinjaOutDir('arm'), tools_dir, arm_files) | |
406 | |
407 for tc in toolchains: | 378 for tc in toolchains: |
408 if tc in ('host', 'clang-newlib'): | 379 if tc in ('host', 'clang-newlib'): |
409 continue | 380 continue |
410 elif tc == 'pnacl': | 381 elif tc == 'pnacl': |
411 xarches = (None, 'ia32', 'x64', 'arm') | 382 xarches = ('pnacl', 'x86', 'x64', 'arm') |
412 elif tc in ('x86_glibc'): | 383 elif tc in ('x86_glibc'): |
413 xarches = ('ia32', 'x64') | 384 xarches = ('x86', 'x64') |
414 elif tc == 'arm_glibc': | 385 elif tc == 'arm_glibc': |
415 xarches = ('arm',) | 386 xarches = ('arm',) |
416 else: | 387 else: |
417 raise AssertionError('unexpected toolchain value: %s' % tc) | 388 raise AssertionError('unexpected toolchain value: %s' % tc) |
418 | 389 |
419 for xarch in xarches: | 390 for xarch in xarches: |
420 src_dir = GetGypBuiltLib(tc, xarch) | 391 src_dir = GetGnBuiltLib(tc, xarch) |
| 392 src_dir = os.path.join(src_dir, 'obj', 'ppapi', 'native_client', 'src', |
| 393 'untrusted', 'irt_stub') |
421 dst_dir = GetOutputToolchainLib(pepperdir, tc, xarch) | 394 dst_dir = GetOutputToolchainLib(pepperdir, tc, xarch) |
422 libc = GetToolchainLibc(tc) | 395 InstallFiles(src_dir, dst_dir, ['libppapi_stub.a']) |
423 InstallFiles(src_dir, dst_dir, TOOLCHAIN_LIBS[libc]) | 396 InstallFiles(stub_dir, dst_dir, ['libppapi.a']) |
| 397 if 'glibc' in tc: |
| 398 InstallFiles(stub_dir, dst_dir, ['libppapi.so']) |
424 | 399 |
425 | 400 |
426 def GypNinjaBuild_NaCl(rel_out_dir): | 401 def GnNinjaBuildAll(rel_out_dir): |
427 gyp_py = os.path.join(NACL_DIR, 'build', 'gyp_nacl') | 402 def MakeNinjaRelPath(suffix): |
428 nacl_core_sdk_gyp = os.path.join(NACL_DIR, 'build', 'nacl_core_sdk.gyp') | 403 return os.path.join(os.path.relpath(OUT_DIR, SRC_DIR), rel_out_dir + suffix) |
429 all_gyp = os.path.join(NACL_DIR, 'build', 'all.gyp') | |
430 | 404 |
431 out_dir_32 = MakeNinjaRelPath(rel_out_dir + '-ia32') | 405 GnNinjaBuild('x64', MakeNinjaRelPath('-x64'), |
432 out_dir_64 = MakeNinjaRelPath(rel_out_dir + '-x64') | 406 ['nacl_sdk_untrusted=true']) |
433 out_dir_arm = MakeNinjaRelPath(rel_out_dir + '-arm') | 407 GnNinjaBuild('x86', MakeNinjaRelPath('-x86')) |
434 | 408 |
435 GypNinjaBuild('ia32', gyp_py, nacl_core_sdk_gyp, 'nacl_core_sdk', out_dir_32) | 409 platform = getos.GetPlatform() |
436 GypNinjaBuild('x64', gyp_py, nacl_core_sdk_gyp, 'nacl_core_sdk', out_dir_64) | 410 if platform == 'linux': |
437 GypNinjaBuild('arm', gyp_py, nacl_core_sdk_gyp, 'nacl_core_sdk', out_dir_arm) | 411 GnNinjaBuild('arm', MakeNinjaRelPath('-arm')) |
438 GypNinjaBuild('x64', gyp_py, all_gyp, 'ncval_new', out_dir_64) | |
439 | 412 |
440 | 413 |
441 def GypNinjaBuild_Breakpad(rel_out_dir): | 414 def GnNinjaBuild(arch, out_dir, extra_gn_args=None): |
442 # TODO(binji): dump_syms doesn't currently build on Windows. See | 415 gn_args = ['is_debug=false'] |
443 # http://crbug.com/245456 | 416 if extra_gn_args is not None: |
444 if getos.GetPlatform() == 'win': | 417 gn_args += extra_gn_args |
445 return | 418 platform = getos.GetPlatform() |
| 419 if platform == 'mac': |
| 420 if options.mac_sdk: |
| 421 gn_args.append('mac_sdk_min="%s"' % options.mac_sdk) |
| 422 # Without this the target_cpu='arm' build complains about missing code |
| 423 # signing identity |
| 424 gn_args.append('use_ios_simulator=true') |
446 | 425 |
447 gyp_py = os.path.join(SRC_DIR, 'build', 'gyp_chromium') | 426 gn_exe = 'gn' |
448 out_dir = MakeNinjaRelPath(rel_out_dir) | 427 if platform == 'win': |
449 gyp_file = os.path.join(SRC_DIR, 'breakpad', 'breakpad.gyp') | 428 gn_exe += '.bat' |
450 build_list = ['dump_syms', 'minidump_dump', 'minidump_stackwalk'] | |
451 GypNinjaBuild('x64', gyp_py, gyp_file, build_list, out_dir) | |
452 | |
453 | |
454 def GypNinjaBuild_PPAPI(arch, rel_out_dir): | |
455 gyp_py = os.path.join(SRC_DIR, 'build', 'gyp_chromium') | |
456 out_dir = MakeNinjaRelPath(rel_out_dir) | |
457 gyp_file = os.path.join(SRC_DIR, 'ppapi', 'native_client', | |
458 'native_client.gyp') | |
459 GypNinjaBuild(arch, gyp_py, gyp_file, 'ppapi_lib', out_dir) | |
460 | |
461 | |
462 def GypNinjaBuild_Pnacl(arch, rel_out_dir): | |
463 # TODO(binji): This will build the pnacl_irt_shim twice; once as part of the | |
464 # Chromium build, and once here. When we move more of the SDK build process | |
465 # to gyp, we can remove this. | |
466 gyp_py = os.path.join(SRC_DIR, 'build', 'gyp_chromium') | |
467 | |
468 out_dir = MakeNinjaRelPath(rel_out_dir) | |
469 gyp_file = os.path.join(SRC_DIR, 'ppapi', 'native_client', 'src', | |
470 'untrusted', 'pnacl_irt_shim', 'pnacl_irt_shim.gyp') | |
471 GypNinjaBuild(arch, gyp_py, gyp_file, 'aot', out_dir) | |
472 | |
473 | |
474 def GypNinjaBuild(arch, gyp_py_script, gyp_file, targets, out_dir): | |
475 gyp_env = dict(os.environ) | |
476 gyp_defines = [] | |
477 if options.mac_sdk: | |
478 gyp_defines.append('mac_sdk=%s' % options.mac_sdk) | |
479 | 429 |
480 if arch is not None: | 430 if arch is not None: |
481 gyp_defines.append('target_arch=%s' % arch) | 431 gn_args.append('target_cpu="%s"' % arch) |
482 if arch == 'arm': | 432 if arch == 'arm': |
483 gyp_env['GYP_CROSSCOMPILE'] = '1' | |
484 if options.no_arm_trusted: | 433 if options.no_arm_trusted: |
485 gyp_defines.append('disable_cross_trusted=1') | 434 gn_args.append('enable_cross_trusted=false') |
486 | 435 |
487 gyp_env['GYP_DEFINES'] = ' '.join(gyp_defines) | 436 gn_args = ' '.join(gn_args) |
488 # We can't use windows path separators in GYP_GENERATOR_FLAGS since | 437 buildbot_common.Run([gn_exe, 'gen', '--args=%s' % gn_args, out_dir], |
489 # gyp uses shlex to parse them and treats '\' as an escape char. | 438 cwd=SRC_DIR) |
490 gyp_env['GYP_GENERATOR_FLAGS'] = 'output_dir=%s' % out_dir.replace('\\', '/') | |
491 | 439 |
492 # Print relevant environment variables | 440 buildbot_common.Run(['ninja', '-C', out_dir, 'nacl_core_sdk'], cwd=SRC_DIR) |
493 for key, value in gyp_env.iteritems(): | |
494 if key.startswith('GYP') or key in ('CC',): | |
495 print ' %s="%s"' % (key, value) | |
496 | |
497 buildbot_common.Run( | |
498 [sys.executable, gyp_py_script, gyp_file, '--depth=.'], | |
499 cwd=SRC_DIR, | |
500 env=gyp_env) | |
501 | |
502 NinjaBuild(targets, out_dir, arch) | |
503 | |
504 | |
505 def NinjaBuild(targets, out_dir, arch): | |
506 if type(targets) is not list: | |
507 targets = [targets] | |
508 out_config_dir = os.path.join(out_dir, GetConfigDir(arch)) | |
509 buildbot_common.Run(['ninja', '-C', out_config_dir] + targets, cwd=SRC_DIR) | |
510 | 441 |
511 | 442 |
512 def BuildStepBuildToolchains(pepperdir, toolchains, build, clean): | 443 def BuildStepBuildToolchains(pepperdir, toolchains, build, clean): |
513 buildbot_common.BuildStep('SDK Items') | 444 buildbot_common.BuildStep('SDK Items') |
514 | 445 |
515 if clean: | 446 if clean: |
516 for dirname in glob.glob(os.path.join(OUT_DIR, GYPBUILD_DIR + '*')): | 447 for dirname in glob.glob(os.path.join(OUT_DIR, GNBUILD_DIR + '*')): |
517 buildbot_common.RemoveDir(dirname) | 448 buildbot_common.RemoveDir(dirname) |
518 build = True | 449 build = True |
519 | 450 |
520 if build: | 451 if build: |
521 GypNinjaBuild_NaCl(GYPBUILD_DIR) | 452 GnNinjaBuildAll(GNBUILD_DIR) |
522 GypNinjaBuild_Breakpad(GYPBUILD_DIR + '-x64') | |
523 | 453 |
524 if 'x86_glibc' in toolchains or 'pnacl' in toolchains: | 454 GnNinjaInstall(pepperdir, toolchains) |
525 GypNinjaBuild_PPAPI('ia32', GYPBUILD_DIR + '-ia32') | |
526 GypNinjaBuild_PPAPI('x64', GYPBUILD_DIR + '-x64') | |
527 | |
528 if 'arm_glibc' in toolchains or 'pnacl' in toolchains: | |
529 GypNinjaBuild_PPAPI('arm', GYPBUILD_DIR + '-arm') | |
530 | |
531 if 'pnacl' in toolchains: | |
532 # NOTE: For ia32, gyp builds both x86-32 and x86-64 by default. | |
533 for arch in ('ia32', 'arm'): | |
534 # Fill in the latest native pnacl shim library from the chrome build. | |
535 build_dir = GYPBUILD_DIR + '-pnacl-' + arch | |
536 GypNinjaBuild_Pnacl(arch, build_dir) | |
537 | |
538 GypNinjaInstall(pepperdir, toolchains) | |
539 | 455 |
540 for toolchain in toolchains: | 456 for toolchain in toolchains: |
541 if toolchain not in ('host', 'clang-newlib'): | 457 if toolchain not in ('host', 'clang-newlib'): |
542 InstallNaClHeaders(GetToolchainNaClInclude(pepperdir, toolchain), | 458 InstallNaClHeaders(GetToolchainNaClInclude(pepperdir, toolchain), |
543 toolchain) | 459 toolchain) |
544 | 460 |
545 | 461 |
546 if 'pnacl' in toolchains: | 462 if 'pnacl' in toolchains: |
547 # NOTE: For ia32, gyp builds both x86-32 and x86-64 by default. | 463 # NOTE: gn build all untrusted code in the x86 build |
548 for arch in ('ia32', 'arm'): | 464 build_dir = GetNinjaOutDir('x64') |
549 # Fill in the latest native pnacl shim library from the chrome build. | 465 nacl_arches = ['x86', 'x64', 'arm'] |
550 build_dir = GYPBUILD_DIR + '-pnacl-' + arch | 466 for nacl_arch in nacl_arches: |
551 if arch == 'ia32': | 467 shim_file = os.path.join(build_dir, 'clang_newlib_' + nacl_arch, 'obj', |
552 nacl_arches = ['x86-32', 'x86-64'] | 468 'ppapi', 'native_client', 'src', 'untrusted', |
553 elif arch == 'arm': | 469 'pnacl_irt_shim', 'libpnacl_irt_shim.a') |
554 nacl_arches = ['arm'] | |
555 else: | |
556 buildbot_common.ErrorExit('Unknown architecture: %s' % arch) | |
557 for nacl_arch in nacl_arches: | |
558 release_build_dir = os.path.join(OUT_DIR, build_dir, 'Release', | |
559 'gen', 'tc_pnacl_translate', | |
560 'lib-' + nacl_arch) | |
561 | 470 |
562 pnacldir = GetToolchainDir(pepperdir, 'pnacl') | 471 pnacldir = GetToolchainDir(pepperdir, 'pnacl') |
563 pnacl_translator_lib_dir = GetPNaClTranslatorLib(pnacldir, nacl_arch) | 472 pnacl_translator_lib_dir = GetPNaClTranslatorLib(pnacldir, nacl_arch) |
564 if not os.path.isdir(pnacl_translator_lib_dir): | 473 if not os.path.isdir(pnacl_translator_lib_dir): |
565 buildbot_common.ErrorExit('Expected %s directory to exist.' % | 474 buildbot_common.ErrorExit('Expected %s directory to exist.' % |
566 pnacl_translator_lib_dir) | 475 pnacl_translator_lib_dir) |
567 | 476 |
568 buildbot_common.CopyFile( | 477 buildbot_common.CopyFile(shim_file, pnacl_translator_lib_dir) |
569 os.path.join(release_build_dir, 'libpnacl_irt_shim.a'), | |
570 pnacl_translator_lib_dir) | |
571 | 478 |
572 InstallNaClHeaders(GetToolchainNaClInclude(pepperdir, 'pnacl', 'x86'), | 479 InstallNaClHeaders(GetToolchainNaClInclude(pepperdir, 'pnacl', 'x86'), |
573 'pnacl') | 480 'pnacl') |
574 InstallNaClHeaders(GetToolchainNaClInclude(pepperdir, 'pnacl', 'arm'), | 481 InstallNaClHeaders(GetToolchainNaClInclude(pepperdir, 'pnacl', 'arm'), |
575 'pnacl') | 482 'pnacl') |
576 | 483 |
577 | 484 |
578 def MakeDirectoryOrClobber(pepperdir, dirname, clobber): | 485 def MakeDirectoryOrClobber(pepperdir, dirname, clobber): |
579 dirpath = os.path.join(pepperdir, dirname) | 486 dirpath = os.path.join(pepperdir, dirname) |
580 if clobber: | 487 if clobber: |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
806 parser.add_argument('--release', help='PPAPI release version.', | 713 parser.add_argument('--release', help='PPAPI release version.', |
807 dest='release', default=None) | 714 dest='release', default=None) |
808 parser.add_argument('--build-app-engine', | 715 parser.add_argument('--build-app-engine', |
809 help='Build AppEngine demos.', action='store_true') | 716 help='Build AppEngine demos.', action='store_true') |
810 parser.add_argument('--experimental', | 717 parser.add_argument('--experimental', |
811 help='build experimental examples and libraries', action='store_true', | 718 help='build experimental examples and libraries', action='store_true', |
812 dest='build_experimental') | 719 dest='build_experimental') |
813 parser.add_argument('--skip-toolchain', help='Skip toolchain untar', | 720 parser.add_argument('--skip-toolchain', help='Skip toolchain untar', |
814 action='store_true') | 721 action='store_true') |
815 parser.add_argument('--no-clean', dest='clean', action='store_false', | 722 parser.add_argument('--no-clean', dest='clean', action='store_false', |
816 help="Don't clean gypbuild directories") | 723 help="Don't clean gn build directories") |
817 parser.add_argument('--mac-sdk', | 724 parser.add_argument('--mac-sdk', |
818 help='Set the mac-sdk (e.g. 10.6) to use when building with ninja.') | 725 help='Set the mac-sdk (e.g. 10.6) to use when building with ninja.') |
819 parser.add_argument('--no-arm-trusted', action='store_true', | 726 parser.add_argument('--no-arm-trusted', action='store_true', |
820 help='Disable building of ARM trusted components (sel_ldr, etc).') | 727 help='Disable building of ARM trusted components (sel_ldr, etc).') |
821 parser.add_argument('--no-use-sysroot', action='store_true', | 728 parser.add_argument('--no-use-sysroot', action='store_true', |
822 help='Disable building against sysroot.') | 729 help='Disable building against sysroot.') |
823 | 730 |
824 # To setup bash completion for this command first install optcomplete | 731 # To setup bash completion for this command first install optcomplete |
825 # and then add this line to your .bashrc: | 732 # and then add this line to your .bashrc: |
826 # complete -F _optcomplete build_sdk.py | 733 # complete -F _optcomplete build_sdk.py |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
952 BuildStepArchivePNaClComponent(chrome_revision) | 859 BuildStepArchivePNaClComponent(chrome_revision) |
953 | 860 |
954 return 0 | 861 return 0 |
955 | 862 |
956 | 863 |
957 if __name__ == '__main__': | 864 if __name__ == '__main__': |
958 try: | 865 try: |
959 sys.exit(main(sys.argv[1:])) | 866 sys.exit(main(sys.argv[1:])) |
960 except KeyboardInterrupt: | 867 except KeyboardInterrupt: |
961 buildbot_common.ErrorExit('build_sdk: interrupted') | 868 buildbot_common.ErrorExit('build_sdk: interrupted') |
OLD | NEW |