authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-03-02 23:46:25-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-03-15 10:48:13-07:00
logd6f7766da298accfa84120dbc7f770a6ab5b25e0
tree6701864e29a640f6b6bbeb9b423f196e1785ddbc
parentdcec4d55e36f48e459f4e8f218b8619d9be925db

stage2: avoid networking when generating zig2.c

Avoid dragging networking into zig2.c because it adds dependencies on some linker symbols that are annoying to satisfy while bootstrapping.

1 files changed, 8 insertions(+), 1 deletions(-)

src/main.zig+8-1
......@@ -668,9 +668,13 @@ const ArgMode = union(enum) {
668668 run,
669669};
670670
671/// Avoid dragging networking into zig2.c because it adds dependencies on some
672/// linker symbols that are annoying to satisfy while bootstrapping.
673const Ip4Address = if (build_options.omit_pkg_fetching_code) void else std.net.Ip4Address;
674
671675const Listen = union(enum) {
672676 none,
673 ip4: std.net.Ip4Address,
677 ip4: Ip4Address,
674678 stdio,
675679};
676680
......@@ -1159,6 +1163,7 @@ fn buildOutputType(
11591163 listen = .stdio;
11601164 watch = true;
11611165 } else {
1166 if (build_options.omit_pkg_fetching_code) unreachable;
11621167 // example: --listen 127.0.0.1:9000
11631168 var it = std.mem.split(u8, next_arg, ":");
11641169 const host = it.next().?;
......@@ -3303,6 +3308,8 @@ fn buildOutputType(
33033308 return cleanExit();
33043309 },
33053310 .ip4 => |ip4_addr| {
3311 if (build_options.omit_pkg_fetching_code) unreachable;
3312
33063313 var server = std.net.StreamServer.init(.{
33073314 .reuse_address = true,
33083315 });