From 876ab99f5c462e93296ef0b2f642ac2243acb31c Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Tue, 10 Jan 2023 11:15:09 -0700 Subject: [PATCH] disable package manager code when bootstrapping This makes building from source go faster and avoids tripping over unimplemented things in the C backend. --- build.zig | 1 + src/main.zig | 22 ++++++++++++---------- stage1/config.zig.in | 1 + 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/build.zig b/build.zig index f37b44aa96..71741a0136 100644 --- a/build.zig +++ b/build.zig @@ -185,6 +185,7 @@ pub fn build(b: *Builder) !void { exe_options.addOption(bool, "llvm_has_arc", llvm_has_arc); exe_options.addOption(bool, "force_gpa", force_gpa); exe_options.addOption(bool, "only_c", only_c); + exe_options.addOption(bool, "omit_pkg_fetching_code", false); if (link_libc) { exe.linkLibC(); diff --git a/src/main.zig b/src/main.zig index 8741b4441c..d0052b518b 100644 --- a/src/main.zig +++ b/src/main.zig @@ -4083,17 +4083,19 @@ pub fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !voi try thread_pool.init(gpa); defer thread_pool.deinit(); - var http_client: std.http.Client = .{ .allocator = gpa }; - defer http_client.deinit(); - try http_client.rescanRootCertificates(); + if (!build_options.omit_pkg_fetching_code) { + var http_client: std.http.Client = .{ .allocator = gpa }; + defer http_client.deinit(); + try http_client.rescanRootCertificates(); - try main_pkg.fetchAndAddDependencies( - &thread_pool, - &http_client, - build_directory, - global_cache_directory, - local_cache_directory, - ); + try main_pkg.fetchAndAddDependencies( + &thread_pool, + &http_client, + build_directory, + global_cache_directory, + local_cache_directory, + ); + } const comp = Compilation.create(gpa, .{ .zig_lib_directory = zig_lib_directory, diff --git a/stage1/config.zig.in b/stage1/config.zig.in index 68d09f159b..ab55defd70 100644 --- a/stage1/config.zig.in +++ b/stage1/config.zig.in @@ -12,3 +12,4 @@ pub const have_stage1 = false; pub const skip_non_native = false; pub const only_c = false; pub const force_gpa = false; +pub const omit_pkg_fetching_code = true;