Merge pull request #1266 from napi-rs/zig-cross-fix

fix(cli): zig cross to *-apple-darwin target
This commit is contained in:
LongYinan 2022-08-12 17:39:49 +08:00 committed by GitHub
commit 2d2e4425b4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View file

@ -14,7 +14,7 @@ task:
- pkg update
- pkg install -y -f curl node16 libnghttp2
- curl -qL https://www.npmjs.com/install.sh | sh
- npm install -g yarn
- npm install --location=global --ignore-scripts yarn
- curl https://sh.rustup.rs -sSf --output rustup.sh
- sh rustup.sh -y --profile minimal --default-toolchain stable
- |

View file

@ -40,10 +40,13 @@ const ZIG_PLATFORM_TARGET_MAP = {
function processZigLinkerArgs(platform: string, args: string[]) {
if (platform.includes('apple')) {
const newArgs = args.filter(
(arg) =>
(arg, index) =>
!arg.startsWith('-Wl,-exported_symbols_list') &&
arg !== '-Wl,-dylib' &&
arg !== '-liconv',
arg !== '-liconv' &&
arg !== '-Wl,-dead_strip' &&
!(arg === '-framework' && args[index + 1] === 'CoreFoundation') &&
!(arg === 'CoreFoundation' && args[index - 1] === '-framework'),
)
newArgs.push('-Wl,"-undefined=dynamic_lookup"', '-dead_strip')
return newArgs