authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-02-01 17:40:36-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-02-02 20:43:01-07:00
log370438943e47d9206870e592d4e0fb0f83365b27
tree4fdb231a29e8044a74e1126cd7ead66ccf478459
parent105db13536b4dc2affe130cb8d2eee6c97c89bcd

std.Build: revert moving some fields to Graph

On second thought, let's keep a bunch of these flags how they already were. Partial revert of the previous commit.

4 files changed, 45 insertions(+), 39 deletions(-)

build.zig+6-6
...@@ -410,14 +410,14 @@ pub fn build(b: *std.Build) !void {...@@ -410,14 +410,14 @@ pub fn build(b: *std.Build) !void {
410 test_cases_options.addOption(bool, "only_c", only_c);410 test_cases_options.addOption(bool, "only_c", only_c);
411 test_cases_options.addOption(bool, "only_core_functionality", true);411 test_cases_options.addOption(bool, "only_core_functionality", true);
412 test_cases_options.addOption(bool, "only_reduce", false);412 test_cases_options.addOption(bool, "only_reduce", false);
413 test_cases_options.addOption(bool, "enable_qemu", b.graph.enable_qemu);413 test_cases_options.addOption(bool, "enable_qemu", b.enable_qemu);
414 test_cases_options.addOption(bool, "enable_wine", b.graph.enable_wine);414 test_cases_options.addOption(bool, "enable_wine", b.enable_wine);
415 test_cases_options.addOption(bool, "enable_wasmtime", b.graph.enable_wasmtime);415 test_cases_options.addOption(bool, "enable_wasmtime", b.enable_wasmtime);
416 test_cases_options.addOption(bool, "enable_rosetta", b.graph.enable_rosetta);416 test_cases_options.addOption(bool, "enable_rosetta", b.enable_rosetta);
417 test_cases_options.addOption(bool, "enable_darling", b.graph.enable_darling);417 test_cases_options.addOption(bool, "enable_darling", b.enable_darling);
418 test_cases_options.addOption(u32, "mem_leak_frames", mem_leak_frames * 2);418 test_cases_options.addOption(u32, "mem_leak_frames", mem_leak_frames * 2);
419 test_cases_options.addOption(bool, "value_tracing", value_tracing);419 test_cases_options.addOption(bool, "value_tracing", value_tracing);
420 test_cases_options.addOption(?[]const u8, "glibc_runtimes_dir", b.graph.glibc_runtimes_dir);420 test_cases_options.addOption(?[]const u8, "glibc_runtimes_dir", b.glibc_runtimes_dir);
421 test_cases_options.addOption([:0]const u8, "version", version);421 test_cases_options.addOption([:0]const u8, "version", version);
422 test_cases_options.addOption(std.SemanticVersion, "semver", semver);422 test_cases_options.addOption(std.SemanticVersion, "semver", semver);
423 test_cases_options.addOption(?[]const u8, "test_filter", test_filter);423 test_cases_options.addOption(?[]const u8, "test_filter", test_filter);
lib/build_runner.zig+11-11
...@@ -194,7 +194,7 @@ pub fn main() !void {...@@ -194,7 +194,7 @@ pub fn main() !void {
194 } else if (mem.eql(u8, arg, "--debug-compile-errors")) {194 } else if (mem.eql(u8, arg, "--debug-compile-errors")) {
195 builder.debug_compile_errors = true;195 builder.debug_compile_errors = true;
196 } else if (mem.eql(u8, arg, "--glibc-runtimes")) {196 } else if (mem.eql(u8, arg, "--glibc-runtimes")) {
197 graph.glibc_runtimes_dir = nextArgOrFatal(args, &arg_idx);197 builder.glibc_runtimes_dir = nextArgOrFatal(args, &arg_idx);
198 } else if (mem.eql(u8, arg, "--verbose-link")) {198 } else if (mem.eql(u8, arg, "--verbose-link")) {
199 builder.verbose_link = true;199 builder.verbose_link = true;
200 } else if (mem.eql(u8, arg, "--verbose-air")) {200 } else if (mem.eql(u8, arg, "--verbose-air")) {
...@@ -214,25 +214,25 @@ pub fn main() !void {...@@ -214,25 +214,25 @@ pub fn main() !void {
214 } else if (mem.eql(u8, arg, "--prominent-compile-errors")) {214 } else if (mem.eql(u8, arg, "--prominent-compile-errors")) {
215 prominent_compile_errors = true;215 prominent_compile_errors = true;
216 } else if (mem.eql(u8, arg, "-fwine")) {216 } else if (mem.eql(u8, arg, "-fwine")) {
217 graph.enable_wine = true;217 builder.enable_wine = true;
218 } else if (mem.eql(u8, arg, "-fno-wine")) {218 } else if (mem.eql(u8, arg, "-fno-wine")) {
219 graph.enable_wine = false;219 builder.enable_wine = false;
220 } else if (mem.eql(u8, arg, "-fqemu")) {220 } else if (mem.eql(u8, arg, "-fqemu")) {
221 graph.enable_qemu = true;221 builder.enable_qemu = true;
222 } else if (mem.eql(u8, arg, "-fno-qemu")) {222 } else if (mem.eql(u8, arg, "-fno-qemu")) {
223 graph.enable_qemu = false;223 builder.enable_qemu = false;
224 } else if (mem.eql(u8, arg, "-fwasmtime")) {224 } else if (mem.eql(u8, arg, "-fwasmtime")) {
225 graph.enable_wasmtime = true;225 builder.enable_wasmtime = true;
226 } else if (mem.eql(u8, arg, "-fno-wasmtime")) {226 } else if (mem.eql(u8, arg, "-fno-wasmtime")) {
227 graph.enable_wasmtime = false;227 builder.enable_wasmtime = false;
228 } else if (mem.eql(u8, arg, "-frosetta")) {228 } else if (mem.eql(u8, arg, "-frosetta")) {
229 graph.enable_rosetta = true;229 builder.enable_rosetta = true;
230 } else if (mem.eql(u8, arg, "-fno-rosetta")) {230 } else if (mem.eql(u8, arg, "-fno-rosetta")) {
231 graph.enable_rosetta = false;231 builder.enable_rosetta = false;
232 } else if (mem.eql(u8, arg, "-fdarling")) {232 } else if (mem.eql(u8, arg, "-fdarling")) {
233 graph.enable_darling = true;233 builder.enable_darling = true;
234 } else if (mem.eql(u8, arg, "-fno-darling")) {234 } else if (mem.eql(u8, arg, "-fno-darling")) {
235 graph.enable_darling = false;235 builder.enable_darling = false;
236 } else if (mem.eql(u8, arg, "-freference-trace")) {236 } else if (mem.eql(u8, arg, "-freference-trace")) {
237 builder.reference_trace = 256;237 builder.reference_trace = 256;
238 } else if (mem.startsWith(u8, arg, "-freference-trace=")) {238 } else if (mem.startsWith(u8, arg, "-freference-trace=")) {
lib/std/Build.zig+22-16
...@@ -66,6 +66,22 @@ debug_pkg_config: bool = false,...@@ -66,6 +66,22 @@ debug_pkg_config: bool = false,
66/// Set to 0 to disable stack collection.66/// Set to 0 to disable stack collection.
67debug_stack_frames_count: u8 = 8,67debug_stack_frames_count: u8 = 8,
6868
69/// Experimental. Use system Darling installation to run cross compiled macOS build artifacts.
70enable_darling: bool = false,
71/// Use system QEMU installation to run cross compiled foreign architecture build artifacts.
72enable_qemu: bool = false,
73/// Darwin. Use Rosetta to run x86_64 macOS build artifacts on arm64 macOS.
74enable_rosetta: bool = false,
75/// Use system Wasmtime installation to run cross compiled wasm/wasi build artifacts.
76enable_wasmtime: bool = false,
77/// Use system Wine installation to run cross compiled Windows build artifacts.
78enable_wine: bool = false,
79/// After following the steps in https://github.com/ziglang/zig/wiki/Updating-libc#glibc,
80/// this will be the directory $glibc-build-dir/install/glibcs
81/// Given the example of the aarch64 target, this is the directory
82/// that contains the path `aarch64-linux-gnu/lib/ld-linux-aarch64.so.1`.
83glibc_runtimes_dir: ?[]const u8 = null,
84
69/// Information about the native target. Computed before build() is invoked.85/// Information about the native target. Computed before build() is invoked.
70host: ResolvedTarget,86host: ResolvedTarget,
7187
...@@ -91,22 +107,6 @@ pub const Graph = struct {...@@ -91,22 +107,6 @@ pub const Graph = struct {
91 env_map: EnvMap,107 env_map: EnvMap,
92 global_cache_root: Cache.Directory,108 global_cache_root: Cache.Directory,
93 host_query_options: std.Target.Query.ParseOptions = .{},109 host_query_options: std.Target.Query.ParseOptions = .{},
94
95 /// Experimental. Use system Darling installation to run cross compiled macOS build artifacts.
96 enable_darling: bool = false,
97 /// Use system QEMU installation to run cross compiled foreign architecture build artifacts.
98 enable_qemu: bool = false,
99 /// Darwin. Use Rosetta to run x86_64 macOS build artifacts on arm64 macOS.
100 enable_rosetta: bool = false,
101 /// Use system Wasmtime installation to run cross compiled wasm/wasi build artifacts.
102 enable_wasmtime: bool = false,
103 /// Use system Wine installation to run cross compiled Windows build artifacts.
104 enable_wine: bool = false,
105 /// After following the steps in https://github.com/ziglang/zig/wiki/Updating-libc#glibc,
106 /// this will be the directory $glibc-build-dir/install/glibcs
107 /// Given the example of the aarch64 target, this is the directory
108 /// that contains the path `aarch64-linux-gnu/lib/ld-linux-aarch64.so.1`.
109 glibc_runtimes_dir: ?[]const u8 = null,
110};110};
111111
112const AvailableDeps = []const struct { []const u8, []const u8 };112const AvailableDeps = []const struct { []const u8, []const u8 };
...@@ -374,6 +374,12 @@ fn createChildOnly(...@@ -374,6 +374,12 @@ fn createChildOnly(
374 .debug_log_scopes = parent.debug_log_scopes,374 .debug_log_scopes = parent.debug_log_scopes,
375 .debug_compile_errors = parent.debug_compile_errors,375 .debug_compile_errors = parent.debug_compile_errors,
376 .debug_pkg_config = parent.debug_pkg_config,376 .debug_pkg_config = parent.debug_pkg_config,
377 .enable_darling = parent.enable_darling,
378 .enable_qemu = parent.enable_qemu,
379 .enable_rosetta = parent.enable_rosetta,
380 .enable_wasmtime = parent.enable_wasmtime,
381 .enable_wine = parent.enable_wine,
382 .glibc_runtimes_dir = parent.glibc_runtimes_dir,
377 .host = parent.host,383 .host = parent.host,
378 .dep_prefix = parent.fmt("{s}{s}.", .{ parent.dep_prefix, dep_name }),384 .dep_prefix = parent.fmt("{s}{s}.", .{ parent.dep_prefix, dep_name }),
379 .modules = std.StringArrayHashMap(*Module).init(allocator),385 .modules = std.StringArrayHashMap(*Module).init(allocator),
lib/std/Build/Step/Run.zig+6-6
...@@ -747,7 +747,7 @@ fn runCommand(...@@ -747,7 +747,7 @@ fn runCommand(
747 exe.is_linking_libc;747 exe.is_linking_libc;
748 const other_target = exe.root_module.resolved_target.?.result;748 const other_target = exe.root_module.resolved_target.?.result;
749 switch (std.zig.system.getExternalExecutor(b.host.result, &other_target, .{749 switch (std.zig.system.getExternalExecutor(b.host.result, &other_target, .{
750 .qemu_fixes_dl = need_cross_glibc and b.graph.glibc_runtimes_dir != null,750 .qemu_fixes_dl = need_cross_glibc and b.glibc_runtimes_dir != null,
751 .link_libc = exe.is_linking_libc,751 .link_libc = exe.is_linking_libc,
752 })) {752 })) {
753 .native, .rosetta => {753 .native, .rosetta => {
...@@ -755,7 +755,7 @@ fn runCommand(...@@ -755,7 +755,7 @@ fn runCommand(
755 break :interpret;755 break :interpret;
756 },756 },
757 .wine => |bin_name| {757 .wine => |bin_name| {
758 if (b.graph.enable_wine) {758 if (b.enable_wine) {
759 try interp_argv.append(bin_name);759 try interp_argv.append(bin_name);
760 try interp_argv.appendSlice(argv);760 try interp_argv.appendSlice(argv);
761 } else {761 } else {
...@@ -763,9 +763,9 @@ fn runCommand(...@@ -763,9 +763,9 @@ fn runCommand(
763 }763 }
764 },764 },
765 .qemu => |bin_name| {765 .qemu => |bin_name| {
766 if (b.graph.enable_qemu) {766 if (b.enable_qemu) {
767 const glibc_dir_arg = if (need_cross_glibc)767 const glibc_dir_arg = if (need_cross_glibc)
768 b.graph.glibc_runtimes_dir orelse768 b.glibc_runtimes_dir orelse
769 return failForeign(self, "--glibc-runtimes", argv[0], exe)769 return failForeign(self, "--glibc-runtimes", argv[0], exe)
770 else770 else
771 null;771 null;
...@@ -798,7 +798,7 @@ fn runCommand(...@@ -798,7 +798,7 @@ fn runCommand(
798 }798 }
799 },799 },
800 .darling => |bin_name| {800 .darling => |bin_name| {
801 if (b.graph.enable_darling) {801 if (b.enable_darling) {
802 try interp_argv.append(bin_name);802 try interp_argv.append(bin_name);
803 try interp_argv.appendSlice(argv);803 try interp_argv.appendSlice(argv);
804 } else {804 } else {
...@@ -806,7 +806,7 @@ fn runCommand(...@@ -806,7 +806,7 @@ fn runCommand(
806 }806 }
807 },807 },
808 .wasmtime => |bin_name| {808 .wasmtime => |bin_name| {
809 if (b.graph.enable_wasmtime) {809 if (b.enable_wasmtime) {
810 try interp_argv.append(bin_name);810 try interp_argv.append(bin_name);
811 try interp_argv.append("--dir=.");811 try interp_argv.append("--dir=.");
812 try interp_argv.append(argv[0]);812 try interp_argv.append(argv[0]);