From 0ea3b1bbc7b49d62a234024453eb10d950c1d354 Mon Sep 17 00:00:00 2001 From: ayumi-signal <143036029+ayumi-signal@users.noreply.github.com> Date: Wed, 13 May 2026 10:21:25 -0700 Subject: [PATCH] Add experimental support for building Linux ARM64 Co-authored-by: trevor-signal <131492920+trevor-signal@users.noreply.github.com> --- package.json | 5 ++++- reproducible-builds/build.sh | 4 +++- reproducible-builds/docker-entrypoint.sh | 4 ++-- scripts/prepare_linux_build.mjs | 18 ++++++++++++++++-- ts/updater/common.main.ts | 4 ++++ 5 files changed, 29 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 9a335a423..00bc2d70b 100644 --- a/package.json +++ b/package.json @@ -525,7 +525,10 @@ }, "artifactName": "${name}_${version}_${arch}.${ext}", "target": [ - "deb" + { + "target": "deb", + "arch": "x64" + } ], "icon": "build/icons/png", "publish": [ diff --git a/reproducible-builds/build.sh b/reproducible-builds/build.sh index 40b802f9c..47bab78d6 100755 --- a/reproducible-builds/build.sh +++ b/reproducible-builds/build.sh @@ -7,7 +7,8 @@ # Env vars: # SOURCE_DATE_EPOCH: Build timestamp override. Defaults to latest git commit or 1. # SKIP_DOCKER_BUILD: To support docker build cache during actions. -# BUILD_TARGETS: Override build targets. Empty default results in deb. +# BUILD_TARGETS: Override build targets. Empty default results in deb. Comma separated list. +# BUILD_ARCH: Override build architectures. Empty default results in x64. Comma separated list. # Examples: # ./build.sh public @@ -54,4 +55,5 @@ docker run --rm \ -e PNPM_HOME=/tmp/.pnpm-home \ -e SOURCE_DATE_EPOCH=$source_date_epoch \ -e BUILD_TARGETS=$BUILD_TARGETS \ + -e BUILD_ARCH=$BUILD_ARCH \ signal-desktop $1 diff --git a/reproducible-builds/docker-entrypoint.sh b/reproducible-builds/docker-entrypoint.sh index 118ef910c..2151f68df 100644 --- a/reproducible-builds/docker-entrypoint.sh +++ b/reproducible-builds/docker-entrypoint.sh @@ -66,8 +66,8 @@ else exit 1 fi -if [ "${BUILD_TARGETS}" != "" ]; then - pnpm run prepare-linux-build $BUILD_TARGETS +if [ "${BUILD_TARGETS}" != "" ] || [ "${BUILD_ARCH}" != "" ]; then + pnpm run prepare-linux-build "$BUILD_TARGETS" "$BUILD_ARCH" fi pnpm run build-linux diff --git a/scripts/prepare_linux_build.mjs b/scripts/prepare_linux_build.mjs index 5434c2831..4cd497b11 100644 --- a/scripts/prepare_linux_build.mjs +++ b/scripts/prepare_linux_build.mjs @@ -6,8 +6,9 @@ import _ from 'lodash'; import packageJson from '../package.json' with { type: 'json' }; const TARGETS = new Set(['appimage', 'deb']); +const ARCHITECTURES = new Set(['arm64', 'x64']); -const targets = (process.argv[2] || '').split(','); +const targets = (process.argv[2] || 'deb').split(','); if ( targets.length === 0 || !targets.every(target => TARGETS.has(target.toLowerCase())) @@ -18,11 +19,24 @@ if ( process.exit(1); } +const archs = (process.argv[3] || 'x64').split(','); +if ( + archs.length === 0 || + !archs.every(arch => ARCHITECTURES.has(arch.toLowerCase())) +) { + console.error( + `Invalid linux architectures ${archs.join(', ')}. Valid options: ${[...ARCHITECTURES].join(', ')}` + ); + process.exit(1); +} + console.log('prepare_linux_build: updating package.json'); // ------ -_.set(packageJson, 'build.linux.target', targets); +const targetsWithArch = _.map(targets, target => ({ target, arch: archs })); + +_.set(packageJson, 'build.linux.target', targetsWithArch); // ------- diff --git a/ts/updater/common.main.ts b/ts/updater/common.main.ts index dbbe582c5..1956c02a2 100644 --- a/ts/updater/common.main.ts +++ b/ts/updater/common.main.ts @@ -997,6 +997,10 @@ function getUpdatesFileName(): string { } if (process.platform === 'linux') { + if (process.arch === 'arm64') { + return `${prefix}-linux-arm64.yml`; + } + return `${prefix}-linux.yml`; }