diff --git a/tools/build_electron.mjs b/tools/build_electron.mjs index f4c6c64..f9f217f 100644 --- a/tools/build_electron.mjs +++ b/tools/build_electron.mjs @@ -13,6 +13,7 @@ function $withoutEscaping(pieces, ...args) { const platform = argv._[0] let electronBuilderArgs = [] +let nodePreGypArgs = [] if (!platform) { console.log('No platform specified, building for current') @@ -21,20 +22,30 @@ if (!platform) { if (platform === 'mac-x64') { electronBuilderArgs.push('--x64', '--mac') + nodePreGypArgs = ['--target_platform=darwin', '--target_arch=x64', '--target_libc=unknown'] } else if (platform === 'mac-arm64') { electronBuilderArgs.push('--arm64', '--mac') + nodePreGypArgs = ['--target_platform=darwin', '--target_arch=arm64', '--target_libc=unknown'] } else if (platform === 'win-x64') { electronBuilderArgs.push('--x64', '--win') + nodePreGypArgs = ['--target_platform=win32', '--target_arch=x64', '--target_libc=unknown'] } else if (platform === 'linux-x64') { electronBuilderArgs.push('--x64', '--linux') + nodePreGypArgs = ['--target_platform=linux', '--target_arch=x64', '--target_libc=glibc'] } else if (platform === 'linux-arm7') { electronBuilderArgs.push('--armv7l', '--linux') + nodePreGypArgs = ['--target_platform=linux', '--target_arch=arm', '--target_libc=glibc'] } else { console.error('Unknown platform') process.exit(1) } } +// Force reinstall @julusian/skia-canvas, so that it is the correct arch +if (nodePreGypArgs.length) { + await $`yarn --cwd node_modules/@julusian/skia-canvas run install --update-binary ${nodePreGypArgs}` +} + // HACK: skip this as it is trying to rebuild everything from source and failing // if (!platform) { // // If for our own platform, make sure the correct deps are installed