aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2024-04-17 17:57:03 -0700
committerAndrew Kelley <andrew@ziglang.org>2024-04-18 03:02:13 -0700
commit22a97cd235b5a2ffa9882c267b365c463b38e5ba (patch)
tree82f9feca1f1f9b276953d0d0a8a45c3130e475f9 /src
parent21a6a1b0f2d7241594a9aa123e48cf2e3ebaccb9 (diff)
downloadzig-22a97cd235b5a2ffa9882c267b365c463b38e5ba.tar.gz
zig-22a97cd235b5a2ffa9882c267b365c463b38e5ba.zip
std.Build: revert --host-target, --host-cpu, --host-dynamic-linker
This is a partial revert of 105db13536b4dc2affe130cb8d2eee6c97c89bcd. As we learned from Void Linux packaging, these options are not actually helpful since the distribution package manager may very well want to cross-compile the packages that it is building. So, let's not overcomplicate things. There are already the standard options: -Dtarget, -Dcpu, and -Ddynamic-linker. These options are generally provided when the project generates machine code artifacts, however, there may be a project that does no such thing, in which case it makes sense for these options to be missing. The Zig Build System is a general-purpose build system, after all.
Diffstat (limited to 'src')
-rw-r--r--src/main.zig22
1 files changed, 1 insertions, 21 deletions
diff --git a/src/main.zig b/src/main.zig
index 72b2558358..5b0e211647 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -985,9 +985,6 @@ fn buildOutputType(
.libc_paths_file = try EnvVar.ZIG_LIBC.get(arena),
.link_objects = .{},
.native_system_include_paths = &.{},
- .host_triple = null,
- .host_cpu = null,
- .host_dynamic_linker = null,
};
// before arg parsing, check for the NO_COLOR environment variable
@@ -1285,12 +1282,6 @@ fn buildOutputType(
mod_opts.optimize_mode = parseOptimizeMode(arg["-O".len..]);
} else if (mem.eql(u8, arg, "--dynamic-linker")) {
create_module.dynamic_linker = args_iter.nextOrFatal();
- } else if (mem.eql(u8, arg, "--host-target")) {
- create_module.host_triple = args_iter.nextOrFatal();
- } else if (mem.eql(u8, arg, "--host-cpu")) {
- create_module.host_cpu = args_iter.nextOrFatal();
- } else if (mem.eql(u8, arg, "--host-dynamic-linker")) {
- create_module.host_dynamic_linker = args_iter.nextOrFatal();
} else if (mem.eql(u8, arg, "--sysroot")) {
const next_arg = args_iter.nextOrFatal();
create_module.sysroot = next_arg;
@@ -3521,9 +3512,6 @@ const CreateModule = struct {
each_lib_rpath: ?bool,
libc_paths_file: ?[]const u8,
link_objects: std.ArrayListUnmanaged(Compilation.LinkObject),
- host_triple: ?[]const u8,
- host_cpu: ?[]const u8,
- host_dynamic_linker: ?[]const u8,
};
fn createModule(
@@ -3605,15 +3593,7 @@ fn createModule(
}
const target_query = std.zig.parseTargetQueryOrReportFatalError(arena, target_parse_options);
- const adjusted_target_query = a: {
- if (!target_query.isNative()) break :a target_query;
- if (create_module.host_triple) |triple| target_parse_options.arch_os_abi = triple;
- if (create_module.host_cpu) |cpu| target_parse_options.cpu_features = cpu;
- if (create_module.host_dynamic_linker) |dl| target_parse_options.dynamic_linker = dl;
- break :a std.zig.parseTargetQueryOrReportFatalError(arena, target_parse_options);
- };
-
- const target = std.zig.resolveTargetQueryOrFatal(adjusted_target_query);
+ const target = std.zig.resolveTargetQueryOrFatal(target_query);
break :t .{
.result = target,
.is_native_os = target_query.isNativeOs(),