Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apple Silicon Universal Support #5475

Closed
Tracked by #627
lutzroeder opened this issue Dec 14, 2020 · 5 comments
Closed
Tracked by #627

Apple Silicon Universal Support #5475

lutzroeder opened this issue Dec 14, 2020 · 5 comments

Comments

@lutzroeder
Copy link
Contributor

lutzroeder commented Dec 14, 2020

Tracking Universal support from #5426.

See also electron/electron#26710 and electron/universal.

@mmaietta @quanglam2807 @elliottkember @devlar

@mmaietta
Copy link
Collaborator

Getting the universal package seems to work quite simply.

const universal = require('@electron/universal');
const path = require('path');

universal.makeUniversalApp({
  x64AppPath: path.resolve('./dist/artifacts/mac/Electron.app'),
  arm64AppPath: path.resolve('./dist/artifacts/mac-arm64/Electron.app'),
  outAppPath: path.resolve('./dist/artifacts/mac-universal/Electron.app'),
});

Native addons are spliced together into a "fat" file.

Two things I don't know yet:

@lutzroeder
Copy link
Contributor Author

lutzroeder commented Dec 15, 2020

@mmaietta @develar How would this be initiated at command line?

npx electron-builder --mac --x86 --arm64 won't work as it builds separate x64 and arm64 targets.

Would it make sense to add an Arch called --universal or --x64_arm64? The goal would be to avoid building multiple .dmg or .zip files or signing before the merged .app is created. Does building the executables exist as separate step?

Another issue would be rolling off universal in the future. Is it possible to build arm64 targets without a platform suffix once x64 is getting deprecated?

@mmaietta
Copy link
Collaborator

mmaietta commented Dec 15, 2020

There's actually already an all available via the programmatic API, so I'd imagine we could reuse that here.
https://github.com/electron-userland/electron-builder/blob/master/test/src/mac/macPackagerTest.ts#L9

Universal apps still require an x64 and arm64 build. I think electron-updater may require those separate builds as well, as opposed to the larger initial universal binary, I honestly don't know because I don't use it. It would make sense though from a user-perspective as they should only need to be downloading an arch-specific package.

My plan is to just check if both mac x64 and arm64 builds are created, if so, also create a universal app. From my testing, the universal app "stitching" together took only a few seconds to complete, so the impact should be minimal. We just need to figure out the resign and an additional dmg/zip packing.

Another issue would be rolling off universal in the future. Is it possible to build arm64 targets without a platform suffix once x64 is getting deprecated?

There's no need to by default as we also want to maintain backward compatibility, you should just manually specify an artifactName template without the ${arch} and only build with an arm64 target.

@lutzroeder
Copy link
Contributor Author

lutzroeder commented Dec 15, 2020

all gets expanded into --x86 --arm64 right away. It has a predefined meaning that is different from universal. For test, all would include x64, arm64 and universal.

My plan is to just check if both mac x64 and arm64 builds are created, if so, also create a universal app. From my testing, the universal app "stitching" together took only a few seconds to complete, so the impact should be minimal. We just need to figure out the resign and an additional dmg/zip packing.

The goal is to avoid signing the x86 and arm64 binaries if only the universal binaries need to be signed and deployed. Signing and notarization tends to be the most fragile part of a CI pipeline so it should be avoided unless necessary. doPack might have to split into doPack and doSignAfterPack with doPack having an option not to sign while building the temporary x86 and arm64 binaries.

The folder name for universal should be Foo-mac.zip so it gets picked up by updater. Since this is used for x64 currently there might be a mismatch. The goal would be to update from the current x64 bits to universal bits with the same name and in the future allowing to update from universal to arm64 bits with the same name. From the user perspective there is only Foo-mac.zip.

@lutzroeder
Copy link
Contributor Author

lutzroeder commented Dec 16, 2020

There's no need to by default as we also want to maintain backward compatibility, you should just manually specify an artifactName template without the ${arch} and only build with an arm64 target.

@mmaietta is it possible to configure artifactName for macOS zip targets? Also, the dmg target will compute a different volume name including architecture, even if artifactName is specified.

undergroundwires added a commit to undergroundwires/privacy.sexy that referenced this issue May 16, 2024
This commit introduces a universal binary format in the distributed MDG
files for macOS, improving support for both Apple Silicon (ARM) and
Intel (x64) architectures.

It uses `electron-builder` to package both architectures into a single
executable, ensuring the application can natively on any macOS hardware
without depending on the GitHub runners' architecture. It fixes the
issue related to prior releases that supported only the architecture of
the build environment itself, which is subject to change.

Changes:

- Update DMG distribution to include both ARM64 and x64 architectures.
- Enhance system requirements documentation to reflect support for both
  architectures.
- Modify CI/CD workflows to check desktop runtime errors for both ARM64
  and x64 versions on macOS.

Resolves:

- Issue #348: Initial request for Apple Silicon support.
- Issue #362: Correction of distribution limited to ARM64 in release
  0.13.3.

`electron-builder` support:
- electron-userland/electron-builder#5475
- electron-userland/electron-builder#5689
- electron-userland/electron-builder#5426
undergroundwires added a commit to undergroundwires/privacy.sexy that referenced this issue May 16, 2024
This commit introduces a universal binary format in the distributed MDG
files for macOS, improving support for both Apple Silicon (ARM) and
Intel (x64) architectures.

It uses `electron-builder` to package both architectures into a single
executable, ensuring the application can natively on any macOS hardware
without depending on the GitHub runners' architecture. It fixes the
issue related to prior releases that supported only the architecture of
the build environment itself, which is subject to change.

Changes:

- Update DMG distribution to include both ARM64 and x64 architectures.
- Enhance system requirements documentation to reflect support for both
  architectures.
- Modify CI/CD workflows to check desktop runtime errors for both ARM64
  and x64 versions on macOS.

Resolves:

- Issue #348: Initial request for Apple Silicon support.
- Issue #362: Correction of distribution limited to ARM64 in release
  0.13.3.

`electron-builder` support:
- electron-userland/electron-builder#5475
- electron-userland/electron-builder#5689
- electron-userland/electron-builder#5426
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants