1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
|
const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const t = target.result;
const dep_c = b.dependency("backtrace", .{
.target = target,
.optimize = optimize,
});
const lib = b.addStaticLibrary(.{
.name = "backtrace",
.target = target,
.optimize = optimize,
});
lib.linkLibC();
const config_h = b.addConfigHeader(.{
.style = .{
.autoconf = dep_c.path("config.h.in"),
},
.include_path = "config.h",
}, .{
.BACKTRACE_ELF_SIZE = 64,
.BACKTRACE_XCOFF_SIZE = 64,
.HAVE_ATOMIC_FUNCTIONS = 1,
.HAVE_CLOCK_GETTIME = 1,
.HAVE_DECL_GETPAGESIZE = 1,
.HAVE_DECL_STRNLEN = 1,
.HAVE_DECL__PGMPTR = 0,
.HAVE_DLFCN_H = 1,
.HAVE_DL_ITERATE_PHDR = null,
.HAVE_FCNTL = 1,
.HAVE_GETEXECNAME = null,
.HAVE_GETIPINFO = 1,
.HAVE_INTTYPES_H = 1,
.HAVE_KERN_PROC = null,
.HAVE_KERN_PROC_ARGS = null,
.HAVE_LIBLZMA = 1,
.HAVE_LINK_H = null,
.HAVE_LOADQUERY = null,
.HAVE_LSTAT = 1,
.HAVE_MACH_O_DYLD_H = null,
.HAVE_MEMORY_H = 1,
.HAVE_READLINK = 1,
.HAVE_STDINT_H = 1,
.HAVE_STDLIB_H = 1,
.HAVE_STRINGS_H = 1,
.HAVE_STRING_H = 1,
.HAVE_SYNC_FUNCTIONS = 1,
.HAVE_SYS_LDR_H = null,
.HAVE_SYS_LINK_H = null,
.HAVE_SYS_MMAN_H = 1,
.HAVE_SYS_STAT_H = 1,
.HAVE_SYS_TYPES_H = 1,
.HAVE_TLHELP32_H = null,
.HAVE_UNISTD_H = 1,
.HAVE_WINDOWS_H = null,
.HAVE_ZLIB = 1,
.HAVE_ZSTD = null,
.LT_OBJDIR = "",
.PACKAGE_BUGREPORT = "",
.PACKAGE_NAME = "",
.PACKAGE_STRING = "",
.PACKAGE_TARNAME = "",
.PACKAGE_URL = "",
.PACKAGE_VERSION = "",
.STDC_HEADERS = 1,
._ALL_SOURCE = 1,
._GNU_SOURCE = 1,
._POSIX_PTHREAD_SEMANTICS = 1,
._TANDEM_SOURCE = 1,
.__EXTENSIONS__ = 1,
._FILE_OFFSET_BITS = null,
._LARGE_FILES = null,
._MINIX = null,
._POSIX_1_SOURCE = null,
._POSIX_SOURCE = null,
});
if (t.os.tag.isDarwin()) {
config_h.addValues(.{
.HAVE_MACH_O_DYLD_H = 1,
});
}
const backtrace_supported_h = b.addConfigHeader(.{
.style = .{
.cmake = dep_c.path("backtrace-supported.h.in"),
},
.include_path = "backtrace-supported.h",
}, .{
.BACKTRACE_SUPPORTED = 1,
.BACKTRACE_USES_MALLOC = 0,
.BACKTRACE_SUPPORTS_THREADS = 1,
.BACKTRACE_SUPPORTS_DATA = 1,
});
lib.addConfigHeader(config_h);
lib.addConfigHeader(backtrace_supported_h);
lib.addIncludePath(dep_c.path(""));
lib.addCSourceFiles(.{
.root = dep_c.path(""),
.files = &.{
// libbacktrace_la_SOURCES
"atomic.c",
"dwarf.c",
"fileline.c",
"posix.c",
"print.c",
"sort.c",
"state.c",
// BACKTRACE_FILES
"backtrace.c",
"simple.c",
"nounwind.c",
// FORMAT_FILES
"elf.c",
"macho.c",
"pecoff.c",
"unknown.c",
"xcoff.c",
// VIEW_FILES
"read.c",
"mmapio.c",
// ALLOC_FILES
"alloc.c",
"mmap.c",
},
.flags = &.{
"-fno-sanitize=all",
},
});
lib.installHeader(dep_c.path("backtrace.h"), "backtrace.h");
b.installArtifact(lib);
}
|