motiejus/zig

fork of https://codeberg.org/ziglang/zig
git clone https://git.jakstys.lt/motiejus/zig.git
Log | Tree | Refs | README | LICENSE

commit 876ab99f5c462e93296ef0b2f642ac2243acb31c (tree)
parent e0401498e928a539677f0f9eed843a0453bc8c33
Author: Andrew Kelley <andrew@ziglang.org>
Date:   Tue, 10 Jan 2023 11:15:09 -0700

disable package manager code when bootstrapping

This makes building from source go faster and avoids tripping over
unimplemented things in the C backend.

Diffstat:
Mbuild.zig | 1+
Msrc/main.zig | 24+++++++++++++-----------
Mstage1/config.zig.in | 1+
3 files changed, 15 insertions(+), 11 deletions(-)

diff --git 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 @@ -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(); - - try main_pkg.fetchAndAddDependencies( - &thread_pool, - &http_client, - build_directory, - global_cache_directory, - local_cache_directory, - ); + 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, + ); + } const comp = Compilation.create(gpa, .{ .zig_lib_directory = zig_lib_directory, diff --git 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;