|
| 1 | +#!/usr/bin/env python |
| 2 | + |
| 3 | +Import("env") |
| 4 | +Import("env_modules") |
| 5 | + |
| 6 | +env_breakpad = env_modules.Clone() |
| 7 | + |
| 8 | +# Thirdparty source files |
| 9 | + |
| 10 | +thirdparty_obj = [] |
| 11 | + |
| 12 | +thirdparty_dir = "#thirdparty/breakpad/" |
| 13 | + |
| 14 | +# TODO: find out when these are needed (if at all) |
| 15 | +dwarf_module = False |
| 16 | +stabs_module = False |
| 17 | + |
| 18 | +# Parts of this build script is based on the previous PR trying to implement this |
| 19 | +# https://github.com/godotengine/godot/pull/22778/files |
| 20 | + |
| 21 | +env_breakpad.Append( |
| 22 | + CPPDEFINES=[ |
| 23 | + "PUBLIC", |
| 24 | + "_HAS_EXCEPTIONS=0", |
| 25 | + "_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS", |
| 26 | + ] |
| 27 | +) |
| 28 | + |
| 29 | +breakpad_src = [ |
| 30 | + "src/common/convert_UTF.cc", |
| 31 | + "src/common/md5.cc", |
| 32 | + "src/common/string_conversion.cc", |
| 33 | +] |
| 34 | + |
| 35 | +if env["platform"] == "linuxbsd": |
| 36 | + breakpad_src += [ |
| 37 | + "src/client/linux/crash_generation/crash_generation_client.cc", |
| 38 | + "src/client/linux/crash_generation/crash_generation_server.cc", |
| 39 | + "src/client/linux/dump_writer_common/thread_info.cc", |
| 40 | + "src/client/linux/dump_writer_common/ucontext_reader.cc", |
| 41 | + "src/client/linux/handler/exception_handler.cc", |
| 42 | + "src/client/linux/handler/minidump_descriptor.cc", |
| 43 | + "src/client/linux/log/log.cc", |
| 44 | + "src/client/linux/microdump_writer/microdump_writer.cc", |
| 45 | + "src/client/linux/minidump_writer/pe_file.cc", |
| 46 | + "src/client/linux/minidump_writer/linux_core_dumper.cc", |
| 47 | + "src/client/linux/minidump_writer/linux_dumper.cc", |
| 48 | + "src/client/linux/minidump_writer/linux_ptrace_dumper.cc", |
| 49 | + "src/client/linux/minidump_writer/minidump_writer.cc", |
| 50 | + "src/client/minidump_file_writer.cc", |
| 51 | + "src/common/language.cc", |
| 52 | + "src/common/linux/breakpad_getcontext.S", |
| 53 | + "src/common/linux/crc32.cc", |
| 54 | + "src/common/linux/elf_core_dump.cc", |
| 55 | + "src/common/linux/elf_symbols_to_module.cc", |
| 56 | + "src/common/linux/elfutils.cc", |
| 57 | + "src/common/linux/file_id.cc", |
| 58 | + "src/common/linux/guid_creator.cc", |
| 59 | + "src/common/linux/linux_libc_support.cc", |
| 60 | + "src/common/linux/memory_mapped_file.cc", |
| 61 | + "src/common/linux/safe_readlink.cc", |
| 62 | + "src/common/path_helper.cc", |
| 63 | + ] |
| 64 | + |
| 65 | +if env["platform"] == "windows": |
| 66 | + env_breakpad.Append( |
| 67 | + CPPDEFINES=[ |
| 68 | + "_CRT_SECURE_NO_WARNINGS", |
| 69 | + "NOMINMAX", |
| 70 | + "WIN32_LEAN_AND_MEAN", |
| 71 | + "_UNICODE", |
| 72 | + "UNICODE", |
| 73 | + ] |
| 74 | + ) |
| 75 | + |
| 76 | + breakpad_src += [ |
| 77 | + "src/client/windows/crash_generation/client_info.cc", |
| 78 | + "src/client/windows/crash_generation/crash_generation_client.cc", |
| 79 | + "src/client/windows/crash_generation/crash_generation_server.cc", |
| 80 | + "src/client/windows/crash_generation/minidump_generator.cc", |
| 81 | + "src/client/windows/handler/exception_handler.cc", |
| 82 | + "src/common/windows/guid_string.cc", |
| 83 | + "src/common/windows/pe_source_line_writer.cc", |
| 84 | + "src/common/windows/string_utils.cc", |
| 85 | + ] |
| 86 | + |
| 87 | + |
| 88 | +if env["platform"] == "osx" or env["platform"] == "iphone": |
| 89 | + breakpad_src += [ |
| 90 | + "src/common/simple_string_dictionary.cc", |
| 91 | + ] |
| 92 | + |
| 93 | +if env["platform"] == "osx": |
| 94 | + breakpad_src += [ |
| 95 | + "src/client/mac/Framework/Breakpad.mm", |
| 96 | + "src/client/mac/Framework/OnDemandServer.mm", |
| 97 | + "src/client/mac/crash_generation/ConfigFile.mm", |
| 98 | + "src/client/mac/crash_generation/Inspector.mm", |
| 99 | + "src/client/mac/crash_generation/InspectorMain.mm", |
| 100 | + "src/client/mac/crash_generation/crash_generation_client.cc", |
| 101 | + "src/client/mac/crash_generation/crash_generation_server.cc", |
| 102 | + "src/client/mac/handler/breakpad_nlist_64.cc", |
| 103 | + "src/client/mac/handler/dynamic_images.cc", |
| 104 | + "src/client/mac/handler/exception_handler.cc", |
| 105 | + "src/client/mac/handler/minidump_generator.cc", |
| 106 | + "src/client/mac/handler/protected_memory_allocator.cc", |
| 107 | + "src/common/mac/GTMLogger.m", |
| 108 | + "src/common/mac/HTTPGetRequest.m", |
| 109 | + "src/common/mac/HTTPPutRequest.m", |
| 110 | + "src/common/mac/HTTPRequest.m", |
| 111 | + "src/common/mac/HTTPSimplePostRequest.m", |
| 112 | + "src/common/mac/MachIPC.mm", |
| 113 | + "src/common/mac/arch_utilities.cc", |
| 114 | + "src/common/mac/bootstrap_compat.cc", |
| 115 | + "src/common/mac/encoding_util.m", |
| 116 | + "src/common/mac/file_id.cc", |
| 117 | + "src/common/mac/launch_reporter.cc", |
| 118 | + "src/common/mac/macho_id.cc", |
| 119 | + "src/common/mac/macho_reader.cc", |
| 120 | + "src/common/mac/macho_utilities.cc", |
| 121 | + "src/common/mac/macho_walker.cc", |
| 122 | + "src/common/mac/string_utilities.cc", |
| 123 | + ] |
| 124 | + |
| 125 | +if env["platform"] == "iphone": |
| 126 | + breakpad_src += [ |
| 127 | + "src/client/ios/Breakpad.mm", |
| 128 | + "src/client/ios/BreakpadController.mm", |
| 129 | + "src/client/ios/exception_handler_no_mach.cc", |
| 130 | + "src/client/ios/handler/ios_exception_minidump_generator.mm", |
| 131 | + "src/common/long_string_dictionary.cc", |
| 132 | + ] |
| 133 | + |
| 134 | +# if solaris: |
| 135 | +# breakpad_src += [ |
| 136 | +# "src/client/solaris/handler/Makefile", |
| 137 | +# "src/client/solaris/handler/exception_handler.cc", |
| 138 | +# "src/client/solaris/handler/minidump_generator.cc", |
| 139 | +# "src/client/solaris/handler/solaris_lwp.cc", |
| 140 | +# "src/common/solaris/file_id.cc", |
| 141 | +# "src/common/solaris/guid_creator.cc", |
| 142 | +# ] |
| 143 | + |
| 144 | +if dwarf_module: |
| 145 | + breakpad_src += [ |
| 146 | + "src/common/dwarf/bytereader.cc", |
| 147 | + "src/common/dwarf/cfi_assembler.cc", |
| 148 | + "src/common/dwarf/dwarf2diehandler.cc", |
| 149 | + "src/common/dwarf/dwarf2reader.cc", |
| 150 | + "src/common/dwarf/elf_reader.cc", |
| 151 | + "src/common/dwarf/functioninfo.cc", |
| 152 | + "src/common/dwarf_cfi_to_module.cc", |
| 153 | + "src/common/dwarf_cu_to_module.cc", |
| 154 | + "src/common/dwarf_line_to_module.cc", |
| 155 | + "src/common/dwarf_range_list_handler.cc", |
| 156 | + "src/common/module.cc", |
| 157 | + ] |
| 158 | + |
| 159 | +if stabs_module: |
| 160 | + breakpad_src += [ |
| 161 | + "src/common/stabs_reader.cc", |
| 162 | + "src/common/stabs_to_module.cc", |
| 163 | + ] |
| 164 | + |
| 165 | +breakpad_src = [thirdparty_dir + file for file in breakpad_src] |
| 166 | + |
| 167 | +env_breakpad.Prepend(CPPPATH=[thirdparty_dir + "src"]) |
| 168 | + |
| 169 | +env_thirdparty = env_breakpad.Clone() |
| 170 | +env_thirdparty.disable_warnings() |
| 171 | +env_thirdparty.add_source_files(thirdparty_obj, breakpad_src) |
| 172 | +env.modules_sources += thirdparty_obj |
| 173 | + |
| 174 | + |
| 175 | +# Godot source files |
| 176 | + |
| 177 | +module_obj = [] |
| 178 | + |
| 179 | +if env["platform"] == "linuxbsd" or env["platform"] == "windows": |
| 180 | + env_breakpad.add_source_files(module_obj, ["breakpad_linuxbsd_windows.cpp"]) |
| 181 | +else: |
| 182 | + raise Exception("Breakpad not implemented for selected platform") |
| 183 | + |
| 184 | +env.modules_sources += module_obj |
| 185 | + |
| 186 | +# Needed to force rebuilding the module files when the thirdparty library is updated. |
| 187 | +env.Depends(module_obj, thirdparty_obj) |
0 commit comments