mirror of
https://github.com/oven-sh/bun
synced 2026-02-02 15:08:46 +00:00
fix(windows): Implement bun.sys.renameat on Windows and fix crash during bun upgrade (#8242)
* fix #7989 * doc * oops
This commit is contained in:
36
build.zig
36
build.zig
@@ -192,16 +192,30 @@ pub fn build_(b: *Build) !void {
|
||||
const bin_label = if (optimize == std.builtin.OptimizeMode.Debug) "packages/debug-bun-" else "packages/bun-";
|
||||
|
||||
var triplet_buf: [64]u8 = undefined;
|
||||
var os_tagname = @tagName(target.getOs().tag);
|
||||
|
||||
const arch: std.Target.Cpu.Arch = target.getCpuArch();
|
||||
|
||||
if (std.mem.eql(u8, os_tagname, "macos")) {
|
||||
os_tagname = "darwin";
|
||||
target.os_version_min = std.zig.CrossTarget.OsVersion{ .semver = .{ .major = 11, .minor = 0, .patch = 0 } };
|
||||
} else if (target.isLinux()) {
|
||||
target.setGnuLibCVersion(2, 27, 0);
|
||||
var os_tagname = @tagName(target.getOs().tag);
|
||||
|
||||
switch (target.getOs().tag) {
|
||||
.macos => {
|
||||
os_tagname = "darwin";
|
||||
target.os_version_min = std.zig.CrossTarget.OsVersion{ .semver = .{ .major = 11, .minor = 0, .patch = 0 } };
|
||||
},
|
||||
.windows => {
|
||||
target.os_version_min = std.zig.CrossTarget.OsVersion{
|
||||
// Windows 1809
|
||||
// Minimum version for a syscall related to bun.sys.renameat
|
||||
// if you update this please update install.ps1
|
||||
.windows = .win10_rs5,
|
||||
};
|
||||
},
|
||||
.linux => {
|
||||
target.setGnuLibCVersion(2, 27, 0);
|
||||
},
|
||||
else => {},
|
||||
}
|
||||
|
||||
@memcpy(triplet_buf[0..].ptr, os_tagname);
|
||||
const osname = triplet_buf[0..os_tagname.len];
|
||||
triplet_buf[osname.len] = '-';
|
||||
@@ -330,10 +344,12 @@ pub fn build_(b: *Build) !void {
|
||||
obj.target.cpu_model = .{ .explicit = &std.Target.x86.cpu.x86_64_v2 };
|
||||
} else if (arch.isX86()) {
|
||||
obj.target.cpu_model = .{ .explicit = &std.Target.x86.cpu.haswell };
|
||||
} else if (arch.isAARCH64() and target.isDarwin()) {
|
||||
obj.target.cpu_model = .{ .explicit = &std.Target.aarch64.cpu.apple_m1 };
|
||||
} else if (arch.isAARCH64() and target.isLinux()) {
|
||||
obj.target.cpu_model = .{ .explicit = &std.Target.aarch64.cpu.generic };
|
||||
} else if (arch.isAARCH64()) {
|
||||
if (target.isDarwin()) {
|
||||
obj.target.cpu_model = .{ .explicit = &std.Target.aarch64.cpu.apple_m1 };
|
||||
} else {
|
||||
obj.target.cpu_model = .{ .explicit = &std.Target.aarch64.cpu.generic };
|
||||
}
|
||||
}
|
||||
|
||||
try default_build_options.updateRuntime();
|
||||
|
||||
Reference in New Issue
Block a user