def BuildUpdater(out_dir, revision_number=None): """Build naclsdk.zip and sdk_tools.tgz in |out_dir|. Args: out_dir: The output directory. revision_number: The revision number of this updater, as an integer. Or None, to use the current Chrome revision.""" buildbot_common.BuildStep('Create Updater') out_dir = os.path.abspath(out_dir) # Build SDK directory buildbot_common.RemoveDir(os.path.join(out_dir, 'nacl_sdk')) updater_files = MakeUpdaterFilesAbsolute(out_dir) out_files = [out_file for in_file, out_file in updater_files] CopyFiles(updater_files) UpdateRevisionNumber(out_dir, revision_number) # Make zip buildbot_common.RemoveFile(os.path.join(out_dir, 'nacl_sdk.zip')) buildbot_common.Run( [sys.executable, oshelpers.__file__, 'zip', 'nacl_sdk.zip'] + out_files, cwd=out_dir) # Tar of all files under nacl_sdk/sdk_tools sdktoolsdir = os.path.join(out_dir, 'nacl_sdk/sdk_tools') tarname = os.path.join(out_dir, 'sdk_tools.tgz') files_to_tar = [ os.path.relpath(out_file, sdktoolsdir) for out_file in out_files if out_file.startswith(sdktoolsdir) ] buildbot_common.RemoveFile(tarname) buildbot_common.Run([ sys.executable, CYGTAR, '-C', os.path.join(out_dir, sdktoolsdir), '-czf', tarname ] + files_to_tar) sys.stdout.write('\n')
def update_mono_sdk_json(infos): '''Update the naclmono manifest with the newly built packages''' if len(infos) == 0: return manifest_file = open(MONO_MANIFEST, 'r') mono_manifest = json.loads(manifest_file.read()) manifest_file.close() for info in infos: bundle = {} bundle['name'] = info['naclmono_name'] bundle['description'] = 'Mono for Native Client' bundle['stability'] = info['stability'] bundle['recommended'] = 'no' bundle['version'] = 'experimental' archive = {} sha1_hash = hashlib.sha1() f = open(info['naclmono_name'] + '.bz2', 'rb') sha1_hash.update(f.read()) archive['size'] = f.tell() f.close() archive['checksum'] = {'sha1': sha1_hash.hexdigest()} archive['host_os'] = 'all' archive['url'] = ('https://commondatastorage.googleapis.com/' 'nativeclient-mirror/nacl/nacl_sdk/%s/%s/%s.bz2' % (info['naclmono_name'], info['naclmono_rev'], info['naclmono_name'])) bundle['archives'] = [archive] bundle['revision'] = int(info['naclmono_rev']) bundle['sdk_revision'] = int(info['sdk_revision']) # Insert this new bundle into the manifest, # probably overwriting an existing bundle. for key, value in mono_manifest.items(): if key == 'bundles': existing = filter(lambda b: b['name'] == info['naclmono_name'], value) if len(existing) > 0: loc = value.index(existing[0]) value[loc] = bundle else: value.append(bundle) # Write out the file locally, then upload to its known location. manifest_file = open(MONO_MANIFEST, 'w') manifest_file.write(json.dumps(mono_manifest, sort_keys=False, indent=2)) manifest_file.close() buildbot_common.Run([ buildbot_common.GetGsutil(), 'cp', '-a', 'public-read', MONO_MANIFEST, GS_MANIFEST_PATH + MONO_MANIFEST ])
def BuildStepSyncNaClPorts(): """Pull the pinned revision of naclports from SVN.""" buildbot_common.BuildStep('Sync naclports') # In case a previous svn checkout exists, remove it. # TODO(sbc): remove this once all the build machines # have removed the old checkout if (os.path.exists(NACLPORTS_DIR) and not os.path.exists(os.path.join(NACLPORTS_DIR, '.git'))): buildbot_common.RemoveDir(NACLPORTS_DIR) if not os.path.exists(NACLPORTS_DIR): # checkout new copy of naclports cmd = ['git', 'clone', NACLPORTS_URL, 'naclports'] buildbot_common.Run(cmd, cwd=os.path.dirname(NACLPORTS_DIR)) else: # checkout new copy of naclports buildbot_common.Run(['git', 'fetch'], cwd=NACLPORTS_DIR) # sync to required revision cmd = ['git', 'checkout', str(NACLPORTS_REV)] buildbot_common.Run(cmd, cwd=NACLPORTS_DIR)
def main(args): args = args[1:] buildbot_revision = os.environ.get('BUILDBOT_REVISION', '') assert buildbot_revision sdk_revision = buildbot_revision.split(':')[0] pepper_revision = build_utils.ChromeMajorVersion() install_dir = 'naclmono' buildbot_common.RemoveDir(install_dir) buildbot_common.Run([ sys.executable, 'nacl-mono-builder.py', '--arch', 'x86-32', '--install-dir', install_dir ] + args) buildbot_common.Run([ sys.executable, 'nacl-mono-builder.py', '--arch', 'x86-64', '--install-dir', install_dir ] + args) buildbot_common.Run([ sys.executable, 'nacl-mono-archive.py', '--sdk-revision', sdk_revision, '--pepper-revision', pepper_revision, '--install-dir', install_dir ] + args)
def Untar(archive, destdir): if os.path.exists(TAR): cmd = [TAR] else: cmd = [sys.executable, CYGTAR] if options.verbose: cmd.extend(['-xvf', archive]) else: cmd.extend(['-xf', archive]) if not os.path.exists(destdir): buildbot_common.MakeDir(destdir) buildbot_common.Run(cmd, cwd=destdir)
def BuildStepBuildPNaClComponent(version, revision): # Sadly revision can go backwords for a given version since when a version # is built from master, revision will be a huge number (in the hundreds of # thousands. Once the branch happens the revision will reset to zero. # TODO(sbc): figure out how to compensate for this in some way such that # revisions always go forward for a given version. buildbot_common.BuildStep('PNaCl Component') if len(revision) > 4: rev_minor = revision[-4:] rev_major = revision[:-4] version = "0.%s.%s.%s" % (version, rev_major, rev_minor) else: version = "0.%s.0.%s" % (version, revision) buildbot_common.Run(['./make_pnacl_component.sh', version], cwd=SCRIPT_DIR)
def BuildStepDownloadToolchains(toolchains): buildbot_common.BuildStep('Running package_version.py') args = [sys.executable, PKGVER, '--mode', 'nacl_core_sdk'] if 'bionic' in toolchains: build_platform = '%s_x86' % getos.GetPlatform() args.extend( ['--append', os.path.join(build_platform, 'nacl_arm_bionic')]) if getos.GetPlatform() == 'linux': # TODO(sbc): remove this once this change makes it into chrome # https://codereview.chromium.org/1080513003/ args.extend(['--append', 'arm_trusted']) args.extend(['sync', '--extract']) buildbot_common.Run(args, cwd=NACL_DIR)
def build_and_upload_mono(sdk_revision, pepper_revision, sdk_url, upload_path, args): install_dir = 'naclmono' buildbot_common.RemoveDir(install_dir) revision_opt = ['--sdk-revision', sdk_revision] if sdk_revision else [] url_opt = ['--sdk-url', sdk_url] if sdk_url else [] buildbot_common.Run([ sys.executable, 'nacl-mono-builder.py', '--arch', 'x86-32', '--install-dir', install_dir ] + revision_opt + url_opt + args) buildbot_common.Run([ sys.executable, 'nacl-mono-builder.py', '--arch', 'x86-64', '--install-dir', install_dir ] + revision_opt + url_opt + args) buildbot_common.Run([ sys.executable, 'nacl-mono-builder.py', '--arch', 'arm', '--install-dir', install_dir ] + revision_opt + url_opt + args) buildbot_common.Run([ sys.executable, 'nacl-mono-archive.py', '--upload-path', upload_path, '--pepper-revision', pepper_revision, '--install-dir', install_dir ] + args)
def BuildToolchains(pepperdir, platform, arch, pepper_ver, toolchains): buildbot_common.BuildStep('SDK Items') tcname = platform + '_' + arch newlibdir = os.path.join(pepperdir, 'toolchain', tcname + '_newlib') glibcdir = os.path.join(pepperdir, 'toolchain', tcname + '_glibc') pnacldir = os.path.join(pepperdir, 'toolchain', tcname + '_pnacl') # Run scons TC build steps if arch == 'x86': if 'newlib' in toolchains: buildbot_common.Run(GetBuildArgs('newlib', newlibdir, pepperdir, 'x86', '32'), cwd=NACL_DIR, shell=(platform == 'win')) buildbot_common.Run(GetBuildArgs('newlib', newlibdir, pepperdir, 'x86', '64'), cwd=NACL_DIR, shell=(platform == 'win')) InstallHeaders(GetToolchainNaClInclude('newlib', newlibdir, 'x86'), pepper_ver, 'newlib') if 'glibc' in toolchains: buildbot_common.Run(GetBuildArgs('glibc', glibcdir, pepperdir, 'x86', '32'), cwd=NACL_DIR, shell=(platform == 'win')) buildbot_common.Run(GetBuildArgs('glibc', glibcdir, pepperdir, 'x86', '64'), cwd=NACL_DIR, shell=(platform == 'win')) InstallHeaders(GetToolchainNaClInclude('glibc', glibcdir, 'x86'), pepper_ver, 'glibc') if 'pnacl' in toolchains: buildbot_common.Run(GetBuildArgs('pnacl', pnacldir, pepperdir, 'x86', '32'), cwd=NACL_DIR, shell=(platform == 'win')) buildbot_common.Run(GetBuildArgs('pnacl', pnacldir, pepperdir, 'x86', '64'), cwd=NACL_DIR, shell=(platform == 'win')) # Pnacl libraries are typically bitcode, but some are native and # will be looked up in the native library directory. buildbot_common.Move( os.path.join( GetToolchainNaClLib('pnacl', pnacldir, 'x86', '64'), 'libpnacl_irt_shim.a'), GetPNaClNativeLib(pnacldir, 'x86-64')) InstallHeaders(GetToolchainNaClInclude('pnacl', pnacldir, 'x86'), pepper_ver, 'newlib') else: buildbot_common.ErrorExit('Missing arch %s' % arch)
def BuildStepUntarToolchains(pepperdir, toolchains): buildbot_common.BuildStep('Untar Toolchains') platform = getos.GetPlatform() build_platform = '%s_x86' % platform tmpdir = os.path.join(OUT_DIR, 'tc_temp') buildbot_common.RemoveDir(tmpdir) buildbot_common.MakeDir(tmpdir) # Create a list of extract packages tuples, the first part should be # "$PACKAGE_TARGET/$PACKAGE". The second part should be the destination # directory relative to pepperdir/toolchain. extract_packages = [] for toolchain in toolchains: toolchain_map = TOOLCHAIN_PACKAGE_MAP.get(toolchain, None) if toolchain_map: package_name, tcdir, _ = toolchain_map package_tuple = (os.path.join(build_platform, package_name), tcdir % { 'platform': platform }) extract_packages.append(package_tuple) # On linux we also want to extract the arm_trusted package which contains # the ARM libraries we ship in support of sel_ldr_arm. if platform == 'linux': extract_packages.append((os.path.join(build_platform, 'arm_trusted'), 'arm_trusted')) if extract_packages: # Extract all of the packages into the temp directory. package_names = [ package_tuple[0] for package_tuple in extract_packages ] buildbot_common.Run([ sys.executable, PKGVER, '--packages', ','.join(package_names), '--tar-dir', NACL_TOOLCHAINTARS_DIR, '--dest-dir', tmpdir, 'extract' ]) # Move all the packages we extracted to the correct destination. for package_name, dest_dir in extract_packages: full_src_dir = os.path.join(tmpdir, package_name) full_dst_dir = os.path.join(pepperdir, 'toolchain', dest_dir) buildbot_common.Move(full_src_dir, full_dst_dir) # Cleanup the temporary directory we are no longer using. buildbot_common.RemoveDir(tmpdir)
def GypNinjaBuild(arch, gyp_py_script, gyp_file, targets, out_dir, force_arm_gcc=True): gyp_env = dict(os.environ) gyp_env['GYP_GENERATORS'] = 'ninja' gyp_defines = [] if options.mac_sdk: gyp_defines.append('mac_sdk=%s' % options.mac_sdk) if arch: gyp_defines.append('target_arch=%s' % arch) if arch == 'arm': if getos.GetPlatform() == 'linux': if os.path.exists("/usr/bin/arm-linux-gnueabihf-gcc"): # TODO(sbc): make this conditional once all our linux # have the ARM cross compiler installed. gyp_env['CC'] = 'arm-linux-gnueabihf-gcc' gyp_env['CXX'] = 'arm-linux-gnueabihf-g++' gyp_env['AR'] = 'arm-linux-gnueabihf-ar' gyp_env['AS'] = 'arm-linux-gnueabihf-as' gyp_env['CC_host'] = 'cc' gyp_env['CXX_host'] = 'c++' gyp_defines += [ 'armv7=1', 'arm_thumb=0', 'arm_neon=1', 'arm_float_abi=hard' ] if force_arm_gcc: gyp_defines.append('nacl_enable_arm_gcc=1') if getos.GetPlatform() == 'mac': gyp_defines.append('clang=1') gyp_env['GYP_DEFINES'] = ' '.join(gyp_defines) for key in ['GYP_GENERATORS', 'GYP_DEFINES', 'CC']: value = gyp_env.get(key) if value is not None: print '%s="%s"' % (key, value) gyp_generator_flags = ['-G', 'output_dir=%s' % (out_dir, )] gyp_depth = '--depth=.' buildbot_common.Run( [sys.executable, gyp_py_script, gyp_file, gyp_depth] + \ gyp_generator_flags, cwd=SRC_DIR, env=gyp_env) NinjaBuild(targets, out_dir)
def GypNinjaBuild(arch, gyp_py_script, gyp_file, targets, out_dir): gyp_env = dict(os.environ) gyp_defines = [] if options.mac_sdk: gyp_defines.append('mac_sdk=%s' % options.mac_sdk) if arch: gyp_defines.append('target_arch=%s' % arch) if arch == 'arm': gyp_env['GYP_CROSSCOMPILE'] = '1' if options.no_arm_trusted: gyp_defines.append('disable_cross_trusted=1') gyp_env['GYP_DEFINES'] = ' '.join(gyp_defines) generator_flags = ['-G', 'output_dir=%s' % out_dir] depth = '--depth=.' cmd = [sys.executable, gyp_py_script, gyp_file, depth] + generator_flags buildbot_common.Run(cmd, cwd=SRC_DIR, env=gyp_env) NinjaBuild(targets, out_dir)
def MakeToolchainArchive(toolchain): archive = Archive(toolchain) build_platform = '%s_x86' % PLATFORM with TempDir('tc_%s_' % toolchain) as tmpdir: package_name = os.path.join(build_platform, TOOLCHAIN_PACKAGE_MAP.get(toolchain)) # Extract all of the packages into the temp directory. buildbot_common.Run([ sys.executable, PKGVER, '--packages', package_name, '--tar-dir', NACL_TOOLCHAINTARS_DIR, '--dest-dir', tmpdir, 'extract' ]) # Copy all the files we extracted to the correct destination. archive.Copy(os.path.join(tmpdir, package_name), ('*', '')) archive.Tar()
def BuildStepBuildPNaClComponent(version, revision): # Sadly revision can go backwords for a given version since when a version # is built from master, revision will be a huge number (in the hundreds of # thousands. Once the branch happens the revision will reset to zero. # TODO(sbc): figure out how to compensate for this in some way such that # revisions always go forward for a given version. buildbot_common.BuildStep('PNaCl Component') # Version numbers must follow the format specified in: # https://developer.chrome.com/extensions/manifest/version # So ensure that rev_major/rev_minor don't overflow and ensure there # are no leading zeros. if len(revision) > 4: rev_minor = int(revision[-4:]) rev_major = int(revision[:-4]) version = "0.%s.%s.%s" % (version, rev_major, rev_minor) else: version = "0.%s.0.%s" % (version, revision) buildbot_common.Run(['./make_pnacl_component.sh', 'pnacl_multicrx_%s.zip' % revision, version], cwd=SCRIPT_DIR)
def GypNinjaBuild(arch, gyp_py_script, gyp_file, targets, out_dir, force_arm_gcc=True, gyp_defines=None): gyp_env = dict(os.environ) gyp_env['GYP_GENERATORS'] = 'ninja' gyp_defines = gyp_defines or [] gyp_defines.append('nacl_allow_thin_archives=0') gyp_defines.append('use_sysroot=1') if options.mac_sdk: gyp_defines.append('mac_sdk=%s' % options.mac_sdk) if arch is not None: gyp_defines.append('target_arch=%s' % arch) if arch == 'arm': gyp_env['GYP_CROSSCOMPILE'] = '1' gyp_defines.append('arm_float_abi=hard') if options.no_arm_trusted: gyp_defines.append('disable_cross_trusted=1') if getos.GetPlatform() == 'mac': gyp_defines.append('clang=1') gyp_env['GYP_DEFINES'] = ' '.join(gyp_defines) # We can't use windows path separators in GYP_GENERATOR_FLAGS since # gyp uses shlex to parse them and treats '\' as an escape char. gyp_env['GYP_GENERATOR_FLAGS'] = 'output_dir=%s' % out_dir.replace( '\\', '/') # Print relevant environment variables for key, value in gyp_env.iteritems(): if key.startswith('GYP') or key in ('CC', ): print ' %s="%s"' % (key, value) buildbot_common.Run([sys.executable, gyp_py_script, gyp_file, '--depth=.'], cwd=SRC_DIR, env=gyp_env) NinjaBuild(targets, out_dir, arch)
def GypNinjaBuild(arch, gyp_py_script, gyp_file, targets, out_dir): gyp_env = dict(os.environ) gyp_env['GYP_GENERATORS'] = 'ninja' gyp_defines = ['nacl_allow_thin_archives=0'] if options.mac_sdk: gyp_defines.append('mac_sdk=%s' % options.mac_sdk) if arch: gyp_defines.append('target_arch=%s' % arch) if arch == 'arm': gyp_env['GYP_CROSSCOMPILE'] = '1' gyp_defines += ['arm_float_abi=hard'] if options.no_arm_trusted: gyp_defines.append('disable_cross_trusted=1') if PLATFORM == 'mac': gyp_defines.append('clang=1') gyp_env['GYP_DEFINES'] = ' '.join(gyp_defines) generator_flags = ['-G', 'output_dir=%s' % out_dir] depth = '--depth=.' cmd = [sys.executable, gyp_py_script, gyp_file, depth] + generator_flags buildbot_common.Run(cmd, cwd=SRC_DIR, env=gyp_env) NinjaBuild(targets, out_dir)
def StripNexes(outdir, platform, pepperdir): for root, _, files in os.walk(outdir): for f in files: path = os.path.join(root, f) m = re.search(r'lib(32|64).*\.so', path) arch = None if m: # System .so file. Must be x86, because ARM doesn't support glibc yet. arch = 'x86_' + m.group(1) else: basename, ext = os.path.splitext(f) if ext in ('.nexe', '.so'): # We can get the arch from the filename... valid_arches = ('x86_64', 'x86_32', 'arm') for a in valid_arches: if basename.endswith(a): arch = a break if not arch: continue strip = GetStrip(pepperdir, platform, arch, 'newlib') buildbot_common.Run([strip, path])
def InstallHeaders(tc_dst_inc, pepper_ver, tc_name): """Copies NaCl headers to expected locations in the toolchain.""" tc_map = HEADER_MAP[tc_name] for filename in tc_map: src = os.path.join(NACL_DIR, tc_map[filename]) dst = os.path.join(tc_dst_inc, filename) buildbot_common.MakeDir(os.path.dirname(dst)) buildbot_common.CopyFile(src, dst) # Clean out per toolchain ppapi directory ppapi = os.path.join(tc_dst_inc, 'ppapi') buildbot_common.RemoveDir(ppapi) # Copy in c and c/dev headers buildbot_common.MakeDir(os.path.join(ppapi, 'c', 'dev')) buildbot_common.CopyDir(os.path.join(PPAPI_DIR, 'c', '*.h'), os.path.join(ppapi, 'c')) buildbot_common.CopyDir(os.path.join(PPAPI_DIR, 'c', 'dev', '*.h'), os.path.join(ppapi, 'c', 'dev')) # Run the generator to overwrite IDL files buildbot_common.Run([ sys.executable, 'generator.py', '--wnone', '--cgen', '--release=M' + pepper_ver, '--verbose', '--dstroot=%s/c' % ppapi ], cwd=os.path.join(PPAPI_DIR, 'generators')) # Remove private and trusted interfaces buildbot_common.RemoveDir(os.path.join(ppapi, 'c', 'private')) buildbot_common.RemoveDir(os.path.join(ppapi, 'c', 'trusted')) # Copy in the C++ headers buildbot_common.MakeDir(os.path.join(ppapi, 'cpp', 'dev')) buildbot_common.CopyDir(os.path.join(PPAPI_DIR, 'cpp', '*.h'), os.path.join(ppapi, 'cpp')) buildbot_common.CopyDir(os.path.join(PPAPI_DIR, 'cpp', 'dev', '*.h'), os.path.join(ppapi, 'cpp', 'dev')) buildbot_common.MakeDir(os.path.join(ppapi, 'utility', 'graphics')) buildbot_common.CopyDir(os.path.join(PPAPI_DIR, 'utility', '*.h'), os.path.join(ppapi, 'utility')) buildbot_common.CopyDir( os.path.join(PPAPI_DIR, 'utility', 'graphics', '*.h'), os.path.join(ppapi, 'utility', 'graphics')) # Copy in the gles2 headers buildbot_common.MakeDir(os.path.join(ppapi, 'gles2')) buildbot_common.CopyDir( os.path.join(PPAPI_DIR, 'lib', 'gl', 'gles2', '*.h'), os.path.join(ppapi, 'gles2')) # Copy the EGL headers buildbot_common.MakeDir(os.path.join(tc_dst_inc, 'EGL')) buildbot_common.CopyDir( os.path.join(PPAPI_DIR, 'lib', 'gl', 'include', 'EGL', '*.h'), os.path.join(tc_dst_inc, 'EGL')) # Copy the GLES2 headers buildbot_common.MakeDir(os.path.join(tc_dst_inc, 'GLES2')) buildbot_common.CopyDir( os.path.join(PPAPI_DIR, 'lib', 'gl', 'include', 'GLES2', '*.h'), os.path.join(tc_dst_inc, 'GLES2')) # Copy the KHR headers buildbot_common.MakeDir(os.path.join(tc_dst_inc, 'KHR')) buildbot_common.CopyDir( os.path.join(PPAPI_DIR, 'lib', 'gl', 'include', 'KHR', '*.h'), os.path.join(tc_dst_inc, 'KHR'))
def main(args): parser = optparse.OptionParser() parser.add_option('--arch', help='Target architecture', dest='arch', default='x86-32') parser.add_option('--sdk-revision', help='SDK Revision' ' (default=buildbot revision)', dest='sdk_revision', default=None) parser.add_option('--sdk-url', help='SDK Download URL', dest='sdk_url', default=None) parser.add_option('--install-dir', help='Install Directory', dest='install_dir', default='naclmono') (options, args) = parser.parse_args(args[1:]) assert sys.platform.find('linux') != -1 buildbot_revision = os.environ.get('BUILDBOT_REVISION', '') build_prefix = options.arch + ' ' buildbot_common.BuildStep(build_prefix + 'Clean Old SDK') buildbot_common.MakeDir(MONO_BUILD_DIR) buildbot_common.RemoveDir(os.path.join(MONO_BUILD_DIR, 'pepper_*')) buildbot_common.BuildStep(build_prefix + 'Setup New SDK') sdk_dir = None sdk_revision = options.sdk_revision sdk_url = options.sdk_url if not sdk_url: if not sdk_revision: assert buildbot_revision sdk_revision = buildbot_revision.split(':')[0] sdk_url = 'gs://nativeclient-mirror/nacl/nacl_sdk/'\ 'trunk.%s/naclsdk_linux.bz2' % sdk_revision sdk_url = sdk_url.replace('https://commondatastorage.googleapis.com/', 'gs://') sdk_file = sdk_url.split('/')[-1] buildbot_common.Run([buildbot_common.GetGsutil(), 'cp', sdk_url, sdk_file], cwd=MONO_BUILD_DIR) tar_file = None try: tar_file = tarfile.open(os.path.join(MONO_BUILD_DIR, sdk_file)) pepper_dir = os.path.commonprefix(tar_file.getnames()) tar_file.extractall(path=MONO_BUILD_DIR) sdk_dir = os.path.join(MONO_BUILD_DIR, pepper_dir) finally: if tar_file: tar_file.close() assert sdk_dir buildbot_common.BuildStep(build_prefix + 'Checkout Mono') # TODO(elijahtaylor): Get git URL from master/trigger to make this # more flexible for building from upstream and release branches. git_url = 'git://github.com/elijahtaylor/mono.git' git_rev = 'HEAD' if buildbot_revision: git_rev = buildbot_revision.split(':')[1] if not os.path.exists(MONO_DIR): buildbot_common.MakeDir(MONO_DIR) buildbot_common.Run(['git', 'clone', git_url, MONO_DIR]) else: buildbot_common.Run(['git', 'fetch'], cwd=MONO_DIR) if git_rev: buildbot_common.Run(['git', 'checkout', git_rev], cwd=MONO_DIR) arch_to_bitsize = {'x86-32': '32', 'x86-64': '64'} arch_to_output_folder = { 'x86-32': 'runtime-build', 'x86-64': 'runtime64-build' } buildbot_common.BuildStep(build_prefix + 'Configure Mono') os.environ['NACL_SDK_ROOT'] = sdk_dir os.environ['TARGET_BITSIZE'] = arch_to_bitsize[options.arch] buildbot_common.Run(['./autogen.sh'], cwd=MONO_DIR) buildbot_common.Run(['make', 'distclean'], cwd=MONO_DIR) buildbot_common.BuildStep(build_prefix + 'Build and Install Mono') nacl_interp_script = os.path.join(SDK_BUILD_DIR, 'nacl_interp_loader_mono.sh') os.environ['NACL_INTERP_LOADER'] = nacl_interp_script buildbot_common.Run( [ './nacl-mono-runtime.sh', MONO_DIR, # Mono directory with 'configure' arch_to_output_folder[options.arch], # Build dir options.install_dir ], cwd=SDK_BUILD_DIR) buildbot_common.BuildStep(build_prefix + 'Test Mono') buildbot_common.Run(['make', 'check', '-j8'], cwd=os.path.join(SDK_BUILD_DIR, arch_to_output_folder[options.arch])) return 0
def BuildStepTarBundle(pepper_ver, tarfile): buildbot_common.BuildStep('Tar Pepper Bundle') buildbot_common.MakeDir(os.path.dirname(tarfile)) buildbot_common.Run([sys.executable, CYGTAR, '-C', OUT_DIR, '-cjf', tarfile, 'pepper_' + pepper_ver], cwd=NACL_DIR)
def NinjaBuild(targets, out_dir): if type(targets) is not list: targets = [targets] out_config_dir = os.path.join(out_dir, 'Release') buildbot_common.Run(['ninja', '-C', out_config_dir] + targets, cwd=SRC_DIR)
def BuildStepUntarToolchains(pepperdir, toolchains): buildbot_common.BuildStep('Untar Toolchains') platform = getos.GetPlatform() tmpdir = os.path.join(OUT_DIR, 'tc_temp') buildbot_common.RemoveDir(tmpdir) buildbot_common.MakeDir(tmpdir) if 'newlib' in toolchains: # Untar the newlib toolchains tarfile = GetNewlibToolchain() buildbot_common.Run([sys.executable, CYGTAR, '-C', tmpdir, '-xf', tarfile], cwd=NACL_DIR) # Then rename/move it to the pepper toolchain directory srcdir = os.path.join(tmpdir, 'sdk', 'nacl-sdk') tcname = platform + '_x86_newlib' newlibdir = os.path.join(pepperdir, 'toolchain', tcname) buildbot_common.Move(srcdir, newlibdir) if 'arm' in toolchains: # Copy the existing arm toolchain from native_client tree tcname = platform + '_arm_newlib' arm_toolchain = os.path.join(NACL_DIR, 'toolchain', tcname) arm_toolchain_sdk = os.path.join(pepperdir, 'toolchain', os.path.basename(arm_toolchain)) buildbot_common.CopyDir(arm_toolchain, arm_toolchain_sdk) if 'glibc' in toolchains: # Untar the glibc toolchains tarfile = GetGlibcToolchain() tcname = platform + '_x86_glibc' buildbot_common.Run([sys.executable, CYGTAR, '-C', tmpdir, '-xf', tarfile], cwd=NACL_DIR) # Then rename/move it to the pepper toolchain directory srcdir = os.path.join(tmpdir, 'toolchain', platform + '_x86') glibcdir = os.path.join(pepperdir, 'toolchain', tcname) buildbot_common.Move(srcdir, glibcdir) # Untar the pnacl toolchains if 'pnacl' in toolchains: tmpdir = os.path.join(tmpdir, 'pnacl') buildbot_common.RemoveDir(tmpdir) buildbot_common.MakeDir(tmpdir) tarfile = GetPNaClToolchain() tcname = platform + '_pnacl' buildbot_common.Run([sys.executable, CYGTAR, '-C', tmpdir, '-xf', tarfile], cwd=NACL_DIR) # Then rename/move it to the pepper toolchain directory pnacldir = os.path.join(pepperdir, 'toolchain', tcname) buildbot_common.Move(tmpdir, pnacldir) PrunePNaClToolchain(pnacldir) buildbot_common.RemoveDir(tmpdir) if options.gyp and platform != 'win': # If the gyp options is specified we install a toolchain # wrapper so that gyp can switch toolchains via a commandline # option. bindir = os.path.join(pepperdir, 'toolchain', tcname, 'bin') wrapper = os.path.join(SDK_SRC_DIR, 'tools', 'compiler-wrapper.py') buildbot_common.MakeDir(bindir) buildbot_common.CopyFile(wrapper, bindir) # Module 'os' has no 'symlink' member (on Windows). # pylint: disable=E1101 os.symlink('compiler-wrapper.py', os.path.join(bindir, 'i686-nacl-g++')) os.symlink('compiler-wrapper.py', os.path.join(bindir, 'i686-nacl-gcc')) os.symlink('compiler-wrapper.py', os.path.join(bindir, 'i686-nacl-ar'))
def BuildStepDownloadToolchains(): buildbot_common.BuildStep('Running download_toolchains.py') download_script = os.path.join('build', 'download_toolchains.py') buildbot_common.Run([sys.executable, download_script, '--no-arm-trusted', '--arm-untrusted', '--keep'], cwd=NACL_DIR)
def BuildStepDownloadToolchains(platform): buildbot_common.BuildStep('Rerun hooks to get toolchains') buildbot_common.Run(['gclient', 'runhooks'], cwd=SRC_DIR, shell=(platform == 'win'))
def get_sdk_build_info(): '''Returns a list of dictionaries for versions of NaCl Mono to build which are out of date compared to the SDKs available to naclsdk''' # Get a copy of the naclsdk manifest file buildbot_common.Run([buildbot_common.GetGsutil(), 'cp', GS_MANIFEST_PATH + SDK_MANIFEST, '.']) manifest_file = open(SDK_MANIFEST, 'r') sdk_manifest = json.loads(manifest_file.read()) manifest_file.close() pepper_infos = [] for key, value in sdk_manifest.items(): if key == 'bundles': stabilities = ['stable', 'beta', 'dev', 'post_stable'] # Pick pepper_* bundles, need pepper_19 or greater to build Mono bundles = filter(lambda b: (b['stability'] in stabilities and 'pepper_' in b['name']) and b['version'] >= 19, value) for b in bundles: newdict = {} newdict['pepper_revision'] = str(b['version']) linux_arch = filter(lambda u: u['host_os'] == 'linux', b['archives']) newdict['sdk_url'] = linux_arch[0]['url'] newdict['sdk_revision'] = b['revision'] newdict['stability'] = b['stability'] newdict['naclmono_name'] = 'naclmono_' + newdict['pepper_revision'] pepper_infos.append(newdict) # Get a copy of the naclmono manifest file buildbot_common.Run([buildbot_common.GetGsutil(), 'cp', GS_MANIFEST_PATH + MONO_MANIFEST, '.']) manifest_file = open(MONO_MANIFEST, 'r') mono_manifest = json.loads(manifest_file.read()) manifest_file.close() ret = [] mono_manifest_dirty = False # Check to see if we need to rebuild mono based on sdk revision for key, value in mono_manifest.items(): if key == 'bundles': for info in pepper_infos: bundle = filter(lambda b: b['name'] == info['naclmono_name'], value) if len(bundle) == 0: info['naclmono_rev'] = '1' ret.append(info) else: if info['sdk_revision'] != bundle[0]['sdk_revision']: # This bundle exists in the mono manifest, bump the revision # for the new build we're about to make. info['naclmono_rev'] = str(bundle[0]['revision'] + 1) ret.append(info) elif info['stability'] != bundle[0]['stability']: # If all that happened was the SDK bundle was promoted in stability, # change only that and re-write the manifest mono_manifest_dirty = True bundle[0]['stability'] = info['stability'] # re-write the manifest here because there are no bundles to build but # the manifest has changed if mono_manifest_dirty and len(ret) == 0: manifest_file = open(MONO_MANIFEST, 'w') manifest_file.write(json.dumps(mono_manifest, sort_keys=False, indent=2)) manifest_file.close() buildbot_common.Run([buildbot_common.GetGsutil(), 'cp', '-a', 'public-read', MONO_MANIFEST, GS_MANIFEST_PATH + MONO_MANIFEST]) return ret
def ProcessProject(srcroot, dstroot, desc, toolchains, first_toolchain): name = desc['NAME'] out_dir = os.path.join(dstroot, desc['DEST'], name) buildbot_common.MakeDir(out_dir) srcdirs = desc.get('SEARCH', ['.', '..']) # Copy sources to example directory sources = GenerateSourceCopyList(desc) FindAndCopyFiles(sources, srcroot, srcdirs, out_dir) # Copy public headers to the include directory. for headers_set in desc.get('HEADERS', []): headers = headers_set['FILES'] header_out_dir = os.path.join(dstroot, headers_set['DEST']) FindAndCopyFiles(headers, srcroot, srcdirs, header_out_dir) make_path = os.path.join(out_dir, 'Makefile') if use_gyp: # Process the dsc file to produce gyp input dsc = desc['FILENAME'] dsc2gyp = os.path.join(SDK_SRC_DIR, 'build_tools/dsc2gyp.py') gypfile = os.path.join(OUT_DIR, 'tmp', name, name + '.gyp') buildbot_common.Run([sys.executable, dsc2gyp, dsc, '-o', gypfile], cwd=out_dir) # Run gyp on the generated gyp file if sys.platform == 'win32': generator = 'msvs' else: generator = os.path.join(SCRIPT_DIR, "make_simple.py") gyp = os.path.join(SDK_SRC_DIR, '..', '..', 'tools', 'gyp', 'gyp') if sys.platform == 'win32': gyp += '.bat' buildbot_common.Run([ gyp, '-Gstandalone', '--format', generator, '--toplevel-dir=.', gypfile ], cwd=out_dir) if sys.platform == 'win32' or not use_gyp: if IsNexe(desc): template = os.path.join(SCRIPT_DIR, 'template.mk') else: template = os.path.join(SCRIPT_DIR, 'library.mk') # Ensure the order of |tools| is the same as toolchains; that way if # first_toolchain is set, it will choose based on the order of |toolchains|. tools = [tool for tool in toolchains if tool in desc['TOOLS']] if first_toolchain: tools = [tools[0]] template_dict = { 'pre': desc.get('PRE', ''), 'tools': tools, 'targets': desc['TARGETS'], } RunTemplateFile(template, make_path, template_dict) outdir = os.path.dirname(os.path.abspath(make_path)) pepperdir = os.path.dirname(os.path.dirname(outdir)) AddMakeBat(pepperdir, outdir) return (name, desc['DEST'])
def main(args): parser = optparse.OptionParser() parser.add_option('--pnacl', help='Enable pnacl build.', action='store_true', dest='pnacl', default=False) parser.add_option('--examples', help='Rebuild the examples.', action='store_true', dest='examples', default=False) parser.add_option('--update', help='Rebuild the updater.', action='store_true', dest='update', default=False) parser.add_option('--skip-tar', help='Skip generating a tarball.', action='store_true', dest='skip_tar', default=False) parser.add_option('--archive', help='Force the archive step.', action='store_true', dest='archive', default=False) parser.add_option('--release', help='PPAPI release version.', dest='release', default=None) options, args = parser.parse_args(args[1:]) platform = getos.GetPlatform() arch = 'x86' builder_name = os.getenv('BUILDBOT_BUILDERNAME', '') if builder_name.find('pnacl') >= 0 and builder_name.find('sdk') >= 0: options.pnacl = True if options.pnacl: toolchains = ['pnacl'] else: toolchains = ['newlib', 'glibc'] print 'Building: ' + ' '.join(toolchains) skip = options.examples or options.update skip_examples = skip skip_update = skip skip_untar = skip skip_build = skip skip_tar = skip or options.skip_tar if options.examples: skip_examples = False skip_update = not options.update if options.archive and (options.examples or options.skip_tar): parser.error('Incompatible arguments with archive.') pepper_ver = str(int(build_utils.ChromeMajorVersion())) clnumber = lastchange.FetchVersionInfo(None).revision if options.release: pepper_ver = options.release print 'Building PEPPER %s at %s' % (pepper_ver, clnumber) if not skip_build: buildbot_common.BuildStep('Rerun hooks to get toolchains') buildbot_common.Run(['gclient', 'runhooks'], cwd=SRC_DIR, shell=(platform == 'win')) buildbot_common.BuildStep('Clean Pepper Dir') pepperdir = os.path.join(SRC_DIR, 'out', 'pepper_' + pepper_ver) if not skip_untar: buildbot_common.RemoveDir(pepperdir) buildbot_common.MakeDir(os.path.join(pepperdir, 'toolchain')) buildbot_common.MakeDir(os.path.join(pepperdir, 'tools')) buildbot_common.BuildStep('Add Text Files') files = ['AUTHORS', 'COPYING', 'LICENSE', 'NOTICE', 'README'] files = [os.path.join(SDK_SRC_DIR, filename) for filename in files] oshelpers.Copy(['-v'] + files + [pepperdir]) # Clean out the temporary toolchain untar directory if not skip_untar: UntarToolchains(pepperdir, platform, arch, toolchains) if not skip_build: BuildToolchains(pepperdir, platform, arch, pepper_ver, toolchains) buildbot_common.BuildStep('Copy make OS helpers') buildbot_common.CopyDir(os.path.join(SDK_SRC_DIR, 'tools', '*.py'), os.path.join(pepperdir, 'tools')) if platform == 'win': buildbot_common.BuildStep('Add MAKE') http_download.HttpDownload( GSTORE + MAKE, os.path.join(pepperdir, 'tools', 'make.exe')) if not skip_examples: CopyExamples(pepperdir, toolchains) if not skip_tar: buildbot_common.BuildStep('Tar Pepper Bundle') tarname = 'naclsdk_' + platform + '.bz2' if 'pnacl' in toolchains: tarname = 'p' + tarname tarfile = os.path.join(OUT_DIR, tarname) buildbot_common.Run([ sys.executable, CYGTAR, '-C', OUT_DIR, '-cjf', tarfile, 'pepper_' + pepper_ver ], cwd=NACL_DIR) # Archive on non-trybots. if options.archive or '-sdk' in os.environ.get('BUILDBOT_BUILDERNAME', ''): buildbot_common.BuildStep('Archive build') buildbot_common.Archive( tarname, 'nativeclient-mirror/nacl/nacl_sdk/%s' % build_utils.ChromeVersion(), OUT_DIR) if not skip_examples: buildbot_common.BuildStep('Test Build Examples') filelist = os.listdir(os.path.join(pepperdir, 'examples')) for filenode in filelist: dirnode = os.path.join(pepperdir, 'examples', filenode) makefile = os.path.join(dirnode, 'Makefile') if os.path.isfile(makefile): print "\n\nMake: " + dirnode buildbot_common.Run(['make', 'all', '-j8'], cwd=os.path.abspath(dirnode), shell=True) # Build SDK Tools if not skip_update: BuildUpdater() return 0
def main(args): parser = argparse.ArgumentParser(description=__doc__) parser.add_argument('--qemu', help='Add qemu for ARM.', action='store_true') parser.add_argument('--tar', help='Force the tar step.', action='store_true') parser.add_argument('--archive', help='Force the archive step.', action='store_true') parser.add_argument('--release', help='PPAPI release version.', dest='release', default=None) parser.add_argument('--build-app-engine', help='Build AppEngine demos.', action='store_true') parser.add_argument('--experimental', help='build experimental examples and libraries', action='store_true', dest='build_experimental') parser.add_argument('--skip-toolchain', help='Skip toolchain untar', action='store_true') parser.add_argument('--no-clean', dest='clean', action='store_false', help="Don't clean gn build directories") parser.add_argument( '--mac-sdk', help='Set the mac-sdk (e.g. 10.6) to use when building with ninja.') parser.add_argument( '--no-arm-trusted', action='store_true', help='Disable building of ARM trusted components (sel_ldr, etc).') parser.add_argument('--no-use-sysroot', action='store_true', help='Disable building against sysroot.') # To setup bash completion for this command first install optcomplete # and then add this line to your .bashrc: # complete -F _optcomplete build_sdk.py try: import optcomplete optcomplete.autocomplete(parser) except ImportError: pass global options options = parser.parse_args(args) buildbot_common.BuildStep('build_sdk') if buildbot_common.IsSDKBuilder(): options.archive = True # TODO(binji): re-enable app_engine build when the linux builder stops # breaking when trying to git clone from github. # See http://crbug.com/412969. options.build_app_engine = False options.tar = True # NOTE: order matters here. This will be the order that is specified in the # Makefiles; the first toolchain will be the default. toolchains = ['pnacl', 'x86_glibc', 'arm_glibc', 'clang-newlib', 'host'] print 'Building: ' + ' '.join(toolchains) platform = getos.GetPlatform() if options.archive and not options.tar: parser.error('Incompatible arguments with archive.') chrome_version = int(build_version.ChromeMajorVersion()) chrome_revision = build_version.ChromeRevision() nacl_revision = build_version.NaClRevision() pepper_ver = str(chrome_version) pepper_old = str(chrome_version - 1) pepperdir = os.path.join(OUT_DIR, 'pepper_' + pepper_ver) pepperdir_old = os.path.join(OUT_DIR, 'pepper_' + pepper_old) tarname = 'naclsdk_%s.tar.bz2' % platform tarfile = os.path.join(OUT_DIR, tarname) if options.release: pepper_ver = options.release print 'Building PEPPER %s at %s' % (pepper_ver, chrome_revision) if 'NACL_SDK_ROOT' in os.environ: # We don't want the currently configured NACL_SDK_ROOT to have any effect # of the build. del os.environ['NACL_SDK_ROOT'] if platform == 'linux': # Linux-only: make sure the debian/stable sysroot image is installed install_script = os.path.join(SRC_DIR, 'build', 'linux', 'sysroot_scripts', 'install-sysroot.py') buildbot_common.Run([sys.executable, install_script, '--arch=arm']) buildbot_common.Run([sys.executable, install_script, '--arch=i386']) buildbot_common.Run([sys.executable, install_script, '--arch=amd64']) if not options.skip_toolchain: BuildStepCleanPepperDirs(pepperdir, pepperdir_old) BuildStepMakePepperDirs(pepperdir, ['include', 'toolchain', 'tools']) BuildStepDownloadToolchains(toolchains) BuildStepUntarToolchains(pepperdir, toolchains) if platform == 'linux': buildbot_common.Move( os.path.join(pepperdir, 'toolchain', 'arm_trusted'), os.path.join(OUT_DIR, 'arm_trusted')) if platform == 'linux': # Linux-only: Copy arm libraries from the arm_trusted package. These are # needed to be able to run sel_ldr_arm under qemu. arm_libs = [ 'lib/arm-linux-gnueabihf/librt.so.1', 'lib/arm-linux-gnueabihf/libpthread.so.0', 'lib/arm-linux-gnueabihf/libgcc_s.so.1', 'lib/arm-linux-gnueabihf/libc.so.6', 'lib/arm-linux-gnueabihf/ld-linux-armhf.so.3', 'lib/arm-linux-gnueabihf/libm.so.6', 'usr/lib/arm-linux-gnueabihf/libstdc++.so.6' ] arm_lib_dir = os.path.join(pepperdir, 'tools', 'lib', 'arm_trusted', 'lib') buildbot_common.MakeDir(arm_lib_dir) for arm_lib in arm_libs: arm_lib = os.path.join(OUT_DIR, 'arm_trusted', arm_lib) buildbot_common.CopyFile(arm_lib, arm_lib_dir) buildbot_common.CopyFile( os.path.join(OUT_DIR, 'arm_trusted', 'qemu-arm'), os.path.join(pepperdir, 'tools')) BuildStepBuildToolchains(pepperdir, toolchains, not options.skip_toolchain, options.clean) BuildStepUpdateHelpers(pepperdir, True) BuildStepUpdateUserProjects(pepperdir, toolchains, options.build_experimental, True) BuildStepCopyTextFiles(pepperdir, pepper_ver, chrome_revision, nacl_revision) # Ship with libraries prebuilt, so run that first. BuildStepBuildLibraries(pepperdir) GenerateNotice(pepperdir) # Verify the SDK contains what we expect. BuildStepVerifyFilelist(pepperdir) if options.tar: BuildStepTarBundle(pepper_ver, tarfile) if platform == 'linux': BuildStepBuildPNaClComponent(pepper_ver, chrome_revision) if options.build_app_engine and platform == 'linux': BuildStepBuildAppEngine(pepperdir, chrome_revision) if options.qemu: qemudir = os.path.join(NACL_DIR, 'toolchain', 'linux_arm-trusted') oshelpers.Copy(['-r', qemudir, pepperdir]) # Archive the results on Google Cloud Storage. if options.archive: BuildStepArchiveBundle('build', pepper_ver, chrome_revision, nacl_revision, tarfile) # Only archive sdk_tools/naclport/pnacl_component on linux. if platform == 'linux': BuildStepArchiveSDKTools() BuildStepArchivePNaClComponent(chrome_revision) return 0
def BuildStepBuildToolsTests(): buildbot_common.BuildStep('Run build_tools tests') test_all_py = os.path.join(SDK_SRC_DIR, 'build_tools', 'tests', 'test_all.py') buildbot_common.Run([sys.executable, test_all_py])
def main(args): parser = optparse.OptionParser(description=__doc__) parser.add_option('--nacl-tree-path', help='Path to native client tree for bionic build.', dest='nacl_tree_path') parser.add_option('--qemu', help='Add qemu for ARM.', action='store_true') parser.add_option('--bionic', help='Add bionic build.', action='store_true') parser.add_option('--tar', help='Force the tar step.', action='store_true') parser.add_option('--archive', help='Force the archive step.', action='store_true') parser.add_option('--release', help='PPAPI release version.', dest='release', default=None) parser.add_option('--build-ports', help='Build naclport bundle.', action='store_true') parser.add_option('--build-app-engine', help='Build AppEngine demos.', action='store_true') parser.add_option('--experimental', help='build experimental examples and libraries', action='store_true', dest='build_experimental') parser.add_option('--skip-toolchain', help='Skip toolchain untar', action='store_true') parser.add_option( '--mac-sdk', help='Set the mac-sdk (e.g. 10.6) to use when building with ninja.') parser.add_option( '--no-arm-trusted', action='store_true', help='Disable building of ARM trusted components (sel_ldr, etc).') # To setup bash completion for this command first install optcomplete # and then add this line to your .bashrc: # complete -F _optcomplete build_sdk.py try: import optcomplete optcomplete.autocomplete(parser) except ImportError: pass global options options, args = parser.parse_args(args[1:]) if args: parser.error("Unexpected arguments: %s" % str(args)) if options.nacl_tree_path: options.bionic = True toolchain_build = os.path.join(options.nacl_tree_path, 'toolchain_build') print 'WARNING: Building bionic toolchain from NaCl checkout.' print 'This option builds bionic from the sources currently in the' print 'provided NativeClient checkout, and the results instead of ' print 'downloading a toolchain from the builder. This may result in a' print 'NaCl SDK that can not run on ToT chrome.' print 'NOTE: To clobber you will need to run toolchain_build_bionic.py' print 'directly from the NativeClient checkout.' print '' response = raw_input("Type 'y' and hit enter to continue.\n") if response != 'y' and response != 'Y': print 'Aborting.' return 1 # Get head version of NativeClient tree buildbot_common.BuildStep('Build bionic toolchain.') buildbot_common.Run( [sys.executable, 'toolchain_build_bionic.py', '-f'], cwd=toolchain_build) else: toolchain_build = None if buildbot_common.IsSDKBuilder(): options.archive = True options.build_ports = True # TODO(binji): re-enable app_engine build when the linux builder stops # breaking when trying to git clone from github. # See http://crbug.com/412969. options.build_app_engine = False options.tar = True # NOTE: order matters here. This will be the order that is specified in the # Makefiles; the first toolchain will be the default. toolchains = ['pnacl', 'newlib', 'glibc', 'arm', 'host'] # Changes for experimental bionic builder if options.bionic: toolchains.append('bionic') options.build_ports = False options.build_app_engine = False print 'Building: ' + ' '.join(toolchains) if options.archive and not options.tar: parser.error('Incompatible arguments with archive.') chrome_version = int(build_version.ChromeMajorVersion()) chrome_revision = build_version.ChromeRevision() nacl_revision = build_version.NaClRevision() pepper_ver = str(chrome_version) pepper_old = str(chrome_version - 1) pepperdir = os.path.join(OUT_DIR, 'pepper_' + pepper_ver) pepperdir_old = os.path.join(OUT_DIR, 'pepper_' + pepper_old) if options.bionic: tarname = 'naclsdk_bionic.tar.bz2' else: tarname = 'naclsdk_' + getos.GetPlatform() + '.tar.bz2' tarfile = os.path.join(OUT_DIR, tarname) if options.release: pepper_ver = options.release print 'Building PEPPER %s at %s' % (pepper_ver, chrome_revision) if 'NACL_SDK_ROOT' in os.environ: # We don't want the currently configured NACL_SDK_ROOT to have any effect # of the build. del os.environ['NACL_SDK_ROOT'] if not options.skip_toolchain: BuildStepCleanPepperDirs(pepperdir, pepperdir_old) BuildStepMakePepperDirs(pepperdir, ['include', 'toolchain', 'tools']) BuildStepDownloadToolchains(toolchains) if options.nacl_tree_path: # Instead of untarring, copy the raw bionic toolchain not_bionic = [i for i in toolchains if i != 'bionic'] BuildStepUntarToolchains(pepperdir, not_bionic) tcname = GetToolchainDirName('bionic', 'arm') srcdir = os.path.join(toolchain_build, 'out', tcname) bionicdir = os.path.join(pepperdir, 'toolchain', tcname) oshelpers.Copy(['-r', srcdir, bionicdir]) else: BuildStepUntarToolchains(pepperdir, toolchains) BuildStepBuildToolchains(pepperdir, toolchains) BuildStepUpdateHelpers(pepperdir, True) BuildStepUpdateUserProjects(pepperdir, toolchains, options.build_experimental, True) BuildStepCopyTextFiles(pepperdir, pepper_ver, chrome_revision, nacl_revision) # Ship with libraries prebuilt, so run that first. BuildStepBuildLibraries(pepperdir, 'src') GenerateNotice(pepperdir) # Verify the SDK contains what we expect. if not options.bionic: BuildStepVerifyFilelist(pepperdir) if options.tar: BuildStepTarBundle(pepper_ver, tarfile) if options.build_ports and getos.GetPlatform() == 'linux': ports_tarfile = os.path.join(OUT_DIR, 'naclports.tar.bz2') BuildStepSyncNaClPorts() BuildStepBuildNaClPorts(pepper_ver, pepperdir) if options.tar: BuildStepTarNaClPorts(pepper_ver, ports_tarfile) if options.build_app_engine and getos.GetPlatform() == 'linux': BuildStepBuildAppEngine(pepperdir, chrome_revision) if options.qemu: qemudir = os.path.join(NACL_DIR, 'toolchain', 'linux_arm-trusted') oshelpers.Copy(['-r', qemudir, pepperdir]) # Archive on non-trybots. if options.archive: BuildStepArchiveBundle('build', pepper_ver, chrome_revision, nacl_revision, tarfile) if options.build_ports and getos.GetPlatform() == 'linux': BuildStepArchiveBundle('naclports', pepper_ver, chrome_revision, nacl_revision, ports_tarfile) BuildStepArchiveSDKTools() return 0