build: add scripts for Windows ARM64 build - #1725
Conversation
There was a problem hiding this comment.
Pull request overview
Adds native Windows ARM64 build support for the Talk Desktop Electron app by making Windows packaging configuration architecture-aware and introducing ARM64 npm scripts.
Changes:
- Parameterize WiX MSI maker
archusing a target architecture value instead of hardcodingx64. - Parameterize Squirrel.Windows artifact naming to include the target architecture.
- Add npm scripts to package/make Windows ARM64 artifacts.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| package.json | Adds Windows ARM64 build/package scripts; renames Windows build script(s). |
| forge.config.js | Introduces TARGET_ARCH and uses it for WiX maker arch and Squirrel artifact names. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const TARGET_ARCH = process.env.TARGET_ARCH ?? process.arch | ||
|
|
There was a problem hiding this comment.
TARGET_ARCH defaults to process.arch, which is the host Node.js architecture and may not match the architecture Electron Forge is packaging/making for (e.g., running electron-forge make --arch=arm64 on an x64 host). This can cause MakerWix arch and Squirrel artifact names to be wrong. Consider deriving the value from the Forge CLI args (e.g., parsing process.argv for --arch) and only falling back to process.arch if no target is specified, or ensure npm scripts always set TARGET_ARCH alongside --arch.
| const TARGET_ARCH = process.env.TARGET_ARCH ?? process.arch | |
| /** | |
| * Resolve the target architecture passed to Electron Forge. | |
| * | |
| * Supports both `--arch=value` and `--arch value`. | |
| * | |
| * @return {string|undefined} The requested target architecture, if provided | |
| */ | |
| function resolveTargetArchFromArgs() { | |
| for (let i = 0; i < process.argv.length; i++) { | |
| const arg = process.argv[i] | |
| if (arg.startsWith('--arch=')) { | |
| return arg.slice('--arch='.length) | |
| } | |
| if (arg === '--arch' && i + 1 < process.argv.length) { | |
| return process.argv[i + 1] | |
| } | |
| } | |
| return undefined | |
| } | |
| const TARGET_ARCH = resolveTargetArchFromArgs() ?? process.env.TARGET_ARCH ?? process.arch |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ShGKme
left a comment
There was a problem hiding this comment.
Thank you for the contribution.
Due to electron-forge cli limitations, we need a different solution for setting and detecting the arch.
Tested on Windows ARM64 device — Task Manager confirms the process runs as native ARM64 architecture (no x64 emulation via Prism).
Could you clarify, did you test only the dev mode and build, or also the distributions (msi and exe)?
Closes #871
Even if we merge it, it does not close that issue.
The purpose of the issue was to see if users are even interested in this option (Windows ARM devices are not as popular, as macOS, for example).
And even with the script to build an ARM64 version, we still need ARM64 compatible infrastructure to publish an official arm64 release.
In other words, even if this PR is merged, it won't directly result in providing an ARM64 distribusion from Nextcloud GmbH.
| manufacturer: CONFIG.companyName, | ||
| shortName: CONFIG.applicationNameSanitized, | ||
| arch: 'x64', // electron-wix-msi defaults to x86 | ||
| arch: TARGET_ARCH, // electron-wix-msi defaults to x86 |
There was a problem hiding this comment.
I haven't tested it, but according to the package types, only x86 and x64 values are supported here. I don't have arm64 for testing. Did you actually test it with arm64 here?
There was a problem hiding this comment.
Yes, I tested it with arm64 on a Windows ARM64 device (Task Manager confirmed native ARM64 process).
The electron-wix-msi package supports arm64 since v5.1.3 with WiX 3.14 —
candle.exe now accepts arm64 as a valid arch value.
| const TARGET_ARCH = process.env.npm_config_arch | ||
| ?? process.env.TARGET_ARCH | ||
| ?? process.env.npm_config_target_arch | ||
| ?? process.arch |
There was a problem hiding this comment.
In both places where arch is applied, there is a very limited range of acceptable values.
In general, we would support x64 and arm64 only (and universal on macOS).
The range here is much wider. For example, process.arch can be: 'arm', 'arm64', 'ia32', 'loong64', 'mips', 'mipsel', 'ppc64', 'riscv64', 's390', 's390x', 'x64'.
Even if it is unlikely some exotic value would be here, it is worth validating.
Currently, all the build/package parameters are defined via electron-forge args, and not an ENV, including npm config (this seems the most unexpected to me).
There are 4 expected options:
- Not specified = the current arch
--arch=x64--arch=arm64--arch=universal(macOS)
The best would be to use the value from the electron-forge.
Unfortunately, it doesn't provide a simple way to get the params in the config. No function-style config like in bundlers.
One simple (yet dirty) way to get the arch is the generateAssets hook which has it in arguments. But it is only used for building, not packaging (not for makers).
AI above suggested checking process.argv, and this seems the only "simple" solution.
A fallback is needed to process.arch, but only to x64 and arm64. I'd check how electron-forge makes fallback on their side.
This is quite messy, but comes from electron-forge limitation.
An alternative would be to replace electron-forge CLI with our own CLI, which then runs electron-forge. Which is a good solution and makes sense, but IMO too big change to add arm64 build when we won't even release it.
There was a problem hiding this comment.
„Thanks for the detailed explanation! I've implemented the process.argv approach with validation to only allow x64 and arm64. Regarding the release question — I understand if this won't be in the official release yet, but happy to keep the build scripts for users who want to build locally. Let me know how you'd like to proceed."
|
But I don't understand at the moment whether the plan is to support Windows on Arm or whether this option is not available at all, in which case further development in this pull request would not be necessary or am I looking at this wrong? Github Runners are able to provide the arm64 version or am I wrong? |
Merging this PR would allow you and other developers on Windows ARM machines to build the release Windows ARM version locally. But it doesn't help to officially release and publish a Windows ARM version on behalf of Nextcloud GmbH. It would require support from our infrastructure.
We don't package apps on the GitHub Runners. And even with GitHub Runners, signing would still require additional infrastructure components. It cannot happen on the runner itself completely on the GitHub side. |
|
Is there any reason to support this platform? |
What platform? |
|
I'd like to highlight that Windows on ARM has become an increasingly relevant platform. Many major software vendors have already added ARM64 support, and the user base continues to grow — especially with devices like the Snapdragon X Elite-based laptops. There is a long-standing issue for the main desktop client (nextcloud/desktop#1677, open since 2019) that has not seen any progress. I understand that adding ARM64 support to the C++/Qt-based desktop client is a significant effort. However, Talk Desktop — being Electron-based — is in a much better position to support this platform with relatively small changes. This PR is an attempt to address that gap for at least one Nextcloud client. I'd appreciate any feedback on how to move this forward, even if official release support isn't planned immediately. Having the build infrastructure in place would already be valuable for users who build from source. |
|
|
||
| require('dotenv').config() | ||
|
|
||
| const argArch = process.argv.find((_, i, arr) => arr[i - 1] === '--arch') |
There was a problem hiding this comment.
This only handles args with space-separated values like --argv x64 but not = separated like--arch=x64, which is even used in the package.json scripts.
We already have mri package in the app that parses argv. It can be used here to do the parsing.
const mri = require('mri')
const argv = mri(process.argv)Then argv.arch can be used as the current argArch
There was a problem hiding this comment.
const mri = require('mri')
const SUPPORTED_ARCHS = ['x64', 'arm64', 'universal']
const argArch = mri(process.argv).arch
const systemArch = SUPPORTED_ARCHS.includes(process.arch) ? process.arch : 'x64'
const TARGET_ARCH = SUPPORTED_ARCHS.includes(argArch) ? argArch : systemArch
you mean something like this?
| require('dotenv').config() | ||
|
|
||
| const argArch = process.argv.find((_, i, arr) => arr[i - 1] === '--arch') | ||
| const SUPPORTED_ARCHS = ['x64', 'arm64'] |
There was a problem hiding this comment.
On macOS we also have universal.
| const SUPPORTED_ARCHS = ['x64', 'arm64'] | |
| const SUPPORTED_ARCHS = ['x64', 'arm64', 'universal'] |
We are fine with adding the support to the build script. It only requires some small changes to correctly parse the We'll also make sure building the application is as simple as possible. But even if the change in the source code in Talk Desktop might be simpler than in the Nextcloud Desktop sync client, we share the same infrastructure, which at the moment, does not support Windows ARM builds. This may change in the future. |
|
Hey, i changed it with your recommendation, only for me, because i would like to switch my private Home Server to nextcloud are there any plans for the next 6 Months to support this? I switched to arm because i dont study in my Hometown and i need the good battery life. |
Is this also the case for a linux arm build? |
ShGKme
left a comment
There was a problem hiding this comment.
The code change looks good, tested with different commands.
Unfortunately, I cannot test the arm64 build. We don't have a Windows ARM device in the team. I'll believe your testing :)
|
How do i fix this error ? |
|
When somebody in your team has aa mac they could test it with a windows vm they run windows on arm |
|
I renamed the PR to avoid confusion for an official Windows ARM64 release. |
@aequivalent2 Could you squash the commits into a single commit and force push? |
If by "support this" you mean, officially release Talk Desktop for Windows ARM64, I don't know. But without the Nextcloud Desktop sync client for Windows ARM64 — unlikely. |
This is a different story. For |
5152b6d to
07c2d39
Compare
I'm actually interested in testing it on Ubuntu Touch (UT), but that doesn't support flatpak yet— i can however attempt to package for it using the zip. So if we can get an ARM zip build that would be very appreciated Technically UT does also support snap but that's a whole different packaging format i suppose |
|
@aequivalent2 You have 1 extra commit from the nextcloud-command updating translation strings. This was added by mistake and should be dropped. The second commit is missing DCO. You need to add the following string to the commit description: You can do it with |
07c2d39 to
dae929b
Compare
|
Yes, is added |
There was a problem hiding this comment.
This commit with this change should not be included in the PR
5dfb5b2 to
49e1923
Compare
|
Now everything should be fine, sorry i am currently in the train and its a little bit complicated |
49e1923 to
3f32b99
Compare
|
I hope now everything works, sorry for the long git history, i should plan more time for this |
Signed-off-by: Leo Pan <leonhard.ruckert@outlook.com>
ShGKme
left a comment
There was a problem hiding this comment.
Changes are still mixed with commits outside the PR.
I'll push the changes to your branch to resolve the problem.
| "mini-css-extract-plugin": "^2.10.0", | ||
| "node-loader": "^2.1.0", | ||
| "node-polyfill-webpack-plugin": "4.0.0", | ||
| "sass": "^1.99.0", |
3f32b99 to
e8a7037
Compare
|
|
Thank you very much for the work : )) |
|
Hello there, We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process. Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6 Thank you for contributing to Nextcloud and we hope to hear from you soon! (If you believe you should not receive this message, you can add yourself to the blocklist.) |




Summary
This PR adds native Windows ARM64 build support to the Talk Desktop client.
Changes
forge.config.js: Replace hardcodedarch: 'x64'inMakerWixwithdynamic
TARGET_ARCHenvironment variableforge.config.js: Replace hardcoded'x64'inMakerSquirreldist nameswith
TARGET_ARCHpackage.json: Addbuild:windows:arm64andpackage:windows:arm64scriptsHow to build for ARM64
Testing
Tested on Windows ARM64 device — Task Manager confirms the process runs
as native ARM64 architecture (no x64 emulation via Prism).