feat(target): riscv64gc-unknown-linux-gnu

This commit is contained in:
kxxt 2023-05-25 22:05:50 +08:00
parent 4a0ca22706
commit 72fcd03d98
6 changed files with 23 additions and 6 deletions

View file

@ -85,6 +85,11 @@ function loadNapiModule(binaryName: string, packageName: string) {
case 'arm':
candidates.push('linux-arm-gnueabihf')
break
// type Architecture doesn't contain riscv64 yet
// @ts-expect-error
case 'riscv64':
candidates.push('linux-riscv64-gnu')
break
}
break
}

View file

@ -107,4 +107,11 @@ Generated by [AVA](https://avajs.dev).
platformArchABI: 'darwin-universal',
triple: 'universal-apple-darwin',
},
{
abi: 'gnu',
arch: 'riscv64',
platform: 'linux',
platformArchABI: 'linux-riscv64-gnu',
triple: 'riscv64gc-unknown-linux-gnu',
},
]

View file

@ -15,6 +15,7 @@ export const AVAILABLE_TARGETS = [
'armv7-unknown-linux-gnueabihf',
'armv7-linux-androideabi',
'universal-apple-darwin',
'riscv64gc-unknown-linux-gnu',
] as const
export type TargetTriple = (typeof AVAILABLE_TARGETS)[number]
@ -27,6 +28,7 @@ export const DEFAULT_TARGETS = [
export const TARGET_LINKER: Record<string, string> = {
'aarch64-unknown-linux-musl': 'aarch64-linux-musl-gcc',
'riscv64gc-unknown-linux-gnu': 'riscv64-linux-gnu-gcc',
}
// https://nodejs.org/api/process.html#process_process_arch
@ -38,6 +40,7 @@ type NodeJSArch =
| 'mipsel'
| 'ppc'
| 'ppc64'
| 'riscv64'
| 's390'
| 's390x'
| 'x32'
@ -49,6 +52,7 @@ const CpuToNodeArch: Record<string, NodeJSArch> = {
aarch64: 'arm64',
i686: 'ia32',
armv7: 'arm',
riscv64gc: 'riscv64',
}
export const NodeArchToCpu: Record<string, string> = {
@ -56,6 +60,7 @@ export const NodeArchToCpu: Record<string, string> = {
arm64: 'aarch64',
ia32: 'i686',
arm: 'armv7',
riscv64: 'riscv64gc',
}
const SysToNodePlatform: Record<string, NodeJS.Platform> = {

View file

@ -319,12 +319,12 @@ module.exports.platformArchTriples = {
"abi": "gnu"
}
],
"riscv64gc": [
"riscv64": [
{
"triple": "riscv64gc-unknown-linux-gnu",
"platformArchABI": "linux-riscv64gc-gnu",
"platformArchABI": "linux-riscv64-gnu",
"platform": "linux",
"arch": "riscv64gc",
"arch": "riscv64",
"abi": "gnu"
}
],

View file

@ -319,12 +319,12 @@ export const platformArchTriples = {
"abi": "gnu"
}
],
"riscv64gc": [
"riscv64": [
{
"triple": "riscv64gc-unknown-linux-gnu",
"platformArchABI": "linux-riscv64gc-gnu",
"platformArchABI": "linux-riscv64-gnu",
"platform": "linux",
"arch": "riscv64gc",
"arch": "riscv64",
"abi": "gnu"
}
],