Merge pull request #1217 from widberg/main

Windows Fixes
This commit is contained in:
Mitchell Hashimoto
2024-01-04 19:48:28 -08:00
committed by GitHub
2 changed files with 20 additions and 8 deletions

View File

@ -251,6 +251,10 @@ pub fn build(b: *std.Build) !void {
);
}
// Building with LTO on Windows is broken.
// https://github.com/ziglang/zig/issues/15958
if (target.isWindows()) exe.want_lto = false;
// If we're installing, we get the install step so we can add
// additional dependencies to it.
const install_step = if (app_runtime != .none) step: {

View File

@ -1090,14 +1090,22 @@ const Subprocess = struct {
break :args try args.toOwnedSlice();
}
if (comptime builtin.os.tag == .windows) {
// We run our shell wrapped in `cmd.exe` so that we don't have
// to parse the command line ourselves if it has arguments.
try args.append("C:\\Windows\\System32\\cmd.exe");
try args.append("/C");
} else {
// We run our shell wrapped in `/bin/sh` so that we don't have
// to parse the commadnd line ourselves if it has arguments.
// to parse the command line ourselves if it has arguments.
// Additionally, some environments (NixOS, I found) use /bin/sh
// to setup some environment variables that are important to
// have set.
try args.append("/bin/sh");
if (internal_os.isFlatpak()) try args.append("-l");
try args.append("-c");
}
try args.append(opts.full_config.command orelse default_path);
break :args try args.toOwnedSlice();
};