| ... | ... | @@ -86,6 +86,12 @@ pub fn build(b: *Builder) !void { |
| 86 | 86 | const link_libc = b.option(bool, "force-link-libc", "Force self-hosted compiler to link libc") orelse enable_llvm; |
| 87 | 87 | const strip = b.option(bool, "strip", "Omit debug information") orelse false; |
| 88 | 88 | |
| 89 | const mem_leak_frames: u32 = b.option(u32, "mem-leak-frames", "How many stack frames to print when a memory leak occurs. Tests get 2x this amount.") orelse blk: { |
| 90 | if (strip) break :blk @as(u32, 0); |
| 91 | if (mode != .Debug) break :blk 0; |
| 92 | break :blk 4; |
| 93 | }; |
| 94 | |
| 89 | 95 | const main_file = if (is_stage1) "src/stage1.zig" else "src/main.zig"; |
| 90 | 96 | |
| 91 | 97 | var exe = b.addExecutable("zig", main_file); |
| ... | ... | @@ -96,6 +102,7 @@ pub fn build(b: *Builder) !void { |
| 96 | 102 | test_step.dependOn(&exe.step); |
| 97 | 103 | b.default_step.dependOn(&exe.step); |
| 98 | 104 | |
| 105 | exe.addBuildOption(u32, "mem_leak_frames", mem_leak_frames); |
| 99 | 106 | exe.addBuildOption(bool, "skip_non_native", skip_non_native); |
| 100 | 107 | exe.addBuildOption(bool, "have_llvm", enable_llvm); |
| 101 | 108 | if (enable_llvm) { |
| ... | ... | @@ -230,6 +237,7 @@ pub fn build(b: *Builder) !void { |
| 230 | 237 | test_stage2.addBuildOption(bool, "enable_qemu", is_qemu_enabled); |
| 231 | 238 | test_stage2.addBuildOption(bool, "enable_wine", is_wine_enabled); |
| 232 | 239 | test_stage2.addBuildOption(bool, "enable_wasmtime", is_wasmtime_enabled); |
| 240 | test_stage2.addBuildOption(u32, "mem_leak_frames", mem_leak_frames * 2); |
| 233 | 241 | test_stage2.addBuildOption(?[]const u8, "glibc_multi_install_dir", glibc_multi_dir); |
| 234 | 242 | test_stage2.addBuildOption([]const u8, "version", version); |
| 235 | 243 | |