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 {
410410 test_cases_options.addOption(bool, "only_c", only_c);
411411 test_cases_options.addOption(bool, "only_core_functionality", true);
412412 test_cases_options.addOption(bool, "only_reduce", false);
413 test_cases_options.addOption(bool, "enable_qemu", b.graph.enable_qemu);
414 test_cases_options.addOption(bool, "enable_wine", b.graph.enable_wine);
415 test_cases_options.addOption(bool, "enable_wasmtime", b.graph.enable_wasmtime);
416 test_cases_options.addOption(bool, "enable_rosetta", b.graph.enable_rosetta);
417 test_cases_options.addOption(bool, "enable_darling", b.graph.enable_darling);
413 test_cases_options.addOption(bool, "enable_qemu", b.enable_qemu);
414 test_cases_options.addOption(bool, "enable_wine", b.enable_wine);
415 test_cases_options.addOption(bool, "enable_wasmtime", b.enable_wasmtime);
416 test_cases_options.addOption(bool, "enable_rosetta", b.enable_rosetta);
417 test_cases_options.addOption(bool, "enable_darling", b.enable_darling);
418418 test_cases_options.addOption(u32, "mem_leak_frames", mem_leak_frames * 2);
419419 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);
421421 test_cases_options.addOption([:0]const u8, "version", version);
422422 test_cases_options.addOption(std.SemanticVersion, "semver", semver);
423423 test_cases_options.addOption(?[]const u8, "test_filter", test_filter);
lib/build_runner.zig+11-11
......@@ -194,7 +194,7 @@ pub fn main() !void {
194194 } else if (mem.eql(u8, arg, "--debug-compile-errors")) {
195195 builder.debug_compile_errors = true;
196196 } 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);
198198 } else if (mem.eql(u8, arg, "--verbose-link")) {
199199 builder.verbose_link = true;
200200 } else if (mem.eql(u8, arg, "--verbose-air")) {
......@@ -214,25 +214,25 @@ pub fn main() !void {
214214 } else if (mem.eql(u8, arg, "--prominent-compile-errors")) {
215215 prominent_compile_errors = true;
216216 } else if (mem.eql(u8, arg, "-fwine")) {
217 graph.enable_wine = true;
217 builder.enable_wine = true;
218218 } else if (mem.eql(u8, arg, "-fno-wine")) {
219 graph.enable_wine = false;
219 builder.enable_wine = false;
220220 } else if (mem.eql(u8, arg, "-fqemu")) {
221 graph.enable_qemu = true;
221 builder.enable_qemu = true;
222222 } else if (mem.eql(u8, arg, "-fno-qemu")) {
223 graph.enable_qemu = false;
223 builder.enable_qemu = false;
224224 } else if (mem.eql(u8, arg, "-fwasmtime")) {
225 graph.enable_wasmtime = true;
225 builder.enable_wasmtime = true;
226226 } else if (mem.eql(u8, arg, "-fno-wasmtime")) {
227 graph.enable_wasmtime = false;
227 builder.enable_wasmtime = false;
228228 } else if (mem.eql(u8, arg, "-frosetta")) {
229 graph.enable_rosetta = true;
229 builder.enable_rosetta = true;
230230 } else if (mem.eql(u8, arg, "-fno-rosetta")) {
231 graph.enable_rosetta = false;
231 builder.enable_rosetta = false;
232232 } else if (mem.eql(u8, arg, "-fdarling")) {
233 graph.enable_darling = true;
233 builder.enable_darling = true;
234234 } else if (mem.eql(u8, arg, "-fno-darling")) {
235 graph.enable_darling = false;
235 builder.enable_darling = false;
236236 } else if (mem.eql(u8, arg, "-freference-trace")) {
237237 builder.reference_trace = 256;
238238 } else if (mem.startsWith(u8, arg, "-freference-trace=")) {
lib/std/Build.zig+22-16
......@@ -66,6 +66,22 @@ debug_pkg_config: bool = false,
6666/// Set to 0 to disable stack collection.
6767debug_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
6985/// Information about the native target. Computed before build() is invoked.
7086host: ResolvedTarget,
7187
......@@ -91,22 +107,6 @@ pub const Graph = struct {
91107 env_map: EnvMap,
92108 global_cache_root: Cache.Directory,
93109 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,
110110};
111111
112112const AvailableDeps = []const struct { []const u8, []const u8 };
......@@ -374,6 +374,12 @@ fn createChildOnly(
374374 .debug_log_scopes = parent.debug_log_scopes,
375375 .debug_compile_errors = parent.debug_compile_errors,
376376 .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,
377383 .host = parent.host,
378384 .dep_prefix = parent.fmt("{s}{s}.", .{ parent.dep_prefix, dep_name }),
379385 .modules = std.StringArrayHashMap(*Module).init(allocator),
lib/std/Build/Step/Run.zig+6-6
......@@ -747,7 +747,7 @@ fn runCommand(
747747 exe.is_linking_libc;
748748 const other_target = exe.root_module.resolved_target.?.result;
749749 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,
751751 .link_libc = exe.is_linking_libc,
752752 })) {
753753 .native, .rosetta => {
......@@ -755,7 +755,7 @@ fn runCommand(
755755 break :interpret;
756756 },
757757 .wine => |bin_name| {
758 if (b.graph.enable_wine) {
758 if (b.enable_wine) {
759759 try interp_argv.append(bin_name);
760760 try interp_argv.appendSlice(argv);
761761 } else {
......@@ -763,9 +763,9 @@ fn runCommand(
763763 }
764764 },
765765 .qemu => |bin_name| {
766 if (b.graph.enable_qemu) {
766 if (b.enable_qemu) {
767767 const glibc_dir_arg = if (need_cross_glibc)
768 b.graph.glibc_runtimes_dir orelse
768 b.glibc_runtimes_dir orelse
769769 return failForeign(self, "--glibc-runtimes", argv[0], exe)
770770 else
771771 null;
......@@ -798,7 +798,7 @@ fn runCommand(
798798 }
799799 },
800800 .darling => |bin_name| {
801 if (b.graph.enable_darling) {
801 if (b.enable_darling) {
802802 try interp_argv.append(bin_name);
803803 try interp_argv.appendSlice(argv);
804804 } else {
......@@ -806,7 +806,7 @@ fn runCommand(
806806 }
807807 },
808808 .wasmtime => |bin_name| {
809 if (b.graph.enable_wasmtime) {
809 if (b.enable_wasmtime) {
810810 try interp_argv.append(bin_name);
811811 try interp_argv.append("--dir=.");
812812 try interp_argv.append(argv[0]);