Skip to content

Commit

Permalink
feat: electron/universal has a new minimatch option 'x64ArchFiles' (#…
Browse files Browse the repository at this point in the history
…6913)

* electron/universal has a new minimatch option 'x64ArchFiles'

Some projects need to ship x64 binaries which will be run under
Rosetta2 on arm64 Macs.

This option allows a packager to specify that they're aware that
certain files in their distribution which are included in both x64
and arm64 builds are actually x64 binaries in both builds.

Without this option, electron/universal will attempt to lipo
the two binaries together, resulting in a build failure.
  • Loading branch information
obra committed Jun 5, 2022
1 parent 0b6db59 commit f3a56ef
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/famous-cheetahs-run.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"app-builder-lib": minor
---

Expose electron/universal's new "x64ArchFiles" option to allow building universal binaries with single-architecture dependencies
1 change: 1 addition & 0 deletions packages/app-builder-lib/src/macPackager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ export default class MacPackager extends PlatformPackager<MacConfiguration> {
force: true,
mergeASARs: platformSpecificBuildOptions.mergeASARs ?? true,
singleArchFiles: platformSpecificBuildOptions.singleArchFiles,
x64ArchFiles: platformSpecificBuildOptions.x64ArchFiles,
})
await fs.rm(x64AppOutDir, { recursive: true, force: true })
await fs.rm(arm64AppOutPath, { recursive: true, force: true })
Expand Down
9 changes: 9 additions & 0 deletions packages/app-builder-lib/src/options/macOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,15 @@ export interface MacConfiguration extends PlatformSpecificBuildOptions {
* only if `mergeASARs` is `true`.
*/
readonly singleArchFiles?: string

/**
* Minimatch pattern of paths that are allowed to be x64 binaries in both
* ASAR files
*
* This option has no effect unless building for "universal" arch and applies
* only if `mergeASARs` is `true`.
*/
readonly x64ArchFiles?: string
}

export interface DmgOptions extends TargetSpecificOptions {
Expand Down

0 comments on commit f3a56ef

Please sign in to comment.