chore: import upstream snapshot with attribution
Test / build-libghostty-vt (x86_64-windows-gnu) (push) Has been cancelled
Test / build-libghostty-vt-macos (aarch64-ios) (push) Has been cancelled
Test / build-libghostty-vt-macos (aarch64-macos) (push) Has been cancelled
Test / build-libghostty-vt-macos (x86_64-macos) (push) Has been cancelled
Test / build-nix (namespace-profile-ghostty-md-arm64) (push) Has been cancelled
Test / build-dist (push) Has been cancelled
Test / GTK x11=true wayland=true (push) Has been cancelled
Test / Build -Dsimd=false (push) Has been cancelled
Test / Build -Dsimd=true (push) Has been cancelled
Test / Build -Dsentry=false (push) Has been cancelled
Test / Build -Dsentry=true (push) Has been cancelled
Test / zig-fmt (push) Has been cancelled
Test / GitHub Actions Pins (push) Has been cancelled
Test / prettier (push) Has been cancelled
Test / swiftlint (push) Has been cancelled
Test / alejandra (push) Has been cancelled
Test / typos (push) Has been cancelled
Nix / Required Checks: Nix (push) Has been cancelled
Nix / check-zig-cache-hash (push) Has been cancelled
Test / skip (push) Has been cancelled
Test / Required Checks: Test (push) Has been cancelled
Test / build-bench (push) Has been cancelled
Test / list-examples (push) Has been cancelled
Test / Example ${{ matrix.dir }} (Windows) (push) Has been cancelled
Test / build-cmake (push) Has been cancelled
Test / test-lib-vt-pkgconfig (push) Has been cancelled
Test / build-flatpak (push) Has been cancelled
Test / build-snap (push) Has been cancelled
Test / build-libghostty-vt (aarch64-linux) (push) Has been cancelled
Test / build-libghostty-vt (aarch64-macos) (push) Has been cancelled
Test / build-libghostty-vt (wasm32-freestanding) (push) Has been cancelled
Test / build-libghostty-vt (x86_64-linux) (push) Has been cancelled
Test / build-libghostty-vt (x86_64-linux-musl) (push) Has been cancelled
Test / build-libghostty-vt (x86_64-macos) (push) Has been cancelled
Test / build-libghostty-vt-android (aarch64-linux-android) (push) Has been cancelled
Test / build-libghostty-vt-android (arm-linux-androideabi) (push) Has been cancelled
Test / build-libghostty-vt-android (x86_64-linux-android) (push) Has been cancelled
Test / build-libghostty-vt-windows (push) Has been cancelled
Test / build-libghostty-windows-gnu (push) Has been cancelled
Test / build-linux (namespace-profile-ghostty-md) (push) Has been cancelled
Test / build-linux (namespace-profile-ghostty-md-arm64) (push) Has been cancelled
Test / build-linux-libghostty (push) Has been cancelled
Test / build-nix (namespace-profile-ghostty-md) (push) Has been cancelled
Test / build-dist-lib-vt (push) Has been cancelled
Test / trigger-snap (push) Has been cancelled
Test / trigger-flatpak (push) Has been cancelled
Test / build-macos (push) Has been cancelled
Test / build-macos-freetype (push) Has been cancelled
Test / test (push) Has been cancelled
Test / test-lib-vt (push) Has been cancelled
Test / GTK x11=false wayland=false (push) Has been cancelled
Test / GTK x11=true wayland=false (push) Has been cancelled
Test / GTK x11=false wayland=true (push) Has been cancelled
Test / test-macos (push) Has been cancelled
Test / test-windows (push) Has been cancelled
Test / Build -Di18n=false (push) Has been cancelled
Test / Build -Di18n=true (push) Has been cancelled
Test / Build test/fuzz-libghostty (push) Has been cancelled
Test / shellcheck (push) Has been cancelled
Test / translations (push) Has been cancelled
Test / blueprint-compiler (push) Has been cancelled
Test / Test pkg/wuffs (push) Has been cancelled
Test / Test build on Debian 13 (push) Has been cancelled
Test / valgrind (push) Has been cancelled
Test / Example ${{ matrix.dir }} (push) Has been cancelled

This commit is contained in:
wehub-resource-sync
2026-07-13 12:02:48 +08:00
commit bd44b5aa08
5770 changed files with 506778 additions and 0 deletions
+243
View File
@@ -0,0 +1,243 @@
const std = @import("std");
pub fn build(b: *std.Build) !void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const backend = b.option(Backend, "backend", "Backend") orelse .inproc;
const transport = b.option(Transport, "transport", "Transport") orelse .none;
const module = b.addModule("sentry", .{
.root_source_file = b.path("main.zig"),
.target = target,
.optimize = optimize,
});
const lib = b.addLibrary(.{
.name = "sentry",
.root_module = b.createModule(.{
.target = target,
.optimize = optimize,
}),
.linkage = .static,
});
lib.linkLibC();
if (target.result.os.tag.isDarwin()) {
const apple_sdk = @import("apple_sdk");
try apple_sdk.addPaths(b, lib);
}
var flags: std.ArrayList([]const u8) = .empty;
defer flags.deinit(b.allocator);
if (target.result.os.tag == .windows) {
try flags.appendSlice(b.allocator, &.{
"-DSENTRY_WITH_UNWINDER_DBGHELP",
});
} else {
try flags.appendSlice(b.allocator, &.{
"-DSENTRY_WITH_UNWINDER_LIBBACKTRACE",
});
}
switch (backend) {
.crashpad => try flags.append(b.allocator, "-DSENTRY_BACKEND_CRASHPAD"),
.breakpad => try flags.append(b.allocator, "-DSENTRY_BACKEND_BREAKPAD"),
.inproc => try flags.append(b.allocator, "-DSENTRY_BACKEND_INPROC"),
.none => {},
}
if (b.lazyDependency("sentry", .{})) |upstream| {
module.addIncludePath(upstream.path("include"));
lib.addIncludePath(upstream.path("include"));
lib.addIncludePath(upstream.path("src"));
lib.addCSourceFiles(.{
.root = upstream.path(""),
.files = srcs,
.flags = flags.items,
});
// Linux-only
if (target.result.os.tag == .linux) {
lib.addCSourceFiles(.{
.root = upstream.path(""),
.files = &.{
"vendor/stb_sprintf.c",
},
.flags = flags.items,
});
}
// Symbolizer + Unwinder
if (target.result.os.tag == .windows) {
lib.addCSourceFiles(.{
.root = upstream.path(""),
.files = &.{
"src/sentry_windows_dbghelp.c",
"src/path/sentry_path_windows.c",
"src/symbolizer/sentry_symbolizer_windows.c",
"src/unwinder/sentry_unwinder_dbghelp.c",
},
.flags = flags.items,
});
} else {
lib.addCSourceFiles(.{
.root = upstream.path(""),
.files = &.{
"src/sentry_unix_pageallocator.c",
"src/path/sentry_path_unix.c",
"src/symbolizer/sentry_symbolizer_unix.c",
"src/unwinder/sentry_unwinder_libbacktrace.c",
},
.flags = flags.items,
});
}
// Module finder
switch (target.result.os.tag) {
.windows => lib.addCSourceFiles(.{
.root = upstream.path(""),
.files = &.{
"src/modulefinder/sentry_modulefinder_windows.c",
},
.flags = flags.items,
}),
.macos, .ios => lib.addCSourceFiles(.{
.root = upstream.path(""),
.files = &.{
"src/modulefinder/sentry_modulefinder_apple.c",
},
.flags = flags.items,
}),
.linux => lib.addCSourceFiles(.{
.root = upstream.path(""),
.files = &.{
"src/modulefinder/sentry_modulefinder_linux.c",
},
.flags = flags.items,
}),
.freestanding => {},
else => {
std.log.warn("target={} not supported", .{target.result.os.tag});
return error.UnsupportedTarget;
},
}
// Transport
switch (transport) {
.curl => lib.addCSourceFiles(.{
.root = upstream.path(""),
.files = &.{
"src/transports/sentry_transport_curl.c",
},
.flags = flags.items,
}),
.winhttp => lib.addCSourceFiles(.{
.root = upstream.path(""),
.files = &.{
"src/transports/sentry_transport_winhttp.c",
},
.flags = flags.items,
}),
.none => lib.addCSourceFiles(.{
.root = upstream.path(""),
.files = &.{
"src/transports/sentry_transport_none.c",
},
.flags = flags.items,
}),
}
// Backend
switch (backend) {
.crashpad => lib.addCSourceFiles(.{
.root = upstream.path(""),
.files = &.{
"src/backends/sentry_backend_crashpad.cpp",
},
.flags = flags.items,
}),
.breakpad => {
lib.addCSourceFiles(.{
.root = upstream.path(""),
.files = &.{
"src/backends/sentry_backend_breakpad.cpp",
},
.flags = flags.items,
});
if (b.lazyDependency("breakpad", .{
.target = target,
.optimize = optimize,
})) |breakpad_dep| {
lib.linkLibrary(breakpad_dep.artifact("breakpad"));
// We need to add this because Sentry includes some breakpad
// headers that include this vendored file...
lib.addIncludePath(breakpad_dep.path("vendor"));
}
},
.inproc => lib.addCSourceFiles(.{
.root = upstream.path(""),
.files = &.{
"src/backends/sentry_backend_inproc.c",
},
.flags = flags.items,
}),
.none => lib.addCSourceFiles(.{
.root = upstream.path(""),
.files = &.{
"src/backends/sentry_backend_none.c",
},
.flags = flags.items,
}),
}
lib.installHeadersDirectory(
upstream.path("include"),
"",
.{ .include_extensions = &.{".h"} },
);
}
b.installArtifact(lib);
}
const srcs: []const []const u8 = &.{
"src/sentry_alloc.c",
"src/sentry_backend.c",
"src/sentry_core.c",
"src/sentry_database.c",
"src/sentry_envelope.c",
"src/sentry_info.c",
"src/sentry_json.c",
"src/sentry_logger.c",
"src/sentry_options.c",
"src/sentry_os.c",
"src/sentry_random.c",
"src/sentry_ratelimiter.c",
"src/sentry_scope.c",
"src/sentry_session.c",
"src/sentry_slice.c",
"src/sentry_string.c",
"src/sentry_sync.c",
"src/sentry_transport.c",
"src/sentry_utils.c",
"src/sentry_uuid.c",
"src/sentry_value.c",
"src/sentry_tracing.c",
"src/path/sentry_path.c",
"src/transports/sentry_disk_transport.c",
"src/transports/sentry_function_transport.c",
"src/unwinder/sentry_unwinder.c",
"vendor/mpack.c",
};
pub const Backend = enum { crashpad, breakpad, inproc, none };
pub const Transport = enum { curl, winhttp, none };
+17
View File
@@ -0,0 +1,17 @@
.{
.name = .sentry,
.version = "0.7.8",
.fingerprint = 0xd177b4a12f6b3b79,
.paths = .{""},
.dependencies = .{
// getsentry/sentry-native
.sentry = .{
.url = "https://deps.files.ghostty.org/sentry-1220446be831adcca918167647c06c7b825849fa3fba5f22da394667974537a9c77e.tar.gz",
.hash = "N-V-__8AAPlZGwBEa-gxrcypGBZ2R8Bse4JYSfo_ul8i2jlG",
.lazy = true,
},
.apple_sdk = .{ .path = "../apple-sdk" },
.breakpad = .{ .path = "../breakpad", .lazy = true },
},
}
+3
View File
@@ -0,0 +1,3 @@
pub const c = @cImport({
@cInclude("sentry.h");
});
+31
View File
@@ -0,0 +1,31 @@
const std = @import("std");
const assert = std.debug.assert;
const c = @import("c.zig").c;
const Value = @import("value.zig").Value;
/// sentry_envelope_t
pub const Envelope = opaque {
pub fn deinit(self: *Envelope) void {
c.sentry_envelope_free(@ptrCast(self));
}
pub fn writeToFile(self: *Envelope, path: []const u8) !void {
if (c.sentry_envelope_write_to_file_n(
@ptrCast(self),
path.ptr,
path.len,
) != 0) return error.WriteFailed;
}
pub fn serialize(self: *Envelope) []u8 {
var len: usize = 0;
const ptr = c.sentry_envelope_serialize(@ptrCast(self), &len).?;
return ptr[0..len];
}
pub fn event(self: *Envelope) ?Value {
const val: Value = .{ .value = c.sentry_envelope_get_event(@ptrCast(self)) };
if (val.isNull()) return null;
return val;
}
};
+8
View File
@@ -0,0 +1,8 @@
/// sentry_level_t
pub const Level = enum(c_int) {
debug = -1,
info = 0,
warning = 1,
err = 2,
fatal = 3,
};
+35
View File
@@ -0,0 +1,35 @@
pub const c = @import("c.zig").c;
const transport = @import("transport.zig");
pub const Envelope = @import("envelope.zig").Envelope;
pub const Level = @import("level.zig").Level;
pub const Transport = transport.Transport;
pub const Value = @import("value.zig").Value;
pub const UUID = @import("uuid.zig").UUID;
pub fn captureEvent(value: Value) ?UUID {
const uuid: UUID = .{ .value = c.sentry_capture_event(value.value) };
if (uuid.isNil()) return null;
return uuid;
}
pub fn setContext(key: []const u8, value: Value) void {
c.sentry_set_context_n(key.ptr, key.len, value.value);
}
pub fn removeContext(key: []const u8) void {
c.sentry_remove_context_n(key.ptr, key.len);
}
pub fn setTag(key: []const u8, value: []const u8) void {
c.sentry_set_tag_n(key.ptr, key.len, value.ptr, value.len);
}
pub fn free(ptr: *anyopaque) void {
c.sentry_free(ptr);
}
test {
@import("std").testing.refAllDecls(@This());
}
+26
View File
@@ -0,0 +1,26 @@
const std = @import("std");
const assert = std.debug.assert;
const c = @import("c.zig").c;
const Envelope = @import("envelope.zig").Envelope;
/// sentry_transport_t
pub const Transport = opaque {
pub const SendFunc = *const fn (envelope: *Envelope, state: ?*anyopaque) callconv(.c) void;
pub const FreeFunc = *const fn (state: ?*anyopaque) callconv(.c) void;
pub fn init(f: SendFunc) *Transport {
return @ptrCast(c.sentry_transport_new(@ptrCast(f)).?);
}
pub fn deinit(self: *Transport) void {
c.sentry_transport_free(@ptrCast(self));
}
pub fn setState(self: *Transport, state: ?*anyopaque) void {
c.sentry_transport_set_state(@ptrCast(self), state);
}
pub fn setStateFreeFunc(self: *Transport, f: FreeFunc) void {
c.sentry_transport_set_free_func(@ptrCast(self), f);
}
};
+22
View File
@@ -0,0 +1,22 @@
const std = @import("std");
const assert = std.debug.assert;
const c = @import("c.zig").c;
/// sentry_uuid_t
pub const UUID = struct {
value: c.sentry_uuid_t,
pub fn init() UUID {
return .{ .value = c.sentry_uuid_new_v4() };
}
pub fn isNil(self: UUID) bool {
return c.sentry_uuid_is_nil(&self.value) != 0;
}
pub fn string(self: UUID) [36:0]u8 {
var buf: [36:0]u8 = undefined;
c.sentry_uuid_as_string(&self.value, &buf);
return buf;
}
};
+75
View File
@@ -0,0 +1,75 @@
const std = @import("std");
const assert = std.debug.assert;
const c = @import("c.zig").c;
const Level = @import("level.zig").Level;
/// sentry_value_t
pub const Value = struct {
/// The underlying value. This is a union that could be represented with
/// an extern union but I don't want to risk C ABI issues so we wrap it
/// in a struct.
value: c.sentry_value_t,
pub fn initMessageEvent(
level: Level,
logger: ?[]const u8,
message: []const u8,
) Value {
return .{ .value = c.sentry_value_new_message_event_n(
@intFromEnum(level),
if (logger) |v| v.ptr else null,
if (logger) |v| v.len else 0,
message.ptr,
message.len,
) };
}
pub fn initObject() Value {
return .{ .value = c.sentry_value_new_object() };
}
pub fn initString(value: []const u8) Value {
return .{ .value = c.sentry_value_new_string_n(value.ptr, value.len) };
}
pub fn initBool(value: bool) Value {
return .{ .value = c.sentry_value_new_bool(@intFromBool(value)) };
}
pub fn initInt32(value: i32) Value {
return .{ .value = c.sentry_value_new_int32(value) };
}
pub fn decref(self: Value) void {
c.sentry_value_decref(self.value);
}
pub fn incref(self: Value) Value {
c.sentry_value_incref(self.value);
}
pub fn isNull(self: Value) bool {
return c.sentry_value_is_null(self.value) != 0;
}
/// sentry_value_set_by_key_n
pub fn set(self: Value, key: []const u8, value: Value) void {
_ = c.sentry_value_set_by_key_n(
self.value,
key.ptr,
key.len,
value.value,
);
}
/// sentry_value_set_by_key_n
pub fn get(self: Value, key: []const u8) ?Value {
const val: Value = .{ .value = c.sentry_value_get_by_key_n(
self.value,
key.ptr,
key.len,
) };
if (val.isNull()) return null;
return val;
}
};