commit 55ee88f9c0cf2c03f05cce6cbb887dc60c8b418b (tree)
parent 1b62a22268117340ee7a17f019df01cd39ec1421
Author: Alex Rønne Petersen <alex@alexrp.com>
Date: Wed, 2 Apr 2025 23:36:01 +0200
std.zig.system: Fix wine executable name in getExternalExecutor().
I'm not actually aware of any distro where the name is wine64, so just use wine
in all cases. As part of this, I also fixed the architecture checks to match
reality.
Closes #23411.
Diffstat:
1 file changed, 11 insertions(+), 13 deletions(-)
diff --git a/lib/std/zig/system.zig b/lib/std/zig/system.zig
@@ -128,19 +128,17 @@ pub fn getExternalExecutor(
switch (candidate.os.tag) {
.windows => {
if (options.allow_wine) {
- // x86_64 wine does not support emulating aarch64-windows and
- // vice versa.
- if (candidate.cpu.arch != builtin.cpu.arch and
- !(candidate.cpu.arch == .thumb and builtin.cpu.arch == .aarch64) and
- !(candidate.cpu.arch == .x86 and builtin.cpu.arch == .x86_64))
- {
- return bad_result;
- }
- switch (candidate.ptrBitWidth()) {
- 32 => return Executor{ .wine = "wine" },
- 64 => return Executor{ .wine = "wine64" },
- else => return bad_result,
- }
+ const wine_supported = switch (candidate.cpu.arch) {
+ .thumb => switch (host.cpu.arch) {
+ .arm, .thumb, .aarch64 => true,
+ else => false,
+ },
+ .aarch64 => host.cpu.arch == .aarch64,
+ .x86 => host.cpu.arch.isX86(),
+ .x86_64 => host.cpu.arch == .x86_64,
+ else => false,
+ };
+ return if (wine_supported) Executor{ .wine = "wine" } else bad_result;
}
return bad_result;
},