diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2024-04-17 17:57:03 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2024-04-18 03:02:13 -0700 |
| commit | 22a97cd235b5a2ffa9882c267b365c463b38e5ba (patch) | |
| tree | 82f9feca1f1f9b276953d0d0a8a45c3130e475f9 /lib/std/Target/Query.zig | |
| parent | 21a6a1b0f2d7241594a9aa123e48cf2e3ebaccb9 (diff) | |
| download | zig-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 'lib/std/Target/Query.zig')
| -rw-r--r-- | lib/std/Target/Query.zig | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/std/Target/Query.zig b/lib/std/Target/Query.zig index a924c62964..8871e360a5 100644 --- a/lib/std/Target/Query.zig +++ b/lib/std/Target/Query.zig @@ -362,12 +362,16 @@ pub fn isNativeAbi(self: Query) bool { return self.os_tag == null and self.abi == null; } -pub fn isNative(self: Query) bool { +pub fn isNativeTriple(self: Query) bool { return self.isNativeCpu() and self.isNativeOs() and self.isNativeAbi(); } +pub fn isNative(self: Query) bool { + return self.isNativeTriple() and self.ofmt == null; +} + pub fn canDetectLibC(self: Query) bool { - if (self.isNative()) return true; + if (self.isNativeOs()) return true; if (self.os_tag) |os| { if (builtin.os.tag == .macos and os.isDarwin()) return true; if (os == .linux and self.abi == .android) return true; @@ -386,9 +390,8 @@ fn formatVersion(version: SemanticVersion, writer: anytype) !void { } pub fn zigTriple(self: Query, allocator: Allocator) Allocator.Error![]u8 { - if (self.isNative()) { + if (self.isNativeTriple()) return allocator.dupe(u8, "native"); - } const arch_name = if (self.cpu_arch) |arch| @tagName(arch) else "native"; const os_name = if (self.os_tag) |os_tag| @tagName(os_tag) else "native"; |
