From e3902e001fea095045a04d472f3cba029c1e746e Mon Sep 17 00:00:00 2001 From: Levi Zim Date: Wed, 13 Dec 2023 11:06:04 +0800 Subject: [PATCH] fix(binding): add riscv64 binding (#1851) --- cli/src/api/templates/js-binding.ts | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/cli/src/api/templates/js-binding.ts b/cli/src/api/templates/js-binding.ts index 652702ee..48555172 100644 --- a/cli/src/api/templates/js-binding.ts +++ b/cli/src/api/templates/js-binding.ts @@ -274,6 +274,35 @@ switch (platform) { loadError = e } break + case 'riscv64': + if (isMusl()) { + localFileExisted = existsSync( + join(__dirname, '${localName}.linux-riscv64-musl.node') + ) + try { + if (localFileExisted) { + nativeBinding = require('./${localName}.linux-riscv64-musl.node') + } else { + nativeBinding = require('${pkgName}-linux-riscv64-musl') + } + } catch (e) { + loadError = e + } + } else { + localFileExisted = existsSync( + join(__dirname, '${localName}.linux-riscv64-gnu.node') + ) + try { + if (localFileExisted) { + nativeBinding = require('./${localName}.linux-riscv64-gnu.node') + } else { + nativeBinding = require('${pkgName}-linux-riscv64-gnu') + } + } catch (e) { + loadError = e + } + } + break default: throw new Error(\`Unsupported architecture on Linux: \${arch}\`) }