fix(binding): add riscv64 binding (#1851)

This commit is contained in:
Levi Zim 2023-12-13 11:06:04 +08:00 committed by GitHub
parent a697cf1cf5
commit e3902e001f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -274,6 +274,35 @@ switch (platform) {
loadError = e loadError = e
} }
break 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: default:
throw new Error(\`Unsupported architecture on Linux: \${arch}\`) throw new Error(\`Unsupported architecture on Linux: \${arch}\`)
} }