Skip to content

Commit

Permalink
build(mac): default to universal arch, add separated x64 + arm64 scripts
Browse files Browse the repository at this point in the history
Signed-off-by: Grigorii K. Shartsev <me@shgk.me>
  • Loading branch information
ShGKme committed Nov 15, 2024
1 parent 8cc6254 commit 77dd580
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 11 deletions.
20 changes: 13 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,16 +97,19 @@ npm run dev
### Build binaries for production

```bash
# 🖥️ Current platform
# 🖥️ Current platform and architecture
npm run build

# 🐧 Linux
# 🐧 Linux (x64)
npm run build:linux

# 🍏 Mac (Darwin)
# 🍏 macOS (universal)
npm run build:mac
# 🍏 macOS (separate x64 and arm64)
npm run build:mac:x64
npm run build:mac:arm64

# 🪟 Windows (win32)
# 🪟 Windows (win32-x64)
npm run build:windows
```

Expand Down Expand Up @@ -138,13 +141,16 @@ node ./scripts/fetch-server-styles.mjs stable29
## 📦 Packaging distributions

```bash
# 🐧 Linux
# 🐧 Linux (x64)
npm run package:linux

# 🍏 Mac (Darwin)
# 🍏 macOS (universal)
npm run package:mac
# 🍏 macOS (separate x64 and arm64)
npm run package:mac:arm64
npm run package:mac:x64

# 🪟 Windows (win32)
# 🪟 Windows (win32-x64)
npm run package:windows
```

Expand Down
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,15 @@
"dev": "electron-forge start",
"build": "electron-forge package",
"build:linux": "electron-forge package --platform=linux",
"build:mac": "electron-forge package --platform=darwin",
"build:mac": "electron-forge package --platform=darwin --arch=universal",
"build:mac:x64": "electron-forge package --platform=darwin --arch=x64",
"build:mac:arm64": "electron-forge package --platform=darwin --arch=arm64",
"build:windows": "electron-forge package --platform=win32",
"package": "electron-forge make --skip-package",
"package:linux": "electron-forge make --skip-package --platform=linux",
"package:mac": "electron-forge make --skip-package --platform=darwin",
"package:mac": "electron-forge make --skip-package --platform=darwin --arch=universal",
"package:mac:x64": "electron-forge make --skip-package --platform=darwin --arch=x64",
"package:mac:arm64": "electron-forge make --skip-package --platform=darwin --arch=arm64",
"package:windows": "electron-forge make --skip-package --platform=win32",
"release:package": "zx ./scripts/prepare-release-packages.mjs",
"generate-icons": "node ./scripts/generate-icons.js",
Expand Down
8 changes: 6 additions & 2 deletions scripts/prepare-release-packages.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ function help() {
--version - Optionally a specific Talk version/branch to build with, for example, v20.0.0-rc.1 or main. Default to stable in package.json.
--windows - build Windows package
--linux - build Linux package
--mac - build macOS package
--mac - build macOS package using universal architecture (recommended)
--mac-x64 - build macOS package using x64 architecture
--mac-arm64 - build macOS package using arm64 architecture
--skip-install - skip npm ci in both repositories
`
exit('', 0)
Expand All @@ -53,7 +55,7 @@ async function prepareRelease() {
const version = argv.version ?? packageJson.talk.stable

// Default to the current platform
if (!argv.windows && !argv.linux && !argv.mac) {
if (!argv.windows && !argv.linux && !argv.mac && !argv['mac-x64'] && !argv['mac-arm64']) {
const platform = process.platform === 'darwin' ? 'mac' : process.platform === 'win32' ? 'windows' : 'linux'
argv[platform] = true
}
Expand Down Expand Up @@ -118,6 +120,8 @@ async function prepareRelease() {
argv.windows && await spinner('Package Windows', () => $`npm run build:windows && npm run package:windows`)
argv.linux && await spinner('Package Linux', () => $`npm run build:linux && npm run package:linux`)
argv.mac && await spinner('Package MacOS', () => $`npm run build:mac && npm run package:mac`)
argv['mac-x64'] && await spinner('Package MacOS x64', () => $`npm run build:mac-x64 && npm run package:mac-x64`)
argv['mac-arm64'] && await spinner('Package MacOS arm64', () => $`npm run build:mac-arm64 && npm run package:mac-arm64`)

// Done
echo`Done. See output in ./out/make/`
Expand Down

0 comments on commit 77dd580

Please sign in to comment.