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 {...@@ -34,15 +34,6 @@ pub fn build(b: *Builder) !void {
3434
35 const test_step = b.step("test", "Run all the tests");35 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
46 var test_stage2 = b.addTest("src-self-hosted/test.zig");37 var test_stage2 = b.addTest("src-self-hosted/test.zig");
47 test_stage2.setBuildMode(.Debug); // note this is only the mode of the test harness38 test_stage2.setBuildMode(.Debug); // note this is only the mode of the test harness
48 test_stage2.addPackagePath("stage2_tests", "test/stage2/test.zig");39 test_stage2.addPackagePath("stage2_tests", "test/stage2/test.zig");
...@@ -58,6 +49,7 @@ pub fn build(b: *Builder) !void {...@@ -58,6 +49,7 @@ pub fn build(b: *Builder) !void {
5849
59 const only_install_lib_files = b.option(bool, "lib-files-only", "Only install library files") orelse false;50 const only_install_lib_files = b.option(bool, "lib-files-only", "Only install library files") orelse false;
60 const enable_llvm = b.option(bool, "enable-llvm", "Build self-hosted compiler with LLVM backend enabled") orelse false;51 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
62 if (!only_install_lib_files) {54 if (!only_install_lib_files) {
63 var exe = b.addExecutable("zig", "src-self-hosted/main.zig");55 var exe = b.addExecutable("zig", "src-self-hosted/main.zig");
...@@ -66,6 +58,11 @@ pub fn build(b: *Builder) !void {...@@ -66,6 +58,11 @@ pub fn build(b: *Builder) !void {
66 b.default_step.dependOn(&exe.step);58 b.default_step.dependOn(&exe.step);
6759
68 if (enable_llvm) {60 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
69 var ctx = parseConfigH(b, config_h_text);66 var ctx = parseConfigH(b, config_h_text);
70 ctx.llvm = try findLLVM(b, ctx.llvm_config_exe);67 ctx.llvm = try findLLVM(b, ctx.llvm_config_exe);
7168