diff options
author | 2023-10-02 18:50:02 -0700 | |
---|---|---|
committer | 2023-10-02 18:50:02 -0700 | |
commit | 5b02425d87d35eb936ba42fb97288ffda5080d55 (patch) | |
tree | 1a4f43bb8b025e970bfad706f61ad75d777a94f7 | |
parent | b444c0b98db6dee5a10d680f30ba1c0fbff4f285 (diff) | |
download | bun-jarred/update-install-stuff.tar.gz bun-jarred/update-install-stuff.tar.zst bun-jarred/update-install-stuff.zip |
Update build scripts to check for avx instead of avx2jarred/update-install-stuff
-rw-r--r-- | build.zig | 2 | ||||
-rw-r--r-- | packages/bun-release/src/platform.ts | 24 | ||||
-rw-r--r-- | src/cli/install.sh | 8 |
3 files changed, 17 insertions, 17 deletions
@@ -224,7 +224,7 @@ pub fn build_(b: *Build) !void { var default_build_options: BunBuildOptions = brk: { const is_baseline = arch.isX86() and (target.cpu_model == .baseline or - !std.Target.x86.featureSetHas(target.getCpuFeatures(), .avx2)); + !std.Target.x86.featureSetHas(target.getCpuFeatures(), .avx)); var git_sha: [:0]const u8 = ""; if (b.env_map.get("GITHUB_SHA") orelse b.env_map.get("GIT_SHA")) |sha| { diff --git a/packages/bun-release/src/platform.ts b/packages/bun-release/src/platform.ts index 98fd6fe36..460f533e0 100644 --- a/packages/bun-release/src/platform.ts +++ b/packages/bun-release/src/platform.ts @@ -6,12 +6,12 @@ export const os = process.platform; export const arch = os === "darwin" && process.arch === "x64" && isRosetta2() ? "arm64" : process.arch; -export const avx2 = (arch === "x64" && os === "linux" && isLinuxAVX2()) || (os === "darwin" && isDarwinAVX2()); +export const avx = arch === "x64" && ((os === "linux" && isLinuxAVX()) || (os === "darwin" && isDarwinAVX())); export type Platform = { os: string; arch: string; - avx2?: boolean; + avx?: boolean; bin: string; exe: string; }; @@ -26,7 +26,7 @@ export const platforms: Platform[] = [ { os: "darwin", arch: "x64", - avx2: true, + avx: true, bin: "bun-darwin-x64", exe: "bin/bun", }, @@ -45,7 +45,7 @@ export const platforms: Platform[] = [ { os: "linux", arch: "x64", - avx2: true, + avx: true, bin: "bun-linux-x64", exe: "bin/bun", }, @@ -58,24 +58,24 @@ export const platforms: Platform[] = [ ]; export const supportedPlatforms: Platform[] = platforms - .filter(platform => platform.os === os && platform.arch === arch && (!platform.avx2 || avx2)) - .sort((a, b) => (a.avx2 === b.avx2 ? 0 : a.avx2 ? -1 : 1)); + .filter(platform => platform.os === os && platform.arch === arch && (!platform.avx || avx)) + .sort((a, b) => (a.avx === b.avx ? 0 : a.avx ? -1 : 1)); -function isLinuxAVX2(): boolean { +function isLinuxAVX(): boolean { try { - return read("/proc/cpuinfo").includes("avx2"); + return read("/proc/cpuinfo").includes("avx"); } catch (error) { - debug("isLinuxAVX2 failed", error); + debug("isLinuxAVX failed", error); return false; } } -function isDarwinAVX2(): boolean { +function isDarwinAVX(): boolean { try { const { exitCode, stdout } = spawn("sysctl", ["-n", "machdep.cpu"]); - return exitCode === 0 && stdout.includes("AVX2"); + return exitCode === 0 && stdout.includes("AVX"); } catch (error) { - debug("isDarwinAVX2 failed", error); + debug("isDarwinAVX failed", error); return false; } } diff --git a/src/cli/install.sh b/src/cli/install.sh index 4afd50aef..0eaaae961 100644 --- a/src/cli/install.sh +++ b/src/cli/install.sh @@ -85,15 +85,15 @@ GITHUB=${GITHUB-"https://github.com"} github_repo="$GITHUB/oven-sh/bun" if [[ $target = darwin-x64 ]]; then - # If AVX2 isn't supported, use the -baseline build - if [[ $(sysctl -a | grep machdep.cpu | grep AVX2) == '' ]]; then + # If AVX isn't supported, use the -baseline build + if [[ $(sysctl -a | grep machdep.cpu | grep AVX) == '' ]]; then target=darwin-x64-baseline fi fi if [[ $target = linux-x64 ]]; then - # If AVX2 isn't supported, use the -baseline build - if [[ $(cat /proc/cpuinfo | grep avx2) = '' ]]; then + # If AVX isn't supported, use the -baseline build + if [[ $(cat /proc/cpuinfo | grep avx) = '' ]]; then target=linux-x64-baseline fi fi |