From 82c18a2c731f0be2ded2e45b51b135cc69e285c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20R=C3=B8nne=20Petersen?= Date: Mon, 10 Mar 2025 15:49:08 +0100 Subject: [PATCH] Update the list of architectures and operating systems for tarball names. --- common.js | 41 +++++++++++++++++++++++++++++++---------- 1 file changed, 31 insertions(+), 10 deletions(-) diff --git a/common.js b/common.js index 43ec2a9..3d43c7c 100644 --- a/common.js +++ b/common.js @@ -67,19 +67,40 @@ async function getVersion() { async function getTarballName() { const version = await getVersion(); - const arch = { - arm: 'armv7a', - arm64: 'aarch64', - ppc64: 'powerpc64', - riscv64: 'riscv64', - x64: 'x86_64', + let arch = { + arm: 'armv7a', + arm64: 'aarch64', + loong64: 'loongarch64', + mips: 'mips', + mipsel: 'mipsel', + mips64: 'mips64', + mips64el: 'mips64el', + ppc64: 'powerpc64', + riscv64: 'riscv64', + s390x: 's390x', + ia32: 'x86', + x64: 'x86_64', }[os.arch()]; - return { - linux: `zig-linux-${arch}-${version}`, - darwin: `zig-macos-${arch}-${version}`, - win32: `zig-windows-${arch}-${version}`, + // For some incomprehensible reason, Node.js's brain-damaged build system explicitly throws away + // the knowledge that it is building for ppc64le, so os.arch() will identify it as ppc64 even on + // little endian. + if (arch === 'powerpc64' && os.endianness() === 'LE') { + arch = 'powerpc64le'; + } + + const platform = { + aix: 'aix', + android: 'android', + freebsd: 'freebsd', + linux: 'linux', + darwin: 'macos', + openbsd: 'openbsd', + sunos: 'solaris', + win32: 'windows', }[os.platform()]; + + return `zig-${platform}-${arch}-${version}`; } async function getTarballExt() {