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
4 # found in the LICENSE file.
6 """Entry point for both build and try bots.
8 This script is invoked from XXX, usually without arguments
9 to package an SDK. It automatically determines whether
10 this SDK is for mac, win, linux.
12 The script inspects the following environment variables:
14 BUILDBOT_BUILDERNAME to determine whether the script is run locally
15 and whether it should upload an SDK to file storage (GSTORE)
18 # pylint: disable=W0621
28 if sys
.version_info
< (2, 7, 0):
29 sys
.stderr
.write("python 2.7 or later is required run this script\n")
33 import buildbot_common
37 import generate_notice
40 import verify_filelist
42 from build_paths
import SCRIPT_DIR
, SDK_SRC_DIR
, SRC_DIR
, NACL_DIR
, OUT_DIR
43 from build_paths
import NACLPORTS_DIR
, GSTORE
, GONACL_APPENGINE_SRC_DIR
45 # Add SDK make tools scripts to the python path.
46 sys
.path
.append(os
.path
.join(SDK_SRC_DIR
, 'tools'))
47 sys
.path
.append(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')
54 NACL_TOOLCHAINTARS_DIR
= os
.path
.join(NACL_TOOLCHAIN_DIR
, '.tars')
56 CYGTAR
= os
.path
.join(BUILD_DIR
, 'cygtar.py')
57 PKGVER
= os
.path
.join(BUILD_DIR
, 'package_version', 'package_version.py')
59 NACLPORTS_URL
= 'https://chromium.googlesource.com/external/naclports.git'
60 NACLPORTS_REV
= '65c71c1524a74ff8415573e5e5ef7c59ce4ac437'
62 GYPBUILD_DIR
= 'gypbuild'
66 # Map of: ToolchainName: (PackageName, SDKDir, arch).
67 TOOLCHAIN_PACKAGE_MAP
= {
68 'arm_newlib': ('nacl_arm_newlib', '%(platform)s_arm_newlib', 'arm'),
69 'arm_glibc': ('nacl_arm_glibc', '%(platform)s_arm_glibc', 'arm'),
70 'x86_newlib': ('nacl_x86_newlib', '%(platform)s_x86_newlib', 'x86'),
71 'x86_glibc': ('nacl_x86_glibc', '%(platform)s_x86_glibc', 'x86'),
72 'arm_bionic': ('nacl_arm_bionic', '%(platform)s_arm_bionic', 'arm'),
73 'pnacl': ('pnacl_newlib', '%(platform)s_pnacl', 'pnacl')
77 def GetToolchainDirName(tcname
):
78 """Return the directory name for a given toolchain"""
79 return TOOLCHAIN_PACKAGE_MAP
[tcname
][1] % {'platform': getos
.GetPlatform()}
82 def GetToolchainDir(pepperdir
, tcname
):
83 """Return the full path to a given toolchain within a given sdk root"""
84 return os
.path
.join(pepperdir
, 'toolchain', GetToolchainDirName(tcname
))
87 def GetToolchainLibc(tcname
):
90 for libc
in ('bionic', 'glibc', 'newlib', 'host'):
95 def GetToolchainNaClInclude(pepperdir
, tcname
, arch
=None):
96 tcpath
= GetToolchainDir(pepperdir
, tcname
)
98 arch
= TOOLCHAIN_PACKAGE_MAP
[tcname
][2]
100 return os
.path
.join(tcpath
, 'x86_64-nacl', 'include')
101 elif arch
== 'pnacl':
102 return os
.path
.join(tcpath
, 'le32-nacl', 'include')
104 return os
.path
.join(tcpath
, 'arm-nacl', 'include')
106 buildbot_common
.ErrorExit('Unknown architecture: %s' % arch
)
109 def GetConfigDir(arch
):
110 if arch
.endswith('x64') and getos
.GetPlatform() == 'win':
116 def GetNinjaOutDir(arch
):
117 return os
.path
.join(OUT_DIR
, GYPBUILD_DIR
+ '-' + arch
, GetConfigDir(arch
))
120 def GetGypBuiltLib(tcname
, arch
):
130 if tcname
== 'arm_bionic':
133 tcdir
= 'tc_' + GetToolchainLibc(tcname
)
135 if tcname
== 'pnacl':
138 tcdir
= 'tc_pnacl_newlib'
141 arch
= 'clang-' + arch
143 return os
.path
.join(GetNinjaOutDir(arch
), 'gen', tcdir
, 'lib' + lib_suffix
)
146 def GetToolchainNaClLib(tcname
, tcpath
, arch
):
148 return os
.path
.join(tcpath
, 'x86_64-nacl', 'lib32')
150 return os
.path
.join(tcpath
, 'x86_64-nacl', 'lib')
152 return os
.path
.join(tcpath
, 'arm-nacl', 'lib')
153 elif tcname
== 'pnacl':
154 return os
.path
.join(tcpath
, 'le32-nacl', 'lib')
158 def GetOutputToolchainLib(pepperdir
, tcname
, arch
):
159 tcpath
= os
.path
.join(pepperdir
, 'toolchain', GetToolchainDirName(tcname
))
160 return GetToolchainNaClLib(tcname
, tcpath
, arch
)
163 def GetPNaClTranslatorLib(tcpath
, arch
):
164 if arch
not in ['arm', 'x86-32', 'x86-64']:
165 buildbot_common
.ErrorExit('Unknown architecture %s.' % arch
)
166 return os
.path
.join(tcpath
, 'translator', arch
, 'lib')
169 def BuildStepDownloadToolchains(toolchains
):
170 buildbot_common
.BuildStep('Running package_version.py')
171 args
= [sys
.executable
, PKGVER
, '--mode', 'nacl_core_sdk']
172 if 'arm_bionic' in toolchains
:
173 build_platform
= '%s_x86' % getos
.GetPlatform()
174 args
.extend(['--append', os
.path
.join(build_platform
, 'nacl_arm_bionic')])
175 args
.extend(['sync', '--extract'])
176 buildbot_common
.Run(args
, cwd
=NACL_DIR
)
179 def BuildStepCleanPepperDirs(pepperdir
, pepperdir_old
):
180 buildbot_common
.BuildStep('Clean Pepper Dirs')
184 os
.path
.join(OUT_DIR
, 'arm_trusted')
186 for dirname
in dirs_to_remove
:
187 if os
.path
.exists(dirname
):
188 buildbot_common
.RemoveDir(dirname
)
189 buildbot_common
.MakeDir(pepperdir
)
192 def BuildStepMakePepperDirs(pepperdir
, subdirs
):
193 for subdir
in subdirs
:
194 buildbot_common
.MakeDir(os
.path
.join(pepperdir
, subdir
))
201 'getting_started/README',
204 def BuildStepCopyTextFiles(pepperdir
, pepper_ver
, chrome_revision
,
206 buildbot_common
.BuildStep('Add Text Files')
207 InstallFiles(SDK_SRC_DIR
, pepperdir
, TEXT_FILES
)
209 # Replace a few placeholders in README
210 readme_text
= open(os
.path
.join(SDK_SRC_DIR
, 'README')).read()
211 readme_text
= readme_text
.replace('${VERSION}', pepper_ver
)
212 readme_text
= readme_text
.replace('${CHROME_REVISION}', chrome_revision
)
213 readme_text
= readme_text
.replace('${CHROME_COMMIT_POSITION}',
214 build_version
.ChromeCommitPosition())
215 readme_text
= readme_text
.replace('${NACL_REVISION}', nacl_revision
)
217 # Year/Month/Day Hour:Minute:Second
218 time_format
= '%Y/%m/%d %H:%M:%S'
219 readme_text
= readme_text
.replace('${DATE}',
220 datetime
.datetime
.now().strftime(time_format
))
222 open(os
.path
.join(pepperdir
, 'README'), 'w').write(readme_text
)
225 def BuildStepUntarToolchains(pepperdir
, toolchains
):
226 buildbot_common
.BuildStep('Untar Toolchains')
227 platform
= getos
.GetPlatform()
228 build_platform
= '%s_x86' % platform
229 tmpdir
= os
.path
.join(OUT_DIR
, 'tc_temp')
230 buildbot_common
.RemoveDir(tmpdir
)
231 buildbot_common
.MakeDir(tmpdir
)
233 # Create a list of extract packages tuples, the first part should be
234 # "$PACKAGE_TARGET/$PACKAGE". The second part should be the destination
235 # directory relative to pepperdir/toolchain.
236 extract_packages
= []
237 for toolchain
in toolchains
:
238 toolchain_map
= TOOLCHAIN_PACKAGE_MAP
.get(toolchain
, None)
240 package_name
, tcdir
, _
= toolchain_map
241 package_tuple
= (os
.path
.join(build_platform
, package_name
),
242 tcdir
% {'platform': platform
})
243 extract_packages
.append(package_tuple
)
246 # On linux we also want to extract the arm_trusted package which contains
247 # the ARM libraries we ship in support of sel_ldr_arm.
248 if platform
== 'linux':
249 extract_packages
.append((os
.path
.join(build_platform
, 'arm_trusted'),
252 # Extract all of the packages into the temp directory.
253 package_names
= [package_tuple
[0] for package_tuple
in extract_packages
]
254 buildbot_common
.Run([sys
.executable
, PKGVER
,
255 '--packages', ','.join(package_names
),
256 '--tar-dir', NACL_TOOLCHAINTARS_DIR
,
257 '--dest-dir', tmpdir
,
260 # Move all the packages we extracted to the correct destination.
261 for package_name
, dest_dir
in extract_packages
:
262 full_src_dir
= os
.path
.join(tmpdir
, package_name
)
263 full_dst_dir
= os
.path
.join(pepperdir
, 'toolchain', dest_dir
)
264 buildbot_common
.Move(full_src_dir
, full_dst_dir
)
266 # Cleanup the temporary directory we are no longer using.
267 buildbot_common
.RemoveDir(tmpdir
)
270 # List of toolchain headers to install.
271 # Source is relative to top of Chromium tree, destination is relative
272 # to the toolchain header directory.
275 ('native_client/src/include/nacl/nacl_exception.h', 'nacl/'),
276 ('native_client/src/include/nacl/nacl_minidump.h', 'nacl/'),
277 ('native_client/src/untrusted/irt/irt.h', ''),
278 ('native_client/src/untrusted/irt/irt_dev.h', ''),
279 ('native_client/src/untrusted/irt/irt_extension.h', ''),
280 ('native_client/src/untrusted/nacl/nacl_dyncode.h', 'nacl/'),
281 ('native_client/src/untrusted/nacl/nacl_startup.h', 'nacl/'),
282 ('native_client/src/untrusted/pthread/pthread.h', ''),
283 ('native_client/src/untrusted/pthread/semaphore.h', ''),
284 ('native_client/src/untrusted/valgrind/dynamic_annotations.h', 'nacl/'),
285 ('ppapi/nacl_irt/public/irt_ppapi.h', ''),
288 ('native_client/src/include/nacl/nacl_exception.h', 'nacl/'),
289 ('native_client/src/include/nacl/nacl_minidump.h', 'nacl/'),
290 ('native_client/src/untrusted/irt/irt.h', ''),
291 ('native_client/src/untrusted/irt/irt_dev.h', ''),
292 ('native_client/src/untrusted/irt/irt_extension.h', ''),
293 ('native_client/src/untrusted/nacl/nacl_dyncode.h', 'nacl/'),
294 ('native_client/src/untrusted/nacl/nacl_startup.h', 'nacl/'),
295 ('native_client/src/untrusted/valgrind/dynamic_annotations.h', 'nacl/'),
296 ('ppapi/nacl_irt/public/irt_ppapi.h', ''),
299 ('ppapi/nacl_irt/public/irt_ppapi.h', ''),
303 def InstallFiles(src_root
, dest_root
, file_list
):
304 """Copy a set of files from src_root to dest_root according
305 to the given mapping. This allows files to be copied from
306 to a location in the destination tree that is different to the
307 location in the source tree.
309 If the destination mapping ends with a '/' then the destination
310 basename is inherited from the the source file.
312 Wildcards can be used in the source list but it is not recommended
313 as this can end up adding things to the SDK unintentionally.
315 for file_spec
in file_list
:
316 # The list of files to install can be a simple list of
317 # strings or a list of pairs, where each pair corresponds
318 # to a mapping from source to destination names.
319 if type(file_spec
) == str:
320 src_file
= dest_file
= file_spec
322 src_file
, dest_file
= file_spec
324 src_file
= os
.path
.join(src_root
, src_file
)
326 # Expand sources files using glob.
327 sources
= glob
.glob(src_file
)
331 if len(sources
) > 1 and not dest_file
.endswith('/'):
332 buildbot_common
.ErrorExit("Target file must end in '/' when "
333 "using globbing to install multiple files")
335 for source
in sources
:
336 if dest_file
.endswith('/'):
337 dest
= os
.path
.join(dest_file
, os
.path
.basename(source
))
340 dest
= os
.path
.join(dest_root
, dest
)
341 if not os
.path
.isdir(os
.path
.dirname(dest
)):
342 buildbot_common
.MakeDir(os
.path
.dirname(dest
))
343 buildbot_common
.CopyFile(source
, dest
)
346 def InstallNaClHeaders(tc_dst_inc
, tcname
):
347 """Copies NaCl headers to expected locations in the toolchain."""
348 InstallFiles(SRC_DIR
, tc_dst_inc
, NACL_HEADER_MAP
[GetToolchainLibc(tcname
)])
351 def MakeNinjaRelPath(path
):
352 return os
.path
.join(os
.path
.relpath(OUT_DIR
, SRC_DIR
), path
)
355 # TODO(ncbray): stop building and copying libraries into the SDK that are
356 # already provided by the toolchain.
357 # Mapping from libc to libraries gyp-build trusted libraries
360 'libminidump_generator.a',
362 'libnacl_exception.a',
363 'libnacl_list_mappings.a',
367 'libminidump_generator.a',
370 'libnacl_exception.a',
371 'libnacl_list_mappings.a',
378 'libminidump_generator.a',
379 'libminidump_generator.so',
382 'libnacl_dyncode.so',
383 'libnacl_exception.a',
384 'libnacl_exception.so',
385 'libnacl_list_mappings.a',
386 'libnacl_list_mappings.so',
394 def GypNinjaInstall(pepperdir
, toolchains
):
396 ['sel_ldr', 'sel_ldr_x86_32'],
397 ['irt_core_newlib_x32.nexe', 'irt_core_x86_32.nexe'],
398 ['irt_core_newlib_x64.nexe', 'irt_core_x86_64.nexe'],
403 platform
= getos
.GetPlatform()
405 # TODO(binji): dump_syms doesn't currently build on Windows. See
406 # http://crbug.com/245456
407 if platform
!= 'win':
409 ['dump_syms', 'dump_syms'],
410 ['minidump_dump', 'minidump_dump'],
411 ['minidump_stackwalk', 'minidump_stackwalk']
414 tools_files_64
.append(['sel_ldr', 'sel_ldr_x86_64'])
415 tools_files_64
.append(['ncval_new', 'ncval'])
417 if platform
== 'linux':
418 tools_files_32
.append(['nacl_helper_bootstrap',
419 'nacl_helper_bootstrap_x86_32'])
420 tools_files_64
.append(['nacl_helper_bootstrap',
421 'nacl_helper_bootstrap_x86_64'])
422 tools_files_32
.append(['nonsfi_loader_newlib_x32_nonsfi.nexe',
423 'nonsfi_loader_x86_32'])
425 tools_dir
= os
.path
.join(pepperdir
, 'tools')
426 buildbot_common
.MakeDir(tools_dir
)
428 # Add .exe extensions to all windows tools
429 for pair
in tools_files_32
+ tools_files_64
:
430 if platform
== 'win' and not pair
[0].endswith('.nexe'):
434 InstallFiles(GetNinjaOutDir('x64'), tools_dir
, tools_files_64
)
435 InstallFiles(GetNinjaOutDir('ia32'), tools_dir
, tools_files_32
)
438 if platform
== 'linux' and not options
.no_arm_trusted
:
440 ['irt_core_newlib_arm.nexe', 'irt_core_arm.nexe'],
441 ['elf_loader_newlib_arm.nexe', 'elf_loader_arm.nexe'],
442 ['nacl_helper_bootstrap', 'nacl_helper_bootstrap_arm'],
443 ['nonsfi_loader_newlib_arm_nonsfi.nexe', 'nonsfi_loader_arm'],
444 ['sel_ldr', 'sel_ldr_arm']
446 InstallFiles(GetNinjaOutDir('arm'), tools_dir
, arm_files
)
448 for tc
in toolchains
:
449 if tc
in ('host', 'clang-newlib'):
452 xarches
= (None, 'ia32', 'x64', 'arm')
453 elif tc
in ('x86_glibc', 'x86_newlib'):
454 xarches
= ('ia32', 'x64')
455 elif tc
in ('arm_glibc', 'arm_newlib', 'arm_bionic'):
458 raise AssertionError('unexpected toolchain value: %s' % tc
)
460 for xarch
in xarches
:
461 src_dir
= GetGypBuiltLib(tc
, xarch
)
462 dst_dir
= GetOutputToolchainLib(pepperdir
, tc
, xarch
)
463 libc
= GetToolchainLibc(tc
)
464 InstallFiles(src_dir
, dst_dir
, TOOLCHAIN_LIBS
[libc
])
467 def GypNinjaBuild_NaCl(rel_out_dir
):
468 # TODO(binji): gyp_nacl doesn't build properly on Windows anymore; it only
469 # can use VS2010, not VS2013 which is now required by the Chromium repo. NaCl
470 # needs to be updated to perform the same logic as Chromium in detecting VS,
471 # which can now exist in the depot_tools directory.
472 # See https://code.google.com/p/nativeclient/issues/detail?id=4022
474 # For now, let's use gyp_chromium to build these components.
475 # gyp_py = os.path.join(NACL_DIR, 'build', 'gyp_nacl')
476 gyp_py
= os
.path
.join(SRC_DIR
, 'build', 'gyp_chromium')
477 nacl_core_sdk_gyp
= os
.path
.join(NACL_DIR
, 'build', 'nacl_core_sdk.gyp')
478 all_gyp
= os
.path
.join(NACL_DIR
, 'build', 'all.gyp')
480 out_dir_32
= MakeNinjaRelPath(rel_out_dir
+ '-ia32')
481 out_dir_64
= MakeNinjaRelPath(rel_out_dir
+ '-x64')
482 out_dir_arm
= MakeNinjaRelPath(rel_out_dir
+ '-arm')
483 out_dir_clang_32
= MakeNinjaRelPath(rel_out_dir
+ '-clang-ia32')
484 out_dir_clang_64
= MakeNinjaRelPath(rel_out_dir
+ '-clang-x64')
485 out_dir_clang_arm
= MakeNinjaRelPath(rel_out_dir
+ '-clang-arm')
487 GypNinjaBuild('ia32', gyp_py
, nacl_core_sdk_gyp
, 'nacl_core_sdk', out_dir_32
,
488 gyp_defines
=['use_nacl_clang=0'])
489 GypNinjaBuild('x64', gyp_py
, nacl_core_sdk_gyp
, 'nacl_core_sdk', out_dir_64
,
490 gyp_defines
=['use_nacl_clang=0'])
491 GypNinjaBuild('arm', gyp_py
, nacl_core_sdk_gyp
, 'nacl_core_sdk', out_dir_arm
,
492 gyp_defines
=['use_nacl_clang=0'])
493 GypNinjaBuild('ia32', gyp_py
, nacl_core_sdk_gyp
, 'nacl_core_sdk',
494 out_dir_clang_32
, gyp_defines
=['use_nacl_clang=1'])
495 GypNinjaBuild('x64', gyp_py
, nacl_core_sdk_gyp
, 'nacl_core_sdk',
496 out_dir_clang_64
, gyp_defines
=['use_nacl_clang=1'])
497 GypNinjaBuild('arm', gyp_py
, nacl_core_sdk_gyp
, 'nacl_core_sdk',
498 out_dir_clang_arm
, gyp_defines
=['use_nacl_clang=1'])
499 GypNinjaBuild('x64', gyp_py
, all_gyp
, 'ncval_new', out_dir_64
)
502 def GypNinjaBuild_Breakpad(rel_out_dir
):
503 # TODO(binji): dump_syms doesn't currently build on Windows. See
504 # http://crbug.com/245456
505 if getos
.GetPlatform() == 'win':
508 gyp_py
= os
.path
.join(SRC_DIR
, 'build', 'gyp_chromium')
509 out_dir
= MakeNinjaRelPath(rel_out_dir
)
510 gyp_file
= os
.path
.join(SRC_DIR
, 'breakpad', 'breakpad.gyp')
511 build_list
= ['dump_syms', 'minidump_dump', 'minidump_stackwalk']
512 GypNinjaBuild('x64', gyp_py
, gyp_file
, build_list
, out_dir
)
515 def GypNinjaBuild_PPAPI(arch
, rel_out_dir
, gyp_defines
=None):
516 gyp_py
= os
.path
.join(SRC_DIR
, 'build', 'gyp_chromium')
517 out_dir
= MakeNinjaRelPath(rel_out_dir
)
518 gyp_file
= os
.path
.join(SRC_DIR
, 'ppapi', 'native_client',
520 GypNinjaBuild(arch
, gyp_py
, gyp_file
, 'ppapi_lib', out_dir
,
521 gyp_defines
=gyp_defines
)
524 def GypNinjaBuild_Pnacl(rel_out_dir
, target_arch
):
525 # TODO(binji): This will build the pnacl_irt_shim twice; once as part of the
526 # Chromium build, and once here. When we move more of the SDK build process
527 # to gyp, we can remove this.
528 gyp_py
= os
.path
.join(SRC_DIR
, 'build', 'gyp_chromium')
530 out_dir
= MakeNinjaRelPath(rel_out_dir
)
531 gyp_file
= os
.path
.join(SRC_DIR
, 'ppapi', 'native_client', 'src',
532 'untrusted', 'pnacl_irt_shim', 'pnacl_irt_shim.gyp')
534 GypNinjaBuild(target_arch
, gyp_py
, gyp_file
, targets
, out_dir
)
537 def GypNinjaBuild(arch
, gyp_py_script
, gyp_file
, targets
,
538 out_dir
, gyp_defines
=None):
539 gyp_env
= dict(os
.environ
)
540 gyp_env
['GYP_GENERATORS'] = 'ninja'
541 gyp_defines
= gyp_defines
or []
542 gyp_defines
.append('nacl_allow_thin_archives=0')
543 if not options
.no_use_sysroot
:
544 gyp_defines
.append('use_sysroot=1')
546 gyp_defines
.append('mac_sdk=%s' % options
.mac_sdk
)
549 gyp_defines
.append('target_arch=%s' % arch
)
551 gyp_env
['GYP_CROSSCOMPILE'] = '1'
552 if options
.no_arm_trusted
:
553 gyp_defines
.append('disable_cross_trusted=1')
554 if getos
.GetPlatform() == 'mac':
555 gyp_defines
.append('clang=1')
557 gyp_env
['GYP_DEFINES'] = ' '.join(gyp_defines
)
558 # We can't use windows path separators in GYP_GENERATOR_FLAGS since
559 # gyp uses shlex to parse them and treats '\' as an escape char.
560 gyp_env
['GYP_GENERATOR_FLAGS'] = 'output_dir=%s' % out_dir
.replace('\\', '/')
562 # Print relevant environment variables
563 for key
, value
in gyp_env
.iteritems():
564 if key
.startswith('GYP') or key
in ('CC',):
565 print ' %s="%s"' % (key
, value
)
568 [sys
.executable
, gyp_py_script
, gyp_file
, '--depth=.'],
572 NinjaBuild(targets
, out_dir
, arch
)
575 def NinjaBuild(targets
, out_dir
, arch
):
576 if type(targets
) is not list:
578 out_config_dir
= os
.path
.join(out_dir
, GetConfigDir(arch
))
579 buildbot_common
.Run(['ninja', '-C', out_config_dir
] + targets
, cwd
=SRC_DIR
)
582 def BuildStepBuildToolchains(pepperdir
, toolchains
, build
, clean
):
583 buildbot_common
.BuildStep('SDK Items')
586 for dirname
in glob
.glob(os
.path
.join(OUT_DIR
, GYPBUILD_DIR
+ '*')):
587 buildbot_common
.RemoveDir(dirname
)
591 GypNinjaBuild_NaCl(GYPBUILD_DIR
)
592 GypNinjaBuild_Breakpad(GYPBUILD_DIR
+ '-x64')
594 if set(toolchains
) & set(['x86_glibc', 'x86_newlib']):
595 GypNinjaBuild_PPAPI('ia32', GYPBUILD_DIR
+ '-ia32',
596 ['use_nacl_clang=0'])
597 GypNinjaBuild_PPAPI('x64', GYPBUILD_DIR
+ '-x64',
598 ['use_nacl_clang=0'])
600 if set(toolchains
) & set(['arm_glibc', 'arm_newlib']):
601 GypNinjaBuild_PPAPI('arm', GYPBUILD_DIR
+ '-arm',
602 ['use_nacl_clang=0'] )
604 if 'pnacl' in toolchains
:
605 GypNinjaBuild_PPAPI('ia32', GYPBUILD_DIR
+ '-clang-ia32',
606 ['use_nacl_clang=1'])
607 GypNinjaBuild_PPAPI('x64', GYPBUILD_DIR
+ '-clang-x64',
608 ['use_nacl_clang=1'])
609 GypNinjaBuild_PPAPI('arm', GYPBUILD_DIR
+ '-clang-arm',
610 ['use_nacl_clang=1'])
612 # NOTE: For ia32, gyp builds both x86-32 and x86-64 by default.
613 for arch
in ('ia32', 'arm'):
614 # Fill in the latest native pnacl shim library from the chrome build.
615 build_dir
= GYPBUILD_DIR
+ '-pnacl-' + arch
616 GypNinjaBuild_Pnacl(build_dir
, arch
)
618 GypNinjaInstall(pepperdir
, toolchains
)
620 for toolchain
in toolchains
:
621 if toolchain
not in ('host', 'clang-newlib'):
622 InstallNaClHeaders(GetToolchainNaClInclude(pepperdir
, toolchain
),
626 if 'pnacl' in toolchains
:
627 # NOTE: For ia32, gyp builds both x86-32 and x86-64 by default.
628 for arch
in ('ia32', 'arm'):
629 # Fill in the latest native pnacl shim library from the chrome build.
630 build_dir
= GYPBUILD_DIR
+ '-pnacl-' + arch
632 nacl_arches
= ['x86-32', 'x86-64']
634 nacl_arches
= ['arm']
636 buildbot_common
.ErrorExit('Unknown architecture: %s' % arch
)
637 for nacl_arch
in nacl_arches
:
638 release_build_dir
= os
.path
.join(OUT_DIR
, build_dir
, 'Release',
639 'gen', 'tc_pnacl_translate',
642 pnacldir
= GetToolchainDir(pepperdir
, 'pnacl')
643 pnacl_translator_lib_dir
= GetPNaClTranslatorLib(pnacldir
, nacl_arch
)
644 if not os
.path
.isdir(pnacl_translator_lib_dir
):
645 buildbot_common
.ErrorExit('Expected %s directory to exist.' %
646 pnacl_translator_lib_dir
)
648 buildbot_common
.CopyFile(
649 os
.path
.join(release_build_dir
, 'libpnacl_irt_shim.a'),
650 pnacl_translator_lib_dir
)
652 InstallNaClHeaders(GetToolchainNaClInclude(pepperdir
, 'pnacl', 'x86'),
654 InstallNaClHeaders(GetToolchainNaClInclude(pepperdir
, 'pnacl', 'arm'),
658 def MakeDirectoryOrClobber(pepperdir
, dirname
, clobber
):
659 dirpath
= os
.path
.join(pepperdir
, dirname
)
661 buildbot_common
.RemoveDir(dirpath
)
662 buildbot_common
.MakeDir(dirpath
)
667 def BuildStepUpdateHelpers(pepperdir
, clobber
):
668 buildbot_common
.BuildStep('Update project helpers')
669 build_projects
.UpdateHelpers(pepperdir
, clobber
=clobber
)
672 def BuildStepUpdateUserProjects(pepperdir
, toolchains
,
673 build_experimental
, clobber
):
674 buildbot_common
.BuildStep('Update examples and libraries')
677 if not build_experimental
:
678 filters
['EXPERIMENTAL'] = False
682 if t
.startswith('x86_') or t
.startswith('arm_'):
683 if t
[4:] not in dsc_toolchains
:
684 dsc_toolchains
.append(t
[4:])
686 dsc_toolchains
.append(getos
.GetPlatform())
688 dsc_toolchains
.append(t
)
690 filters
['TOOLS'] = dsc_toolchains
692 # Update examples and libraries
701 tree
= parse_dsc
.LoadProjectTree(SDK_SRC_DIR
, include
=filters
)
702 build_projects
.UpdateProjects(pepperdir
, tree
, clobber
=clobber
,
703 toolchains
=dsc_toolchains
)
706 def BuildStepMakeAll(pepperdir
, directory
, step_name
,
707 deps
=True, clean
=False, config
='Debug', args
=None):
708 buildbot_common
.BuildStep(step_name
)
709 build_projects
.BuildProjectsBranch(pepperdir
, directory
, clean
,
713 def BuildStepBuildLibraries(pepperdir
, directory
):
714 BuildStepMakeAll(pepperdir
, directory
, 'Build Libraries Debug',
715 clean
=True, config
='Debug')
716 BuildStepMakeAll(pepperdir
, directory
, 'Build Libraries Release',
717 clean
=True, config
='Release')
719 # Cleanup .pyc file generated while building libraries. Without
720 # this we would end up shipping the pyc in the SDK tarball.
721 buildbot_common
.RemoveFile(os
.path
.join(pepperdir
, 'tools', '*.pyc'))
724 def GenerateNotice(fileroot
, output_filename
='NOTICE', extra_files
=None):
725 # Look for LICENSE files
726 license_filenames_re
= re
.compile('LICENSE|COPYING|COPYRIGHT')
729 for root
, _
, files
in os
.walk(fileroot
):
730 for filename
in files
:
731 if license_filenames_re
.match(filename
):
732 path
= os
.path
.join(root
, filename
)
733 license_files
.append(path
)
736 license_files
+= [os
.path
.join(fileroot
, f
) for f
in extra_files
]
737 print '\n'.join(license_files
)
739 if not os
.path
.isabs(output_filename
):
740 output_filename
= os
.path
.join(fileroot
, output_filename
)
741 generate_notice
.Generate(output_filename
, fileroot
, license_files
)
744 def BuildStepVerifyFilelist(pepperdir
):
745 buildbot_common
.BuildStep('Verify SDK Files')
746 file_list_path
= os
.path
.join(SCRIPT_DIR
, 'sdk_files.list')
748 print 'SDK directory: %s' % pepperdir
749 verify_filelist
.Verify(file_list_path
, pepperdir
)
751 except verify_filelist
.ParseException
, e
:
752 buildbot_common
.ErrorExit('Parsing sdk_files.list failed:\n\n%s' % e
)
753 except verify_filelist
.VerifyException
, e
:
754 file_list_rel
= os
.path
.relpath(file_list_path
)
755 verify_filelist_py
= os
.path
.splitext(verify_filelist
.__file
__)[0] + '.py'
756 verify_filelist_py
= os
.path
.relpath(verify_filelist_py
)
757 pepperdir_rel
= os
.path
.relpath(pepperdir
)
760 SDK verification failed:
763 Add/remove files from %s to fix.
767 to test.""" % (e
, file_list_rel
, verify_filelist_py
, file_list_rel
,
769 buildbot_common
.ErrorExit(msg
)
772 def BuildStepTarBundle(pepper_ver
, tarfile
):
773 buildbot_common
.BuildStep('Tar Pepper Bundle')
774 buildbot_common
.MakeDir(os
.path
.dirname(tarfile
))
775 buildbot_common
.Run([sys
.executable
, CYGTAR
, '-C', OUT_DIR
, '-cjf', tarfile
,
776 'pepper_' + pepper_ver
], cwd
=NACL_DIR
)
779 def GetManifestBundle(pepper_ver
, chrome_revision
, nacl_revision
, tarfile
,
781 with
open(tarfile
, 'rb') as tarfile_stream
:
782 archive_sha1
, archive_size
= manifest_util
.DownloadAndComputeHash(
785 archive
= manifest_util
.Archive(manifest_util
.GetHostOS())
786 archive
.url
= archive_url
787 archive
.size
= archive_size
788 archive
.checksum
= archive_sha1
790 bundle
= manifest_util
.Bundle('pepper_' + pepper_ver
)
791 bundle
.revision
= int(chrome_revision
)
792 bundle
.repath
= 'pepper_' + pepper_ver
793 bundle
.version
= int(pepper_ver
)
794 bundle
.description
= (
795 'Chrome %s bundle. Chrome revision: %s. NaCl revision: %s' % (
796 pepper_ver
, chrome_revision
, nacl_revision
))
797 bundle
.stability
= 'dev'
798 bundle
.recommended
= 'no'
799 bundle
.archives
= [archive
]
803 def Archive(filename
, from_directory
, step_link
=True):
804 if buildbot_common
.IsSDKBuilder():
805 bucket_path
= 'nativeclient-mirror/nacl/nacl_sdk/'
807 bucket_path
= 'nativeclient-mirror/nacl/nacl_sdk_test/'
808 bucket_path
+= build_version
.ChromeVersion()
809 buildbot_common
.Archive(filename
, bucket_path
, from_directory
, step_link
)
812 def BuildStepArchiveBundle(name
, pepper_ver
, chrome_revision
, nacl_revision
,
814 buildbot_common
.BuildStep('Archive %s' % name
)
815 tarname
= os
.path
.basename(tarfile
)
816 tarfile_dir
= os
.path
.dirname(tarfile
)
817 Archive(tarname
, tarfile_dir
)
819 # generate "manifest snippet" for this archive.
820 archive_url
= GSTORE
+ 'nacl_sdk/%s/%s' % (
821 build_version
.ChromeVersion(), tarname
)
822 bundle
= GetManifestBundle(pepper_ver
, chrome_revision
, nacl_revision
,
823 tarfile
, archive_url
)
825 manifest_snippet_file
= os
.path
.join(OUT_DIR
, tarname
+ '.json')
826 with
open(manifest_snippet_file
, 'wb') as manifest_snippet_stream
:
827 manifest_snippet_stream
.write(bundle
.GetDataAsString())
829 Archive(tarname
+ '.json', OUT_DIR
, step_link
=False)
832 def BuildStepBuildPNaClComponent(version
, revision
):
833 # Sadly revision can go backwords for a given version since when a version
834 # is built from master, revision will be a huge number (in the hundreds of
835 # thousands. Once the branch happens the revision will reset to zero.
836 # TODO(sbc): figure out how to compensate for this in some way such that
837 # revisions always go forward for a given version.
838 buildbot_common
.BuildStep('PNaCl Component')
839 # Version numbers must follow the format specified in:
840 # https://developer.chrome.com/extensions/manifest/version
841 # So ensure that rev_major/rev_minor don't overflow and ensure there
842 # are no leading zeros.
843 if len(revision
) > 4:
844 rev_minor
= int(revision
[-4:])
845 rev_major
= int(revision
[:-4])
846 version
= "0.%s.%s.%s" % (version
, rev_major
, rev_minor
)
848 version
= "0.%s.0.%s" % (version
, revision
)
849 buildbot_common
.Run(['./make_pnacl_component.sh',
850 'pnacl_multicrx_%s.zip' % revision
,
851 version
], cwd
=SCRIPT_DIR
)
854 def BuildStepArchivePNaClComponent(revision
):
855 buildbot_common
.BuildStep('Archive PNaCl Component')
856 Archive('pnacl_multicrx_%s.zip' % revision
, OUT_DIR
)
859 def BuildStepArchiveSDKTools():
860 buildbot_common
.BuildStep('Build SDK Tools')
861 build_updater
.BuildUpdater(OUT_DIR
)
863 buildbot_common
.BuildStep('Archive SDK Tools')
864 Archive('sdk_tools.tgz', OUT_DIR
, step_link
=False)
865 Archive('nacl_sdk.zip', OUT_DIR
, step_link
=False)
868 def BuildStepSyncNaClPorts():
869 """Pull the pinned revision of naclports from SVN."""
870 buildbot_common
.BuildStep('Sync naclports')
872 # In case a previous non-gclient checkout exists, remove it.
873 # TODO(sbc): remove this once all the build machines
874 # have removed the old checkout
875 if (os
.path
.exists(NACLPORTS_DIR
) and
876 not os
.path
.exists(os
.path
.join(NACLPORTS_DIR
, 'src'))):
877 buildbot_common
.RemoveDir(NACLPORTS_DIR
)
879 if not os
.path
.exists(NACLPORTS_DIR
):
880 buildbot_common
.MakeDir(NACLPORTS_DIR
)
881 # checkout new copy of naclports
882 cmd
= ['gclient', 'config', '--name=src', NACLPORTS_URL
]
883 buildbot_common
.Run(cmd
, cwd
=NACLPORTS_DIR
)
885 # sync to required revision
886 cmd
= ['gclient', 'sync', '-R', '-r', 'src@' + str(NACLPORTS_REV
)]
887 buildbot_common
.Run(cmd
, cwd
=NACLPORTS_DIR
)
890 def BuildStepBuildNaClPorts(pepper_ver
, pepperdir
):
891 """Build selected naclports in all configurations."""
892 # TODO(sbc): currently naclports doesn't know anything about
893 # Debug builds so the Debug subfolders are all empty.
895 env
= dict(os
.environ
)
896 env
['NACL_SDK_ROOT'] = pepperdir
897 env
['PEPPER_DIR'] = os
.path
.basename(pepperdir
) # pepper_NN
898 env
['NACLPORTS_NO_ANNOTATE'] = "1"
899 env
['NACLPORTS_NO_UPLOAD'] = "1"
900 env
['BUILDBOT_GOT_REVISION'] = str(NACLPORTS_REV
)
902 build_script
= 'build_tools/buildbot_sdk_bundle.sh'
903 buildbot_common
.BuildStep('Build naclports')
905 naclports_src
= os
.path
.join(NACLPORTS_DIR
, 'src')
906 bundle_dir
= os
.path
.join(naclports_src
, 'out', 'sdk_bundle')
907 out_dir
= os
.path
.join(bundle_dir
, 'pepper_%s' % pepper_ver
)
909 # Remove the sdk_bundle directory to remove stale files from previous builds.
910 buildbot_common
.RemoveDir(bundle_dir
)
912 buildbot_common
.Run([build_script
], env
=env
, cwd
=naclports_src
)
914 # Some naclports do not include a standalone LICENSE/COPYING file
915 # so we explicitly list those here for inclusion.
916 extra_licenses
= ('tinyxml/readme.txt',
919 src_root
= os
.path
.join(naclports_src
, 'out', 'build')
920 output_license
= os
.path
.join(out_dir
, 'ports', 'LICENSE')
921 GenerateNotice(src_root
, output_license
, extra_licenses
)
922 readme
= os
.path
.join(out_dir
, 'ports', 'README')
923 oshelpers
.Copy(['-v', os
.path
.join(SDK_SRC_DIR
, 'README.naclports'), readme
])
926 def BuildStepTarNaClPorts(pepper_ver
, tarfile
):
927 """Create tar archive containing headers and libs from naclports build."""
928 buildbot_common
.BuildStep('Tar naclports Bundle')
929 buildbot_common
.MakeDir(os
.path
.dirname(tarfile
))
930 pepper_dir
= 'pepper_%s' % pepper_ver
931 archive_dirs
= [os
.path
.join(pepper_dir
, 'ports')]
933 ports_out
= os
.path
.join(NACLPORTS_DIR
, 'src', 'out', 'sdk_bundle')
934 cmd
= [sys
.executable
, CYGTAR
, '-C', ports_out
, '-cjf', tarfile
]
936 buildbot_common
.Run(cmd
, cwd
=NACL_DIR
)
939 def BuildStepBuildAppEngine(pepperdir
, chrome_revision
):
940 """Build the projects found in src/gonacl_appengine/src"""
941 buildbot_common
.BuildStep('Build GoNaCl AppEngine Projects')
942 cmd
= ['make', 'upload', 'REVISION=%s' % chrome_revision
]
943 env
= dict(os
.environ
)
944 env
['NACL_SDK_ROOT'] = pepperdir
945 env
['NACLPORTS_NO_ANNOTATE'] = "1"
946 buildbot_common
.Run(cmd
, env
=env
, cwd
=GONACL_APPENGINE_SRC_DIR
)
950 parser
= argparse
.ArgumentParser(description
=__doc__
)
951 parser
.add_argument('--nacl-tree-path',
952 help='Path to native client tree for bionic build.',
953 dest
='nacl_tree_path')
954 parser
.add_argument('--qemu', help='Add qemu for ARM.',
956 parser
.add_argument('--bionic', help='Add bionic build.',
958 parser
.add_argument('--tar', help='Force the tar step.',
960 parser
.add_argument('--archive', help='Force the archive step.',
962 parser
.add_argument('--release', help='PPAPI release version.',
963 dest
='release', default
=None)
964 parser
.add_argument('--build-ports',
965 help='Build naclport bundle.', action
='store_true')
966 parser
.add_argument('--build-app-engine',
967 help='Build AppEngine demos.', action
='store_true')
968 parser
.add_argument('--experimental',
969 help='build experimental examples and libraries', action
='store_true',
970 dest
='build_experimental')
971 parser
.add_argument('--skip-toolchain', help='Skip toolchain untar',
973 parser
.add_argument('--no-clean', dest
='clean', action
='store_false',
974 help="Don't clean gypbuild directories")
975 parser
.add_argument('--mac-sdk',
976 help='Set the mac-sdk (e.g. 10.6) to use when building with ninja.')
977 parser
.add_argument('--no-arm-trusted', action
='store_true',
978 help='Disable building of ARM trusted components (sel_ldr, etc).')
979 parser
.add_argument('--no-use-sysroot', action
='store_true',
980 help='Disable building against sysroot.')
982 # To setup bash completion for this command first install optcomplete
983 # and then add this line to your .bashrc:
984 # complete -F _optcomplete build_sdk.py
987 optcomplete
.autocomplete(parser
)
992 options
= parser
.parse_args(args
)
994 buildbot_common
.BuildStep('build_sdk')
996 if options
.nacl_tree_path
:
997 options
.bionic
= True
998 toolchain_build
= os
.path
.join(options
.nacl_tree_path
, 'toolchain_build')
999 print 'WARNING: Building bionic toolchain from NaCl checkout.'
1000 print 'This option builds bionic from the sources currently in the'
1001 print 'provided NativeClient checkout, and the results instead of '
1002 print 'downloading a toolchain from the builder. This may result in a'
1003 print 'NaCl SDK that can not run on ToT chrome.'
1004 print 'NOTE: To clobber you will need to run toolchain_build_bionic.py'
1005 print 'directly from the NativeClient checkout.'
1007 response
= raw_input("Type 'y' and hit enter to continue.\n")
1008 if response
!= 'y' and response
!= 'Y':
1012 # Get head version of NativeClient tree
1013 buildbot_common
.BuildStep('Build bionic toolchain.')
1014 buildbot_common
.Run([sys
.executable
, 'toolchain_build_bionic.py', '-f'],
1015 cwd
=toolchain_build
)
1017 toolchain_build
= None
1019 if buildbot_common
.IsSDKBuilder():
1020 options
.archive
= True
1021 options
.build_ports
= True
1022 # TODO(binji): re-enable app_engine build when the linux builder stops
1023 # breaking when trying to git clone from github.
1024 # See http://crbug.com/412969.
1025 options
.build_app_engine
= False
1028 # NOTE: order matters here. This will be the order that is specified in the
1029 # Makefiles; the first toolchain will be the default.
1030 toolchains
= ['pnacl', 'x86_newlib', 'x86_glibc', 'arm_newlib', 'arm_glibc',
1031 'clang-newlib', 'host']
1033 # Changes for experimental bionic builder
1035 toolchains
.append('arm_bionic')
1036 options
.build_ports
= False
1037 options
.build_app_engine
= False
1039 print 'Building: ' + ' '.join(toolchains
)
1040 platform
= getos
.GetPlatform()
1042 if options
.archive
and not options
.tar
:
1043 parser
.error('Incompatible arguments with archive.')
1045 chrome_version
= int(build_version
.ChromeMajorVersion())
1046 chrome_revision
= build_version
.ChromeRevision()
1047 nacl_revision
= build_version
.NaClRevision()
1048 pepper_ver
= str(chrome_version
)
1049 pepper_old
= str(chrome_version
- 1)
1050 pepperdir
= os
.path
.join(OUT_DIR
, 'pepper_' + pepper_ver
)
1051 pepperdir_old
= os
.path
.join(OUT_DIR
, 'pepper_' + pepper_old
)
1053 tarname
= 'naclsdk_bionic.tar.bz2'
1055 tarname
= 'naclsdk_%s.tar.bz2' % platform
1056 tarfile
= os
.path
.join(OUT_DIR
, tarname
)
1059 pepper_ver
= options
.release
1060 print 'Building PEPPER %s at %s' % (pepper_ver
, chrome_revision
)
1062 if 'NACL_SDK_ROOT' in os
.environ
:
1063 # We don't want the currently configured NACL_SDK_ROOT to have any effect
1065 del os
.environ
['NACL_SDK_ROOT']
1067 if platform
== 'linux':
1068 # Linux-only: make sure the debian/stable sysroot image is installed
1069 install_script
= os
.path
.join(SRC_DIR
, 'build', 'linux', 'sysroot_scripts',
1070 'install-sysroot.py')
1072 buildbot_common
.Run([sys
.executable
, install_script
, '--arch=arm'])
1073 buildbot_common
.Run([sys
.executable
, install_script
, '--arch=i386'])
1074 buildbot_common
.Run([sys
.executable
, install_script
, '--arch=amd64'])
1076 if not options
.skip_toolchain
:
1077 BuildStepCleanPepperDirs(pepperdir
, pepperdir_old
)
1078 BuildStepMakePepperDirs(pepperdir
, ['include', 'toolchain', 'tools'])
1079 BuildStepDownloadToolchains(toolchains
)
1080 if options
.nacl_tree_path
:
1081 # Instead of untarring, copy the raw bionic toolchain
1082 not_bionic
= [i
for i
in toolchains
if i
!= 'arm_bionic']
1083 BuildStepUntarToolchains(pepperdir
, not_bionic
)
1084 tcname
= GetToolchainDirName('arm_bionic')
1085 srcdir
= os
.path
.join(toolchain_build
, 'out', tcname
)
1086 bionicdir
= os
.path
.join(pepperdir
, 'toolchain', tcname
)
1087 oshelpers
.Copy(['-r', srcdir
, bionicdir
])
1089 BuildStepUntarToolchains(pepperdir
, toolchains
)
1090 if platform
== 'linux':
1091 buildbot_common
.Move(os
.path
.join(pepperdir
, 'toolchain', 'arm_trusted'),
1092 os
.path
.join(OUT_DIR
, 'arm_trusted'))
1095 if platform
== 'linux':
1096 # Linux-only: Copy arm libraries from the arm_trusted package. These are
1097 # needed to be able to run sel_ldr_arm under qemu.
1099 'lib/arm-linux-gnueabihf/librt.so.1',
1100 'lib/arm-linux-gnueabihf/libpthread.so.0',
1101 'lib/arm-linux-gnueabihf/libgcc_s.so.1',
1102 'lib/arm-linux-gnueabihf/libc.so.6',
1103 'lib/arm-linux-gnueabihf/ld-linux-armhf.so.3',
1104 'lib/arm-linux-gnueabihf/libm.so.6',
1105 'usr/lib/arm-linux-gnueabihf/libstdc++.so.6'
1107 arm_lib_dir
= os
.path
.join(pepperdir
, 'tools', 'lib', 'arm_trusted', 'lib')
1108 buildbot_common
.MakeDir(arm_lib_dir
)
1109 for arm_lib
in arm_libs
:
1110 arm_lib
= os
.path
.join(OUT_DIR
, 'arm_trusted', arm_lib
)
1111 buildbot_common
.CopyFile(arm_lib
, arm_lib_dir
)
1112 buildbot_common
.CopyFile(os
.path
.join(OUT_DIR
, 'arm_trusted', 'qemu-arm'),
1113 os
.path
.join(pepperdir
, 'tools'))
1116 BuildStepBuildToolchains(pepperdir
, toolchains
,
1117 not options
.skip_toolchain
,
1120 BuildStepUpdateHelpers(pepperdir
, True)
1121 BuildStepUpdateUserProjects(pepperdir
, toolchains
,
1122 options
.build_experimental
, True)
1124 BuildStepCopyTextFiles(pepperdir
, pepper_ver
, chrome_revision
, nacl_revision
)
1126 # Ship with libraries prebuilt, so run that first.
1127 BuildStepBuildLibraries(pepperdir
, 'src')
1128 GenerateNotice(pepperdir
)
1130 # Verify the SDK contains what we expect.
1131 if not options
.bionic
:
1132 BuildStepVerifyFilelist(pepperdir
)
1135 BuildStepTarBundle(pepper_ver
, tarfile
)
1137 if platform
== 'linux':
1138 BuildStepBuildPNaClComponent(pepper_ver
, chrome_revision
)
1140 if options
.build_ports
:
1141 ports_tarfile
= os
.path
.join(OUT_DIR
, 'naclports.tar.bz2')
1142 BuildStepSyncNaClPorts()
1143 BuildStepBuildNaClPorts(pepper_ver
, pepperdir
)
1145 BuildStepTarNaClPorts(pepper_ver
, ports_tarfile
)
1147 if options
.build_app_engine
and platform
== 'linux':
1148 BuildStepBuildAppEngine(pepperdir
, chrome_revision
)
1151 qemudir
= os
.path
.join(NACL_DIR
, 'toolchain', 'linux_arm-trusted')
1152 oshelpers
.Copy(['-r', qemudir
, pepperdir
])
1154 # Archive the results on Google Cloud Storage.
1156 BuildStepArchiveBundle('build', pepper_ver
, chrome_revision
, nacl_revision
,
1158 # Only archive sdk_tools/naclport/pnacl_component on linux.
1159 if platform
== 'linux':
1160 if options
.build_ports
:
1161 BuildStepArchiveBundle('naclports', pepper_ver
, chrome_revision
,
1162 nacl_revision
, ports_tarfile
)
1163 BuildStepArchiveSDKTools()
1164 BuildStepArchivePNaClComponent(chrome_revision
)
1169 if __name__
== '__main__':
1171 sys
.exit(main(sys
.argv
[1:]))
1172 except KeyboardInterrupt:
1173 buildbot_common
.ErrorExit('build_sdk: interrupted')