From df64db2a55b81665c63f144fd4824a2e79c4b0d5 Mon Sep 17 00:00:00 2001 From: Leopold Tal G Date: Fri, 25 Sep 2020 17:07:26 +0200 Subject: [PATCH] deref darwin bundle symlinks only when building on win32 Windows [mangles symlinks](https://github.com/electron/electron-packager/issues/71). Currently we work around this by placing several copies of the frameworks in OS X app bundles (see 1e5aa3867d0681a66598879acf8c6322c0776184). However: - This is invalid: the framework toplevel must [only contain symlinks](https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPFrameworks/Concepts/FrameworkAnatomy.html). `codesign` [refuses to sign](https://stackoverflow.com/questions/25969946/osx-10-9-5-code-signing-v2-signing-a-framework-with-bundle-format-is-ambiguou) this invalid structure. - It seriously bloats the bundle. Since there's no fix for the Windows misbehaviour, keep the workaround, but only when cross-building on win32 for darwin; and log a warning. --- gulp/standalone.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gulp/standalone.js b/gulp/standalone.js index 6c7f0cfa..5fbb4c8a 100644 --- a/gulp/standalone.js +++ b/gulp/standalone.js @@ -1,3 +1,4 @@ +require('colors'); const packager = require("electron-packager"); const path = require("path"); const { getVersion } = require("./buildutils"); @@ -138,7 +139,11 @@ function gulptasksStandalone($, gulp) { fs.chmodSync(path.join(appPath, "play.sh"), 0o775); } - if (platform === "darwin") { + if (process.platform === "win32" && platform === "darwin") { + console.warn("Cross-building for macOS on Windows: dereferencing symlinks.\n".red + + "This will nearly double app size and make code signature invalid. Sorry!\n".red.bold + + "For more information, see " + "https://github.com/electron/electron-packager/issues/71".underline); + // Clear up framework folders fs.writeFileSync( path.join(appPath, "play.sh"),