# vim: set ts=2 sw=2 tw=99 noet ft=python: import os import ambuild.osutil as osutil from ambuild.command import SymlinkCommand from ambuild.command import ShellCommand from ambuild.command import DirectCommand def BuildEverything(): if AMBuild.target['platform'] not in ['linux', 'windows']: return compiler = SM.DefaultCompiler() if AMBuild.target['platform'] in ['linux']: compiler['POSTLINKFLAGS'].append('-lm') compiler['POSTLINKFLAGS'].append('-lstdc++') compiler['POSTLINKFLAGS'].append('-pthread') compiler['CDEFINES'].append('HAVE_CONFIG_H') compiler['CXXINCLUDES'].append(os.path.join(AMBuild.sourceFolder, 'breakpad', 'build', 'src')) elif compiler.cc.name == 'msvc': compiler['POSTLINKFLAGS'].remove('/SUBSYSTEM:WINDOWS') compiler['POSTLINKFLAGS'].append('/SUBSYSTEM:CONSOLE') compiler['CXXINCLUDES'].append(os.path.join(AMBuild.sourceFolder, 'breakpad', 'src', 'src')) name = 'test-crash-dump-generation' extension = AMBuild.AddJob(name) binary = Cpp.ExecutableBuilder(name, AMBuild, extension, compiler) sourceFiles = [ 'test.cpp', ] if AMBuild.target['platform'] in ['linux']: sourceFiles.extend([ os.path.join(AMBuild.sourceFolder, 'breakpad', 'src', 'src', 'common', 'dwarf_cfi_to_module.cc'), os.path.join(AMBuild.sourceFolder, 'breakpad', 'src', 'src', 'common', 'dwarf_cu_to_module.cc'), os.path.join(AMBuild.sourceFolder, 'breakpad', 'src', 'src', 'common', 'dwarf_line_to_module.cc'), os.path.join(AMBuild.sourceFolder, 'breakpad', 'src', 'src', 'common', 'language.cc'), os.path.join(AMBuild.sourceFolder, 'breakpad', 'src', 'src', 'common', 'module.cc'), os.path.join(AMBuild.sourceFolder, 'breakpad', 'src', 'src', 'common', 'path_helper.cc'), os.path.join(AMBuild.sourceFolder, 'breakpad', 'src', 'src', 'common', 'stabs_reader.cc'), os.path.join(AMBuild.sourceFolder, 'breakpad', 'src', 'src', 'common', 'stabs_to_module.cc'), os.path.join(AMBuild.sourceFolder, 'breakpad', 'src', 'src', 'common', 'dwarf', 'bytereader.cc'), os.path.join(AMBuild.sourceFolder, 'breakpad', 'src', 'src', 'common', 'dwarf', 'dwarf2diehandler.cc'), os.path.join(AMBuild.sourceFolder, 'breakpad', 'src', 'src', 'common', 'dwarf', 'dwarf2reader.cc'), os.path.join(AMBuild.sourceFolder, 'breakpad', 'src', 'src', 'common', 'dwarf', 'elf_reader.cc'), os.path.join(AMBuild.sourceFolder, 'breakpad', 'src', 'src', 'common', 'linux', 'crc32.cc'), os.path.join(AMBuild.sourceFolder, 'breakpad', 'src', 'src', 'common', 'linux', 'dump_symbols.cc'), os.path.join(AMBuild.sourceFolder, 'breakpad', 'src', 'src', 'common', 'linux', 'elf_symbols_to_module.cc'), ]) binary.AddSourceFiles('test', sourceFiles); if AMBuild.target['platform'] in ['linux']: libs = [ ('libbreakpad_client.a', os.path.join('breakpad', 'build', 'src', 'client', 'linux', 'libbreakpad_client.a')), ('libbreakpad.a', os.path.join('breakpad', 'build', 'src', 'libbreakpad.a')), ('libdisasm.a', os.path.join('breakpad', 'build', 'src', 'third_party', 'libdisasm', 'libdisasm.a')), ] for lib, target in libs: link = os.path.join(AMBuild.outputFolder, extension.workFolder, lib) target = os.path.join(AMBuild.sourceFolder, target) try: os.lstat(link) except: extension.AddCommand(SymlinkCommand(link, target)) binary.AddObjectFiles([lib]) elif AMBuild.target['platform'] in ['windows']: libs = [ os.path.join(AMBuild.sourceFolder, 'breakpad', 'src', 'src', 'client', 'windows', 'handler', 'Release', 'lib', 'common.lib'), os.path.join(AMBuild.sourceFolder, 'breakpad', 'src', 'src', 'client', 'windows', 'handler', 'Release', 'lib', 'exception_handler.lib'), os.path.join(AMBuild.sourceFolder, 'breakpad', 'src', 'src', 'client', 'windows', 'crash_generation', 'Release', 'lib', 'crash_generation_client.lib'), os.path.join(AMBuild.sourceFolder, 'breakpad', 'src', 'src', 'processor', 'Release', 'lib', 'libdisasm.lib'), os.path.join(AMBuild.sourceFolder, 'breakpad', 'src', 'src', 'processor', 'Release', 'lib', 'processor.lib'), ] for path in libs: if os.path.isfile(path): binary.RelinkIfNewer(path) binary['POSTLINKFLAGS'].extend([path]) SM.ExtractDebugInfo(extension, binary) binary.SendToJob() BuildEverything()