authorgravatar for pfg@pfg.pwpfg <pfg@pfg.pw> 2020-07-03 18:15:01-07:00
committergravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2020-07-04 12:50:37+00:00
log65aac132571a887d181120ba37197e3e4d931c9c
tree69fe60f350ce01415d5e090d2540cf640f087c00
parent70dca0a0c6fd27bc39ac3a37edd2a6908bc0198f

don't try to find config_h if it's not needed


1 files changed, 6 insertions(+), 9 deletions(-)

build.zig+6-9
......@@ -34,15 +34,6 @@ pub fn build(b: *Builder) !void {
3434
3535 const test_step = b.step("test", "Run all the tests");
3636
37 const config_h_text = if (b.option(
38 []const u8,
39 "config_h",
40 "Path to the generated config.h",
41 )) |config_h_path|
42 try std.fs.cwd().readFileAlloc(b.allocator, toNativePathSep(b, config_h_path), max_config_h_bytes)
43 else
44 try findAndReadConfigH(b);
45
4637 var test_stage2 = b.addTest("src-self-hosted/test.zig");
4738 test_stage2.setBuildMode(.Debug); // note this is only the mode of the test harness
4839 test_stage2.addPackagePath("stage2_tests", "test/stage2/test.zig");
......@@ -58,6 +49,7 @@ pub fn build(b: *Builder) !void {
5849
5950 const only_install_lib_files = b.option(bool, "lib-files-only", "Only install library files") orelse false;
6051 const enable_llvm = b.option(bool, "enable-llvm", "Build self-hosted compiler with LLVM backend enabled") orelse false;
52 const config_h_path_option = b.option([]const u8, "config_h", "Path to the generated config.h");
6153
6254 if (!only_install_lib_files) {
6355 var exe = b.addExecutable("zig", "src-self-hosted/main.zig");
......@@ -66,6 +58,11 @@ pub fn build(b: *Builder) !void {
6658 b.default_step.dependOn(&exe.step);
6759
6860 if (enable_llvm) {
61 const config_h_text = if (config_h_path_option) |config_h_path|
62 try std.fs.cwd().readFileAlloc(b.allocator, toNativePathSep(b, config_h_path), max_config_h_bytes)
63 else
64 try findAndReadConfigH(b);
65
6966 var ctx = parseConfigH(b, config_h_text);
7067 ctx.llvm = try findLLVM(b, ctx.llvm_config_exe);
7168