browser-base icon indicating copy to clipboard operation
browser-base copied to clipboard

Support arm64 mac architecture builds - here's how

Open ScottWallace opened this issue 4 years ago • 1 comments
trafficstars

Is your feature request related to a problem? Please describe. Build for the arm64 mac m1 architecture, with separate zip and dmg files for each.

Modifications to support the arm64 mac m1 architecture involve two changes, one to the electron-builder.json, and an upgrade to electron-builder.

To electron-builder.json add the artifactName globally, as shown:

  "nsis": {
    "include": "static/installer.nsh"
  },
  "artifactName": "${productName}-${version}-${os}-${arch}.${ext}",
  "generateUpdatesFilesForAllChannels": true,
  "asar": true,
  "directories": {
    "output": "dist",
    "buildResources": "static/icons"
  },

Then, make the following changes to the mac build:

  "mac": {
    "category": "public.app-category.navigation",
    "darkModeSupport": true,
    "artifactName": "${productName}-${version}-${os}-${arch}.${ext}",
    "target": [
      {
        "target": "dmg",
        "arch": ["x64", "arm64"]
      },
      {
        "target": "zip",
        "arch": ["x64", "arm64"]
      }
    ]
  },

In addition, electron-builder must be upgraded:

"electron-builder": "22.10.4",

This is due to a bug in the release version that doesn't support the ${arch} file macro. Further information about this bug comes from: https://github.com/electron-userland/electron-builder/issues/5569#issuecomment-766076412

I really should do a pull request, but my own project upon which this is based is convoluted.

ScottWallace avatar Feb 18 '21 16:02 ScottWallace

Thanks for help!

sentialx avatar Feb 18 '21 17:02 sentialx