mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
add pkg/breakpad, configure sentry to use breakpad
This commit is contained in:
@ -1004,7 +1004,7 @@ fn addDeps(
|
||||
const sentry_dep = b.dependency("sentry", .{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.backend = .inproc,
|
||||
.backend = .breakpad,
|
||||
});
|
||||
const zlib_dep = b.dependency("zlib", .{
|
||||
.target = target,
|
||||
|
156
pkg/breakpad/build.zig
Normal file
156
pkg/breakpad/build.zig
Normal file
@ -0,0 +1,156 @@
|
||||
const std = @import("std");
|
||||
|
||||
pub fn build(b: *std.Build) !void {
|
||||
const target = b.standardTargetOptions(.{});
|
||||
const optimize = b.standardOptimizeOption(.{});
|
||||
|
||||
const upstream = b.dependency("breakpad", .{});
|
||||
|
||||
const lib = b.addStaticLibrary(.{
|
||||
.name = "breakpad",
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
lib.linkLibCpp();
|
||||
lib.addIncludePath(upstream.path("src"));
|
||||
if (target.result.isDarwin()) {
|
||||
const apple_sdk = @import("apple_sdk");
|
||||
try apple_sdk.addPaths(b, &lib.root_module);
|
||||
}
|
||||
|
||||
var flags = std.ArrayList([]const u8).init(b.allocator);
|
||||
defer flags.deinit();
|
||||
try flags.appendSlice(&.{});
|
||||
|
||||
lib.addCSourceFiles(.{
|
||||
.root = upstream.path(""),
|
||||
.files = common,
|
||||
.flags = flags.items,
|
||||
});
|
||||
|
||||
if (target.result.isDarwin()) {
|
||||
lib.addCSourceFiles(.{
|
||||
.root = upstream.path(""),
|
||||
.files = common_apple,
|
||||
.flags = flags.items,
|
||||
});
|
||||
lib.addCSourceFiles(.{
|
||||
.root = upstream.path(""),
|
||||
.files = client_apple,
|
||||
.flags = flags.items,
|
||||
});
|
||||
|
||||
switch (target.result.os.tag) {
|
||||
.macos => {
|
||||
lib.addCSourceFiles(.{
|
||||
.root = upstream.path(""),
|
||||
.files = common_mac,
|
||||
.flags = flags.items,
|
||||
});
|
||||
lib.addCSourceFiles(.{
|
||||
.root = upstream.path(""),
|
||||
.files = client_mac,
|
||||
.flags = flags.items,
|
||||
});
|
||||
},
|
||||
|
||||
.ios => lib.addCSourceFiles(.{
|
||||
.root = upstream.path(""),
|
||||
.files = client_ios,
|
||||
.flags = flags.items,
|
||||
}),
|
||||
|
||||
else => {},
|
||||
}
|
||||
}
|
||||
|
||||
if (target.result.os.tag == .linux) {
|
||||
lib.addCSourceFiles(.{
|
||||
.root = upstream.path(""),
|
||||
.files = common_linux,
|
||||
.flags = flags.items,
|
||||
});
|
||||
lib.addCSourceFiles(.{
|
||||
.root = upstream.path(""),
|
||||
.files = client_linux,
|
||||
.flags = flags.items,
|
||||
});
|
||||
}
|
||||
|
||||
lib.installHeadersDirectory(
|
||||
upstream.path("src"),
|
||||
"",
|
||||
.{ .include_extensions = &.{".h"} },
|
||||
);
|
||||
|
||||
b.installArtifact(lib);
|
||||
}
|
||||
|
||||
const common: []const []const u8 = &.{
|
||||
"src/common/convert_UTF.cc",
|
||||
"src/common/md5.cc",
|
||||
"src/common/string_conversion.cc",
|
||||
};
|
||||
|
||||
const common_linux: []const []const u8 = &.{
|
||||
"src/common/linux/elf_core_dump.cc",
|
||||
"src/common/linux/elfutils.cc",
|
||||
"src/common/linux/file_id.cc",
|
||||
"src/common/linux/guid_creator.cc",
|
||||
"src/common/linux/linux_libc_support.cc",
|
||||
"src/common/linux/memory_mapped_file.cc",
|
||||
"src/common/linux/safe_readlink.cc",
|
||||
"src/common/linux/scoped_pipe.cc",
|
||||
"src/common/linux/scoped_tmpfile.cc",
|
||||
"src/common/linux/breakpad_getcontext.S",
|
||||
};
|
||||
|
||||
const common_apple: []const []const u8 = &.{
|
||||
"src/common/mac/arch_utilities.cc",
|
||||
"src/common/mac/file_id.cc",
|
||||
"src/common/mac/macho_id.cc",
|
||||
"src/common/mac/macho_utilities.cc",
|
||||
"src/common/mac/macho_walker.cc",
|
||||
"src/common/mac/string_utilities.cc",
|
||||
};
|
||||
|
||||
const common_mac: []const []const u8 = &.{
|
||||
"src/common/mac/MachIPC.mm",
|
||||
"src/common/mac/bootstrap_compat.cc",
|
||||
};
|
||||
|
||||
const client_linux: []const []const u8 = &.{
|
||||
"src/client/minidump_file_writer.cc",
|
||||
"src/client/linux/crash_generation/crash_generation_client.cc",
|
||||
"src/client/linux/crash_generation/crash_generation_server.cc",
|
||||
"src/client/linux/dump_writer_common/thread_info.cc",
|
||||
"src/client/linux/dump_writer_common/ucontext_reader.cc",
|
||||
"src/client/linux/handler/exception_handler.cc",
|
||||
"src/client/linux/handler/minidump_descriptor.cc",
|
||||
"src/client/linux/log/log.cc",
|
||||
"src/client/linux/microdump_writer/microdump_writer.cc",
|
||||
"src/client/linux/minidump_writer/linux_core_dumper.cc",
|
||||
"src/client/linux/minidump_writer/linux_dumper.cc",
|
||||
"src/client/linux/minidump_writer/linux_ptrace_dumper.cc",
|
||||
"src/client/linux/minidump_writer/minidump_writer.cc",
|
||||
"src/client/linux/minidump_writer/pe_file.cc",
|
||||
};
|
||||
|
||||
const client_apple: []const []const u8 = &.{
|
||||
"src/client/minidump_file_writer.cc",
|
||||
"src/client/mac/handler/breakpad_nlist_64.cc",
|
||||
"src/client/mac/handler/dynamic_images.cc",
|
||||
"src/client/mac/handler/minidump_generator.cc",
|
||||
};
|
||||
|
||||
const client_mac: []const []const u8 = &.{
|
||||
"src/client/mac/handler/exception_handler.cc",
|
||||
"src/client/mac/crash_generation/crash_generation_client.cc",
|
||||
};
|
||||
|
||||
const client_ios: []const []const u8 = &.{
|
||||
"src/client/ios/exception_handler_no_mach.cc",
|
||||
"src/client/ios/handler/ios_exception_minidump_generator.mm",
|
||||
"src/client/mac/crash_generation/ConfigFile.mm",
|
||||
"src/client/mac/handler/protected_memory_allocator.cc",
|
||||
};
|
13
pkg/breakpad/build.zig.zon
Normal file
13
pkg/breakpad/build.zig.zon
Normal file
@ -0,0 +1,13 @@
|
||||
.{
|
||||
.name = "breakpad",
|
||||
.version = "0.1.0",
|
||||
.paths = .{""},
|
||||
.dependencies = .{
|
||||
.breakpad = .{
|
||||
.url = "https://github.com/getsentry/breakpad/archive/b99f444ba5f6b98cac261cbb391d8766b34a5918.tar.gz",
|
||||
.hash = "12207fd37bb8251919c112dcdd8f616a491857b34a451f7e4486490077206dc2a1ea",
|
||||
},
|
||||
|
||||
.apple_sdk = .{ .path = "../apple-sdk" },
|
||||
},
|
||||
}
|
@ -161,13 +161,21 @@ pub fn build(b: *std.Build) !void {
|
||||
.flags = flags.items,
|
||||
}),
|
||||
|
||||
.breakpad => lib.addCSourceFiles(.{
|
||||
.root = upstream.path(""),
|
||||
.files = &.{
|
||||
"src/backends/sentry_backend_breakpad.cpp",
|
||||
},
|
||||
.flags = flags.items,
|
||||
}),
|
||||
.breakpad => {
|
||||
lib.addCSourceFiles(.{
|
||||
.root = upstream.path(""),
|
||||
.files = &.{
|
||||
"src/backends/sentry_backend_breakpad.cpp",
|
||||
},
|
||||
.flags = flags.items,
|
||||
});
|
||||
|
||||
const breakpad_dep = b.dependency("breakpad", .{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
lib.linkLibrary(breakpad_dep.artifact("breakpad"));
|
||||
},
|
||||
|
||||
.inproc => lib.addCSourceFiles(.{
|
||||
.root = upstream.path(""),
|
||||
|
@ -9,5 +9,6 @@
|
||||
},
|
||||
|
||||
.apple_sdk = .{ .path = "../apple-sdk" },
|
||||
.breakpad = .{ .path = "../breakpad" },
|
||||
},
|
||||
}
|
||||
|
Reference in New Issue
Block a user