Install cross-platform deps before packaging
This commit is contained in:
parent
44872ac961
commit
3b70f4b0f1
2 changed files with 35 additions and 1 deletions
|
@ -397,6 +397,7 @@
|
||||||
"signalcaptcha"
|
"signalcaptcha"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"beforeBuild": "scripts/install-cross-deps.js",
|
||||||
"asarUnpack": [
|
"asarUnpack": [
|
||||||
"ts/workers/heicConverter.bundle.js",
|
"ts/workers/heicConverter.bundle.js",
|
||||||
"ts/sql/mainWorker.bundle.js",
|
"ts/sql/mainWorker.bundle.js",
|
||||||
|
@ -453,7 +454,10 @@
|
||||||
"node_modules/socks/build/client/*.js",
|
"node_modules/socks/build/client/*.js",
|
||||||
"node_modules/smart-buffer/build/*.js",
|
"node_modules/smart-buffer/build/*.js",
|
||||||
"node_modules/sharp/build/**/*${arch}*.node",
|
"node_modules/sharp/build/**/*${arch}*.node",
|
||||||
"!node_modules/sharp/{install,src,vendor/include,vendor/*/include}",
|
"!node_modules/sharp/{install,src,vendor}",
|
||||||
|
"!node_modules/sharp/vendor",
|
||||||
|
"node_modules/sharp/vendor/*/*${arch}*/**",
|
||||||
|
"!node_modules/sharp/vendor/*/*${arch}*/**/include/**",
|
||||||
"!node_modules/better-sqlite3/deps/*",
|
"!node_modules/better-sqlite3/deps/*",
|
||||||
"!node_modules/better-sqlite3/src/*",
|
"!node_modules/better-sqlite3/src/*",
|
||||||
"node_modules/better-sqlite3/build/Release/better_sqlite3.node",
|
"node_modules/better-sqlite3/build/Release/better_sqlite3.node",
|
||||||
|
|
30
scripts/install-cross-deps.js
Normal file
30
scripts/install-cross-deps.js
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
// Copyright 2021 Signal Messenger, LLC
|
||||||
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
/* eslint-disable no-console */
|
||||||
|
|
||||||
|
const path = require('path');
|
||||||
|
const { execSync } = require('child_process');
|
||||||
|
|
||||||
|
exports.beforeBuild = async () => {
|
||||||
|
if (process.platform !== 'darwin') {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
const nonNativeArchs = ['arm64', 'x64'].filter(arch => arch !== process.arch);
|
||||||
|
|
||||||
|
for (const arch of nonNativeArchs) {
|
||||||
|
console.log("Installing sharp's dependencies for", arch);
|
||||||
|
execSync('yarn run install', {
|
||||||
|
cwd: path.join(__dirname, '..', 'node_modules', 'sharp'),
|
||||||
|
env: {
|
||||||
|
...process.env,
|
||||||
|
npm_config_arch: arch,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Let electron-builder handle dependencies
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.beforeBuild();
|
Loading…
Reference in a new issue