fix(napi): build error with zig@0.10.1

This commit is contained in:
LongYinan 2023-01-20 21:31:16 +08:00
parent c51d657224
commit 2f527938b2
No known key found for this signature in database
GPG key ID: C3666B7FC82ADAD7
2 changed files with 12 additions and 8 deletions

View file

@ -52,7 +52,7 @@ jobs:
- name: Install ziglang - name: Install ziglang
uses: goto-bus-stop/setup-zig@v2 uses: goto-bus-stop/setup-zig@v2
with: with:
version: 0.10.0 version: 0.10.1
- name: Install dependencies - name: Install dependencies
run: yarn install --immutable --mode=skip-build run: yarn install --immutable --mode=skip-build
- name: 'Build TypeScript' - name: 'Build TypeScript'

View file

@ -844,14 +844,18 @@ async function patchArmFeaturesHForArmTargets() {
const p = zigLibDir const p = zigLibDir
? join(zigLibDir, 'libc/glibc/sysdeps/arm/arm-features.h') ? join(zigLibDir, 'libc/glibc/sysdeps/arm/arm-features.h')
: join(zigExePath, '../lib/libc/glibc/sysdeps/arm/arm-features.h') : join(zigExePath, '../lib/libc/glibc/sysdeps/arm/arm-features.h')
await writeFileAsync(p, ARM_FEATURES_H, { if (!existsSync(p)) {
mode: 0o644, await writeFileAsync(p, ARM_FEATURES_H, {
}) mode: 0o644,
})
}
} catch (e) { } catch (e) {
throw new Error( console.error(
`Cannot patch arm-features.h, error: ${ Error(
(e as Error).message || e `Cannot patch arm-features.h, error: ${
}. See: https://github.com/ziglang/zig/issues/3287`, (e as Error).message || e
}. See: https://github.com/ziglang/zig/issues/3287`,
),
) )
} }
} }