diff options
author | 2023-10-02 18:50:02 -0700 | |
---|---|---|
committer | 2023-10-02 18:50:02 -0700 | |
commit | 5b02425d87d35eb936ba42fb97288ffda5080d55 (patch) | |
tree | 1a4f43bb8b025e970bfad706f61ad75d777a94f7 /packages/bun-release/src/platform.ts | |
parent | b444c0b98db6dee5a10d680f30ba1c0fbff4f285 (diff) | |
download | bun-5b02425d87d35eb936ba42fb97288ffda5080d55.tar.gz bun-5b02425d87d35eb936ba42fb97288ffda5080d55.tar.zst bun-5b02425d87d35eb936ba42fb97288ffda5080d55.zip |
Update build scripts to check for avx instead of avx2jarred/update-install-stuff
Diffstat (limited to 'packages/bun-release/src/platform.ts')
-rw-r--r-- | packages/bun-release/src/platform.ts | 24 |
1 files changed, 12 insertions, 12 deletions
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; } } |