2016-07-01 23:43:09 +02:00
|
|
|
# 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():
|
2018-07-19 18:33:19 +02:00
|
|
|
if AMBuild.target['platform'] not in ['linux', 'windows']:
|
2016-07-01 23:43:09 +02:00
|
|
|
return
|
|
|
|
|
|
|
|
compiler = SM.DefaultCompiler()
|
|
|
|
|
|
|
|
if AMBuild.target['platform'] in ['linux']:
|
2018-07-20 02:17:53 +02:00
|
|
|
compiler['POSTLINKFLAGS'].append('-lm')
|
2016-07-01 23:43:09 +02:00
|
|
|
compiler['POSTLINKFLAGS'].append('-lstdc++')
|
|
|
|
compiler['POSTLINKFLAGS'].append('-pthread')
|
2018-07-20 02:17:53 +02:00
|
|
|
|
|
|
|
compiler['CDEFINES'].append('HAVE_CONFIG_H')
|
|
|
|
compiler['CXXINCLUDES'].append(os.path.join(AMBuild.sourceFolder, 'breakpad', 'build', 'src'))
|
2018-07-19 18:33:19 +02:00
|
|
|
elif compiler.cc.name == 'msvc':
|
|
|
|
compiler['POSTLINKFLAGS'].remove('/SUBSYSTEM:WINDOWS')
|
|
|
|
compiler['POSTLINKFLAGS'].append('/SUBSYSTEM:CONSOLE')
|
2016-07-01 23:43:09 +02:00
|
|
|
|
2018-07-20 02:17:53 +02:00
|
|
|
compiler['CXXINCLUDES'].append(os.path.join(AMBuild.sourceFolder, 'breakpad', 'src', 'src'))
|
|
|
|
|
2016-07-02 05:53:55 +02:00
|
|
|
name = 'test-crash-dump-generation'
|
2016-07-01 23:43:09 +02:00
|
|
|
extension = AMBuild.AddJob(name)
|
|
|
|
binary = Cpp.ExecutableBuilder(name, AMBuild, extension, compiler)
|
|
|
|
|
2019-01-05 14:00:59 +01:00
|
|
|
binary.AddSourceFiles('test', [
|
2019-01-05 02:57:01 +01:00
|
|
|
'test.cpp',
|
2019-01-05 14:00:59 +01:00
|
|
|
]);
|
2019-01-05 02:57:01 +01:00
|
|
|
|
|
|
|
if AMBuild.target['platform'] in ['linux']:
|
2019-01-05 14:00:59 +01:00
|
|
|
binary.AddSourceFiles(os.path.join('breakpad', 'src', 'src', 'common'), [
|
|
|
|
'dwarf_cfi_to_module.cc',
|
|
|
|
'dwarf_cu_to_module.cc',
|
|
|
|
'dwarf_line_to_module.cc',
|
|
|
|
'dwarf_range_list_handler.cc',
|
|
|
|
'language.cc',
|
|
|
|
'module.cc',
|
|
|
|
'path_helper.cc',
|
|
|
|
'stabs_reader.cc',
|
|
|
|
'stabs_to_module.cc',
|
|
|
|
'dwarf/bytereader.cc',
|
|
|
|
'dwarf/dwarf2diehandler.cc',
|
|
|
|
'dwarf/dwarf2reader.cc',
|
|
|
|
'dwarf/elf_reader.cc',
|
|
|
|
'linux/crc32.cc',
|
|
|
|
'linux/dump_symbols.cc',
|
|
|
|
'linux/elf_symbols_to_module.cc',
|
2022-09-04 10:10:35 +02:00
|
|
|
'linux/breakpad_getcontext.S',
|
2019-01-05 02:57:01 +01:00
|
|
|
])
|
2018-07-20 02:17:53 +02:00
|
|
|
|
2016-07-01 23:43:09 +02:00
|
|
|
if AMBuild.target['platform'] in ['linux']:
|
2017-08-30 20:47:05 +02:00
|
|
|
libs = [
|
2018-07-19 14:55:28 +02:00
|
|
|
('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')),
|
2017-08-30 20:47:05 +02:00
|
|
|
]
|
|
|
|
|
|
|
|
for lib, target in libs:
|
|
|
|
link = os.path.join(AMBuild.outputFolder, extension.workFolder, lib)
|
2018-07-19 14:55:28 +02:00
|
|
|
target = os.path.join(AMBuild.sourceFolder, target)
|
2017-08-30 20:47:05 +02:00
|
|
|
try:
|
|
|
|
os.lstat(link)
|
|
|
|
except:
|
|
|
|
extension.AddCommand(SymlinkCommand(link, target))
|
|
|
|
binary.AddObjectFiles([lib])
|
2016-07-01 23:43:09 +02:00
|
|
|
|
|
|
|
elif AMBuild.target['platform'] in ['windows']:
|
2018-07-19 18:33:19 +02:00
|
|
|
libs = [
|
2019-01-05 02:57:01 +01:00
|
|
|
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'),
|
2019-01-05 14:00:59 +01:00
|
|
|
os.path.join(AMBuild.sourceFolder, 'breakpad', 'src', 'src', 'third_party', 'libdisasm', 'Release', 'lib', 'libdisasm.lib'),
|
2019-01-05 02:57:01 +01:00
|
|
|
os.path.join(AMBuild.sourceFolder, 'breakpad', 'src', 'src', 'processor', 'Release', 'lib', 'processor.lib'),
|
2018-07-19 18:33:19 +02:00
|
|
|
]
|
|
|
|
|
|
|
|
for path in libs:
|
2016-07-01 23:43:09 +02:00
|
|
|
if os.path.isfile(path):
|
|
|
|
binary.RelinkIfNewer(path)
|
|
|
|
binary['POSTLINKFLAGS'].extend([path])
|
|
|
|
|
|
|
|
SM.ExtractDebugInfo(extension, binary)
|
|
|
|
|
|
|
|
binary.SendToJob()
|
|
|
|
|
|
|
|
BuildEverything()
|