diff --git a/cli/src/api/templates/js-binding.ts b/cli/src/api/templates/js-binding.ts index fd236c24..efbe5d15 100644 --- a/cli/src/api/templates/js-binding.ts +++ b/cli/src/api/templates/js-binding.ts @@ -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 } diff --git a/cli/src/utils/__tests__/__snapshots__/target.spec.ts.md b/cli/src/utils/__tests__/__snapshots__/target.spec.ts.md index 8cd87f38..89060666 100644 --- a/cli/src/utils/__tests__/__snapshots__/target.spec.ts.md +++ b/cli/src/utils/__tests__/__snapshots__/target.spec.ts.md @@ -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', + }, ] diff --git a/cli/src/utils/__tests__/__snapshots__/target.spec.ts.snap b/cli/src/utils/__tests__/__snapshots__/target.spec.ts.snap index 19ac3f83..51908e44 100644 Binary files a/cli/src/utils/__tests__/__snapshots__/target.spec.ts.snap and b/cli/src/utils/__tests__/__snapshots__/target.spec.ts.snap differ diff --git a/cli/src/utils/target.ts b/cli/src/utils/target.ts index 69c0f32e..341ecf37 100644 --- a/cli/src/utils/target.ts +++ b/cli/src/utils/target.ts @@ -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 = { '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 = { aarch64: 'arm64', i686: 'ia32', armv7: 'arm', + riscv64gc: 'riscv64', } export const NodeArchToCpu: Record = { @@ -56,6 +60,7 @@ export const NodeArchToCpu: Record = { arm64: 'aarch64', ia32: 'i686', arm: 'armv7', + riscv64: 'riscv64gc', } const SysToNodePlatform: Record = { diff --git a/triples/index.cjs b/triples/index.cjs index 4a790689..26414523 100644 --- a/triples/index.cjs +++ b/triples/index.cjs @@ -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" } ], diff --git a/triples/index.js b/triples/index.js index dd8e1733..79c07bd5 100644 --- a/triples/index.js +++ b/triples/index.js @@ -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" } ],