def UpdateHelpers(pepperdir, platform, clobber=False): if not os.path.exists(os.path.join(pepperdir, 'tools')): buildbot_common.ErrorExit('Examples depend on missing tools.') exampledir = os.path.join(pepperdir, 'examples') if clobber: buildbot_common.RemoveDir(exampledir) buildbot_common.MakeDir(exampledir) # Copy files for individual bild and landing page files = ['favicon.ico', 'httpd.cmd'] CopyFilesFromTo(files, SDK_EXAMPLE_DIR, exampledir) resourcesdir = os.path.join(SDK_EXAMPLE_DIR, 'resources') files = [ 'index.css', 'index.js', 'button_close.png', 'button_close_hover.png' ] CopyFilesFromTo(files, resourcesdir, exampledir) # Copy tools scripts and make includes buildbot_common.CopyDir(os.path.join(SDK_SRC_DIR, 'tools', '*.py'), os.path.join(pepperdir, 'tools')) buildbot_common.CopyDir(os.path.join(SDK_SRC_DIR, 'tools', '*.mk'), os.path.join(pepperdir, 'tools')) # On Windows add a prebuilt make if platform == 'win': buildbot_common.BuildStep('Add MAKE') http_download.HttpDownload( GSTORE + MAKE, os.path.join(pepperdir, 'tools', 'make.exe'))
def UpdateHelpers(pepperdir, clobber=False): tools_dir = os.path.join(pepperdir, 'tools') if not os.path.exists(tools_dir): buildbot_common.ErrorExit('SDK tools dir is missing: %s' % tools_dir) exampledir = os.path.join(pepperdir, 'examples') if clobber: buildbot_common.RemoveDir(exampledir) buildbot_common.MakeDir(exampledir) # Copy files for individual build and landing page files = ['favicon.ico', 'httpd.cmd', 'index.css', 'index.js', 'button_close.png', 'button_close_hover.png'] CopyFilesFromTo(files, SDK_RESOURCE_DIR, exampledir) # Copy tools scripts and make includes buildbot_common.CopyDir(os.path.join(SDK_SRC_DIR, 'tools', '*.py'), tools_dir) buildbot_common.CopyDir(os.path.join(SDK_SRC_DIR, 'tools', '*.mk'), tools_dir) # On Windows add a prebuilt make if getos.GetPlatform() == 'win': buildbot_common.BuildStep('Add MAKE') http_download.HttpDownload(GSTORE + MAKE, os.path.join(tools_dir, 'make.exe'))
def UpdateHelpers(pepperdir, clobber=False): tools_dir = os.path.join(pepperdir, 'tools') if not os.path.exists(tools_dir): buildbot_common.ErrorExit('SDK tools dir is missing: %s' % tools_dir) exampledir = os.path.join(pepperdir, 'examples') if clobber: buildbot_common.RemoveDir(exampledir) buildbot_common.MakeDir(exampledir) # Copy files for individual build and landing page files = ['favicon.ico', 'httpd.cmd', 'index.css', 'index.js', 'button_close.png', 'button_close_hover.png'] CopyFilesFromTo(files, SDK_RESOURCE_DIR, exampledir) # Copy tools scripts and make includes buildbot_common.CopyDir(os.path.join(SDK_SRC_DIR, 'tools', '*.py'), tools_dir) buildbot_common.CopyDir(os.path.join(SDK_SRC_DIR, 'tools', '*.mk'), tools_dir) # Copy tools/lib scripts tools_lib_dir = os.path.join(pepperdir, 'tools', 'lib') buildbot_common.MakeDir(tools_lib_dir) buildbot_common.CopyDir(os.path.join(SDK_SRC_DIR, 'tools', 'lib', '*.py'), tools_lib_dir) # On Windows add a prebuilt make if getos.GetPlatform() == 'win': buildbot_common.BuildStep('Add MAKE') make_url = posixpath.join(GSTORE, MAKE) make_exe = os.path.join(tools_dir, 'make.exe') with open(make_exe, 'wb') as f: f.write(urllib2.urlopen(make_url).read())
def GypNinjaBuild_X86(pepperdir, platform, toolchains): build_dir = 'gypbuild' GypNinjaBuild_X86_Nacl(platform, build_dir) GypNinjaBuild_X86_Chrome(build_dir) ninja_out_dir = os.path.join(OUT_DIR, build_dir, 'Release') # src_file, dst_file, is_host_exe? tools_files = [ ('sel_ldr', 'sel_ldr_x86_32', True), ('ncval_x86_32', 'ncval_x86_32', True), ('irt_core_newlib_x32.nexe', 'irt_core_newlib_x32.nexe', False), ('irt_core_newlib_x64.nexe', 'irt_core_newlib_x64.nexe', False), ] if platform != 'mac': # Mac doesn't build 64-bit binaries. tools_files.append(('sel_ldr64', 'sel_ldr_x86_64', True)) tools_files.append(('ncval_x86_64', 'ncval_x86_64', True)) if platform == 'linux': tools_files.append(('nacl_helper_bootstrap', 'nacl_helper_bootstrap_x86_32', True)) tools_files.append(('nacl_helper_bootstrap64', 'nacl_helper_bootstrap_x86_64', True)) buildbot_common.MakeDir(os.path.join(pepperdir, 'tools')) for src, dst, host_exe in tools_files: if platform == 'win' and host_exe: src += '.exe' dst += '.exe' buildbot_common.CopyFile( os.path.join(ninja_out_dir, src), os.path.join(pepperdir, 'tools', dst)) for tc in set(toolchains) & set(['newlib', 'glibc']): for bits in '32', '64': tc_dir = 'tc_' + tc lib_dir = 'lib' + bits src_dir = os.path.join(ninja_out_dir, 'gen', tc_dir, lib_dir) tcpath = os.path.join(pepperdir, 'toolchain', '%s_x86_%s' % (platform, tc)) dst_dir = GetToolchainNaClLib(tc, tcpath, 'x86', bits) buildbot_common.MakeDir(dst_dir) buildbot_common.CopyDir(os.path.join(src_dir, '*.a'), dst_dir) if tc == 'newlib': buildbot_common.CopyDir(os.path.join(src_dir, '*.o'), dst_dir) if tc == 'glibc': buildbot_common.CopyDir(os.path.join(src_dir, '*.so'), dst_dir) # TODO(binji): temporary hack; copy crt1.o from sdk toolchain directory. lib_dir = os.path.join(ninja_out_dir, 'gen', 'sdk', 'toolchain', '%s_x86_%s' % (platform, tc), 'x86_64-nacl', 'lib') if bits == '32': lib_dir += '32' buildbot_common.CopyFile(os.path.join(lib_dir, 'crt1.o'), dst_dir)
def BuildStepCopyBuildHelpers(pepperdir, platform): buildbot_common.BuildStep('Copy build helpers') buildbot_common.CopyDir(os.path.join(SDK_SRC_DIR, 'tools', '*.py'), os.path.join(pepperdir, 'tools')) buildbot_common.CopyDir(os.path.join(SDK_SRC_DIR, 'tools', '*.mk'), 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'))
def CopyExamples(pepperdir, toolchains): buildbot_common.BuildStep('Copy examples') if not os.path.exists(os.path.join(pepperdir, 'tools')): buildbot_common.ErrorExit('Examples depend on missing tools.') if not os.path.exists(os.path.join(pepperdir, 'toolchain')): buildbot_common.ErrorExit('Examples depend on missing toolchains.') exampledir = os.path.join(pepperdir, 'examples') buildbot_common.RemoveDir(exampledir) buildbot_common.MakeDir(exampledir) AddMakeBat(pepperdir, exampledir) # Copy individual files files = ['favicon.ico', 'httpd.cmd', 'httpd.py', 'index.html', 'Makefile'] for filename in files: oshelpers.Copy( ['-v', os.path.join(SDK_EXAMPLE_DIR, filename), exampledir]) # Add examples for supported toolchains examples = [] for tc in toolchains: examples.extend(EXAMPLE_MAP[tc]) for example in examples: buildbot_common.CopyDir(os.path.join(SDK_EXAMPLE_DIR, example), exampledir) AddMakeBat(pepperdir, os.path.join(exampledir, example))
def ExtractArchive(archive_path, destdirs): Untar(archive_path, EXTRACT_ARCHIVE_DIR) basename = RemoveExt(os.path.basename(archive_path)) srcdir = os.path.join(EXTRACT_ARCHIVE_DIR, basename) if type(destdirs) is not list: destdirs = [destdirs] for destdir in destdirs: if not os.path.exists(destdir): buildbot_common.MakeDir(destdir) src_files = glob.glob(os.path.join(srcdir, '*')) for src_file in src_files: buildbot_common.CopyDir(src_file, destdir)
def Copy(self, src_root, file_list): if type(file_list) is not list: file_list = [file_list] for file_spec in file_list: # The list of files to install can be a simple list of # strings or a list of pairs, where each pair corresponds # to a mapping from source to destination names. if type(file_spec) is str: src_file = dest_file = file_spec else: src_file, dest_file = file_spec src_file = os.path.join(src_root, src_file) # Expand sources files using glob. sources = glob.glob(src_file) if not sources: sources = [src_file] if len(sources) > 1: if not (dest_file.endswith('/') or dest_file == ''): buildbot_common.ErrorExit( "Target file %r must end in '/' or be empty when " "using globbing to install files %r" % (dest_file, sources)) for source in sources: if dest_file.endswith('/'): dest = os.path.join(dest_file, os.path.basename(source)) else: dest = dest_file dest = os.path.join(self.dirname, dest) if not os.path.isdir(os.path.dirname(dest)): buildbot_common.MakeDir(os.path.dirname(dest)) if os.path.isdir(source): buildbot_common.CopyDir(source, dest) else: buildbot_common.CopyFile(source, 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 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 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 GypNinjaInstall(pepperdir, platform, toolchains): build_dir = 'gypbuild' ninja_out_dir = os.path.join(OUT_DIR, build_dir, 'Release') # src_file, dst_file, is_host_exe? tools_files = [ ('sel_ldr', 'sel_ldr_x86_32', True), ('ncval_x86_32', 'ncval_x86_32', True), ('ncval_arm', 'ncval_arm', True), ('irt_core_newlib_x32.nexe', 'irt_core_newlib_x32.nexe', False), ('irt_core_newlib_x64.nexe', 'irt_core_newlib_x64.nexe', False), ] if platform != 'mac': # Mac doesn't build 64-bit binaries. tools_files.append(('sel_ldr64', 'sel_ldr_x86_64', True)) tools_files.append(('ncval_x86_64', 'ncval_x86_64', True)) if platform == 'linux': tools_files.append(('nacl_helper_bootstrap', 'nacl_helper_bootstrap_x86_32', True)) tools_files.append(('nacl_helper_bootstrap64', 'nacl_helper_bootstrap_x86_64', True)) buildbot_common.MakeDir(os.path.join(pepperdir, 'tools')) for src, dst, host_exe in tools_files: if platform == 'win' and host_exe: src += '.exe' dst += '.exe' buildbot_common.CopyFile( os.path.join(ninja_out_dir, src), os.path.join(pepperdir, 'tools', dst)) for tc in set(toolchains) & set(['newlib', 'glibc']): for archname in ('arm', '32', '64'): if tc == 'glibc' and archname == 'arm': continue tc_dir = 'tc_' + tc lib_dir = 'lib' + archname if archname == 'arm': build_dir = 'gypbuild-arm' tcdir = '%s_arm_%s' % (platform, tc) else: build_dir = 'gypbuild' tcdir = '%s_x86_%s' % (platform, tc) ninja_out_dir = os.path.join(OUT_DIR, build_dir, 'Release') src_dir = os.path.join(ninja_out_dir, 'gen', tc_dir, lib_dir) tcpath = os.path.join(pepperdir, 'toolchain', tcdir) dst_dir = GetToolchainNaClLib(tc, tcpath, 'x86', archname) buildbot_common.MakeDir(dst_dir) buildbot_common.CopyDir(os.path.join(src_dir, '*.a'), dst_dir) if tc == 'newlib': buildbot_common.CopyDir(os.path.join(src_dir, '*.o'), dst_dir) if tc == 'glibc': buildbot_common.CopyDir(os.path.join(src_dir, '*.so'), dst_dir) ninja_tcpath = os.path.join(ninja_out_dir, 'gen', 'sdk', 'toolchain', tcdir) lib_dir = GetToolchainNaClLib(tc, ninja_tcpath, 'x86', archname) buildbot_common.CopyFile(os.path.join(lib_dir, 'crt1.o'), dst_dir)
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='Only build the examples.', action='store_true', dest='only_examples', default=False) parser.add_option('--update', help='Only build the updater.', action='store_true', dest='only_updater', 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.only_examples or options.only_updater skip_examples = skip and not options.only_examples skip_update = skip and not options.only_updater skip_untar = skip skip_build = skip skip_test_updater = skip skip_tar = skip or options.skip_tar if options.archive and (options.only_examples or options.skip_tar): parser.error('Incompatible arguments with archive.') pepper_ver = str(int(build_utils.ChromeMajorVersion())) pepper_old = str(int(build_utils.ChromeMajorVersion()) - 1) clnumber = build_utils.ChromeRevision() 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 Dirs') pepperdir = os.path.join(SRC_DIR, 'out', 'pepper_' + pepper_ver) pepperold = os.path.join(SRC_DIR, 'out', 'pepper_' + pepper_old) buildbot_common.RemoveDir(pepperold) if not skip_untar: buildbot_common.RemoveDir(pepperdir) buildbot_common.MakeDir(os.path.join(pepperdir, 'libraries')) buildbot_common.MakeDir(os.path.join(pepperdir, 'toolchain')) buildbot_common.MakeDir(os.path.join(pepperdir, 'tools')) else: buildbot_common.MakeDir(pepperdir) if not skip_build: 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) InstallHeaders(os.path.join(pepperdir, 'libraries'), pepper_ver, 'libs') if not skip_build: 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')) rename_list = [ 'ncval_x86_32', 'ncval_x86_64', 'sel_ldr_x86_32', 'sel_ldr_x86_64' ] tools = os.path.join(pepperdir, 'tools') for name in rename_list: src = os.path.join(pepperdir, 'tools', name) dst = os.path.join(pepperdir, 'tools', name + '.exe') buildbot_common.Move(src, dst) if not skip_examples: CopyExamples(pepperdir, toolchains) tarname = 'naclsdk_' + platform + '.bz2' if 'pnacl' in toolchains: tarname = 'p' + tarname tarfile = os.path.join(OUT_DIR, tarname) if not skip_tar: buildbot_common.BuildStep('Tar Pepper Bundle') buildbot_common.Run([ sys.executable, CYGTAR, '-C', OUT_DIR, '-cjf', tarfile, 'pepper_' + pepper_ver ], cwd=NACL_DIR) # Run build tests buildbot_common.BuildStep('Run build_tools tests') buildbot_common.Run([ sys.executable, os.path.join(SDK_SRC_DIR, 'build_tools', 'tests', 'test_all.py') ]) # build sdk update if not skip_update: build_updater.BuildUpdater(OUT_DIR) # start local server sharing a manifest + the new bundle if not skip_test_updater and not skip_tar: buildbot_common.BuildStep('Move bundle to localserver dir') buildbot_common.MakeDir(SERVER_DIR) buildbot_common.Move(tarfile, SERVER_DIR) tarfile = os.path.join(SERVER_DIR, tarname) server = None try: buildbot_common.BuildStep('Run local server') server = test_server.LocalHTTPServer(SERVER_DIR) buildbot_common.BuildStep('Generate manifest') with open(tarfile, 'rb') as tarfile_stream: archive_sha1, archive_size = manifest_util.DownloadAndComputeHash( tarfile_stream) archive = manifest_util.Archive(manifest_util.GetHostOS()) archive.CopyFrom({ 'url': server.GetURL(tarname), 'size': archive_size, 'checksum': { 'sha1': archive_sha1 } }) bundle = manifest_util.Bundle('pepper_' + pepper_ver) bundle.CopyFrom({ 'revision': int(clnumber), 'repath': 'pepper_' + pepper_ver, 'version': int(pepper_ver), 'description': 'Chrome %s bundle, revision %s' % (pepper_ver, clnumber), 'stability': 'dev', 'recommended': 'no', 'archives': [archive] }) manifest = manifest_util.SDKManifest() manifest.SetBundle(bundle) manifest_name = 'naclsdk_manifest2.json' with open(os.path.join(SERVER_DIR, manifest_name), 'wb') as \ manifest_stream: manifest_stream.write(manifest.GetDataAsString()) # use newly built sdk updater to pull this bundle buildbot_common.BuildStep('Update from local server') naclsdk_sh = os.path.join(OUT_DIR, 'nacl_sdk', 'naclsdk') if platform == 'win': naclsdk_sh += '.bat' buildbot_common.Run([ naclsdk_sh, '-U', server.GetURL(manifest_name), 'update', 'pepper_' + pepper_ver ]) # If we are testing examples, do it in the newly pulled directory. pepperdir = os.path.join(OUT_DIR, 'nacl_sdk', 'pepper_' + pepper_ver) # kill server finally: if server: server.Shutdown() # build examples. if not skip_examples: buildbot_common.BuildStep('Test Build Examples') example_dir = os.path.join(pepperdir, 'examples') makefile = os.path.join(example_dir, 'Makefile') if os.path.isfile(makefile): print "\n\nMake: " + example_dir buildbot_common.Run(['make', '-j8'], cwd=os.path.abspath(example_dir), shell=True) # Archive on non-trybots. buildername = os.environ.get('BUILDBOT_BUILDERNAME', '') if options.archive or '-sdk' in buildername: buildbot_common.BuildStep('Archive build') bucket_path = 'nativeclient-mirror/nacl/nacl_sdk/%s' % \ build_utils.ChromeVersion() buildbot_common.Archive(tarname, bucket_path, os.path.dirname(tarfile)) if not skip_update: # Only push up sdk_tools.tgz on the linux buildbot. if buildername == 'linux-sdk-multi': sdk_tools = os.path.join(OUT_DIR, 'sdk_tools.tgz') buildbot_common.Archive('sdk_tools.tgz', bucket_path, OUT_DIR, step_link=False) # generate "manifest snippet" for this archive. if not skip_test_updater: archive = bundle.GetArchive(manifest_util.GetHostOS()) archive.url = 'https://commondatastorage.googleapis.com/' \ 'nativeclient-mirror/nacl/nacl_sdk/%s/%s' % ( build_utils.ChromeVersion(), tarname) manifest_snippet_file = os.path.join(OUT_DIR, tarname + '.json') with open(manifest_snippet_file, 'wb') as manifest_snippet_stream: manifest_snippet_stream.write(bundle.GetDataAsString()) buildbot_common.Archive(tarname + '.json', bucket_path, OUT_DIR, step_link=False) return 0
def InstallCommonHeaders(inc_path): # Clean out per toolchain ppapi directory ppapi = os.path.join(inc_path, 'ppapi') buildbot_common.RemoveDir(ppapi) # Copy in c, c/dev and c/extensions/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')) buildbot_common.MakeDir(os.path.join(ppapi, 'c', 'extensions', 'dev')) buildbot_common.CopyDir( os.path.join(PPAPI_DIR, 'c', 'extensions', 'dev', '*.h'), os.path.join(ppapi, 'c', 'extensions', 'dev')) # 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, 'cpp', 'extensions', 'dev')) buildbot_common.CopyDir(os.path.join(PPAPI_DIR, 'cpp', 'extensions', '*.h'), os.path.join(ppapi, 'cpp', 'extensions')) buildbot_common.CopyDir( os.path.join(PPAPI_DIR, 'cpp', 'extensions', 'dev', '*.h'), os.path.join(ppapi, 'cpp', 'extensions', 'dev')) buildbot_common.MakeDir(os.path.join(ppapi, 'utility', 'graphics')) buildbot_common.MakeDir(os.path.join(ppapi, 'utility', 'threading')) buildbot_common.MakeDir(os.path.join(ppapi, 'utility', 'websocket')) 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')) buildbot_common.CopyDir( os.path.join(PPAPI_DIR, 'utility', 'threading', '*.h'), os.path.join(ppapi, 'utility', 'threading')) buildbot_common.CopyDir( os.path.join(PPAPI_DIR, 'utility', 'websocket', '*.h'), os.path.join(ppapi, 'utility', 'websocket')) # 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(inc_path, 'EGL')) buildbot_common.CopyDir( os.path.join(PPAPI_DIR, 'lib', 'gl', 'include', 'EGL', '*.h'), os.path.join(inc_path, 'EGL')) # Copy the GLES2 headers buildbot_common.MakeDir(os.path.join(inc_path, 'GLES2')) buildbot_common.CopyDir( os.path.join(PPAPI_DIR, 'lib', 'gl', 'include', 'GLES2', '*.h'), os.path.join(inc_path, 'GLES2')) # Copy the KHR headers buildbot_common.MakeDir(os.path.join(inc_path, 'KHR')) buildbot_common.CopyDir( os.path.join(PPAPI_DIR, 'lib', 'gl', 'include', 'KHR', '*.h'), os.path.join(inc_path, 'KHR')) # Copy the lib files buildbot_common.CopyDir(os.path.join(PPAPI_DIR, 'lib'), os.path.join(inc_path, 'ppapi'))