From 472ac10c67b7b239bb9bfcc3a1e897508cfc3314 Mon Sep 17 00:00:00 2001 From: LongYinan Date: Thu, 13 Jan 2022 14:26:29 +0800 Subject: [PATCH] fix(cli): missing zig-abi-suffix support --- cli/src/build.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/cli/src/build.ts b/cli/src/build.ts index fc3e52c6..96d889bb 100644 --- a/cli/src/build.ts +++ b/cli/src/build.ts @@ -154,6 +154,14 @@ export class BuildCommand extends Command { )}`, }) + zigABIVersion = Option.String(`--zig-abi-suffix`, { + description: `The suffix of the ${chalk.green( + 'zig --target', + )} ABI version. Eg. ${chalk.cyan( + '--target x86_64-unknown-linux-gnu', + )} ${chalk.green('--zig-abi-suffix=2.17')}`, + }) + async execute() { const cwd = this.cargoCwd ? join(process.cwd(), this.cargoCwd) @@ -208,7 +216,9 @@ export class BuildCommand extends Command { } if (this.useZig) { - const zigTarget = ZIG_PLATFORM_TARGET_MAP[triple.raw] + const zigTarget = `${ZIG_PLATFORM_TARGET_MAP[triple.raw]}${ + this.zigABIVersion ? `.${this.zigABIVersion}` : '' + }` if (!zigTarget) { throw new Error(`${triple.raw} can not be cross compiled by zig`) }