wexond / browser-base

Modern and feature-rich web browser base based on Electron
https://wexond.net
2.68k stars 406 forks source link

Support arm64 mac architecture builds - here's how #563

Open ScottWallace opened 3 years ago

ScottWallace commented 3 years ago

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.

sentialx commented 3 years ago

Thanks for help!