def make_lsdump(self, default_cflags): """ For each source file, produce a .sdump file, and link them to form an lsump file""" dumps_to_link = [] with tempfile.TemporaryDirectory() as tmp: output_lsdump = os.path.join(tmp, self.name) + SOURCE_ABI_DUMP_EXT for src in self.srcs: output_path = os.path.join(tmp, os.path.basename(src)) + '.sdump' dumps_to_link.append(output_path) run_header_abi_dumper_on_file( src, output_path, self.export_include_dirs, self.cflags + self.arch_cflags + default_cflags) return run_header_abi_linker(output_lsdump, dumps_to_link, self.version_script, self.api, self.arch)
def make_dump(self, output_path): """For each source file, produce a .sdump file, and link them to form an lsump file.""" dumps_to_link = [] with tempfile.TemporaryDirectory() as tmp: for src in self.srcs: sdump_path = os.path.join(tmp, os.path.basename(src) + '.sdump') dumps_to_link.append(sdump_path) run_header_abi_dumper(src, sdump_path, self.cflags + self.arch_cflags, self.export_include_dirs, self.dumper_flags) lsdump_path = os.path.join(tmp, self.get_dump_name()) run_header_abi_linker(dumps_to_link, lsdump_path, self.version_script, self.api, self.arch, self.linker_flags) # Replace the absolute tmp paths in the type ID. with open(lsdump_path, 'r') as lsdump_file: content = lsdump_file.read().replace(tmp, '') with open(output_path, 'w') as output_file: output_file.write(content)
def make_dump(self): """For each source file, produce a .sdump file, and link them to form an lsump file.""" dumps_to_link = [] with tempfile.TemporaryDirectory() as tmp: output_lsdump = os.path.join(tmp, self.get_dump_name()) for src in self.srcs: output_path = os.path.join(tmp, os.path.basename(src) + '.sdump') dumps_to_link.append(output_path) content = run_header_abi_dumper(src, self.cflags + self.arch_cflags, self.export_include_dirs, self.dumper_flags) with open(output_path, 'w') as dump_file: dump_file.write(content) return run_header_abi_linker(output_lsdump, dumps_to_link, self.version_script, self.api, self.arch, self.linker_flags, input_dir=tmp)