diff options
| author | David Lönnhager <david.l@mullvad.net> | 2022-08-23 13:40:14 +0200 |
|---|---|---|
| committer | David Lönnhager <david.l@mullvad.net> | 2022-08-23 13:40:14 +0200 |
| commit | 7dc36e0fb75403c634c2c90c52e710ce2115248c (patch) | |
| tree | 42671cabd83517a9be84422e321d935356a4c115 /gui | |
| parent | e7c9140c4c2555affdd4ed879cd1a3593bdea7cf (diff) | |
| parent | 2b6855070649663dbb66107660085e3e1994f8c9 (diff) | |
| download | mullvadvpn-7dc36e0fb75403c634c2c90c52e710ce2115248c.tar.xz mullvadvpn-7dc36e0fb75403c634c2c90c52e710ce2115248c.zip | |
Merge branch 'linux-aarch64-build'
Diffstat (limited to 'gui')
| -rwxr-xr-x | gui/scripts/build-proto.sh | 9 | ||||
| -rw-r--r-- | gui/tasks/distribution.js | 72 |
2 files changed, 67 insertions, 14 deletions
diff --git a/gui/scripts/build-proto.sh b/gui/scripts/build-proto.sh index f2ee78e3af..5f8724a68c 100755 --- a/gui/scripts/build-proto.sh +++ b/gui/scripts/build-proto.sh @@ -5,7 +5,8 @@ set -eu SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" cd "$SCRIPT_DIR" -PLATFORM="$(uname -s)-$(uname -m)" +ARCH="$(uname -m)" +PLATFORM="$(uname -s)-${ARCH}" MANAGEMENT_INTERFACE_PROTO_BUILD_DIR=${MANAGEMENT_INTERFACE_PROTO_BUILD_DIR:-} NODE_MODULES_DIR="$(cd ../node_modules/.bin && pwd)" PROTO_DIR="../../mullvad-management-interface/proto" @@ -21,14 +22,14 @@ fi mkdir -p $DESTINATION_DIR mkdir -p $TYPES_DESTINATION_DIR -if [[ "${PLATFORM}" == "Darwin-arm64" ]]; then +if [[ "${ARCH,,}" == "arm64" || "${ARCH,,}" == "aarch64" ]]; then if [[ -n "${MANAGEMENT_INTERFACE_PROTO_BUILD_DIR}" ]]; then cp $MANAGEMENT_INTERFACE_PROTO_BUILD_DIR/*.js $DESTINATION_DIR cp $MANAGEMENT_INTERFACE_PROTO_BUILD_DIR/*.ts $TYPES_DESTINATION_DIR else - >&2 echo "Building management interface proto files on Apple Silicon is not supported" + >&2 echo "Building management interface proto files on aarch64 is not supported" >&2 echo "(see https://github.com/grpc/grpc-node/issues/1497)." - >&2 echo "Please build the proto files on another platform using build_mi_proto.sh script," + >&2 echo "Please build the proto files on another platform using build-proto.sh script," >&2 echo "and set MANAGEMENT_INTERFACE_PROTO_BUILD_DIR environment variable to the directory of the build." exit 1 fi diff --git a/gui/tasks/distribution.js b/gui/tasks/distribution.js index cee853748a..8fde833d4f 100644 --- a/gui/tasks/distribution.js +++ b/gui/tasks/distribution.js @@ -12,6 +12,13 @@ const noAppleNotarization = process.argv.includes('--no-apple-notarization'); const universal = process.argv.includes('--universal'); const release = process.argv.includes('--release'); +const targetsIndex = process.argv.indexOf('--targets'); +let targets = null; + +if (targetsIndex !== -1) { + targets = process.argv[targetsIndex + 1]; +} + const config = { appId: 'net.mullvad.vpn', copyright: 'Mullvad VPN AB', @@ -147,17 +154,26 @@ const config = { }, linux: { - target: ['deb', 'rpm'], + target: [ + { + target: 'deb', + arch: getLinuxTargetArch(), + }, + { + target: 'rpm', + arch: getLinuxTargetArch(), + }, + ], artifactName: 'MullvadVPN-${version}_${arch}.${ext}', category: 'Network', icon: distAssets('icon.icns'), extraFiles: [{ from: distAssets('linux/mullvad-gui-launcher.sh'), to: '.' }], extraResources: [ - { from: distAssets('mullvad-problem-report'), to: '.' }, - { from: distAssets('mullvad-daemon'), to: '.' }, - { from: distAssets('mullvad-setup'), to: '.' }, - { from: distAssets('libtalpid_openvpn_plugin.so'), to: '.' }, - { from: distAssets('binaries/x86_64-unknown-linux-gnu/openvpn'), to: '.' }, + { from: distAssets(path.join(getLinuxTargetSubdir(), 'mullvad-problem-report')), to: '.' }, + { from: distAssets(path.join(getLinuxTargetSubdir(), 'mullvad-daemon')), to: '.' }, + { from: distAssets(path.join(getLinuxTargetSubdir(), 'mullvad-setup')), to: '.' }, + { from: distAssets(path.join(getLinuxTargetSubdir(), 'libtalpid_openvpn_plugin.so')), to: '.' }, + { from: distAssets(path.join('binaries', '${env.TARGET_TRIPLE}', 'openvpn')), to: '.' }, { from: distAssets('linux/mullvad-daemon.service'), to: '.' }, ], }, @@ -173,8 +189,8 @@ const config = { distAssets('linux/before-remove.sh'), '--config-files', '/opt/Mullvad VPN/resources/mullvad-daemon.service', - distAssets('mullvad') + '=/usr/bin/', - distAssets('mullvad-exclude') + '=/usr/bin/', + distAssets(path.join(getLinuxTargetSubdir(), 'mullvad')) + '=/usr/bin/', + distAssets(path.join(getLinuxTargetSubdir(), 'mullvad-exclude')) + '=/usr/bin/', distAssets('linux/problem-report-link') + '=/usr/bin/mullvad-problem-report', distAssets('shell-completions/mullvad.bash') + '=/usr/share/bash-completion/completions/mullvad', @@ -196,8 +212,8 @@ const config = { distAssets('linux/post-transaction.sh'), '--config-files', '/opt/Mullvad VPN/resources/mullvad-daemon.service', - distAssets('mullvad') + '=/usr/bin/', - distAssets('mullvad-exclude') + '=/usr/bin/', + distAssets(path.join(getLinuxTargetSubdir(), 'mullvad')) + '=/usr/bin/', + distAssets(path.join(getLinuxTargetSubdir(), 'mullvad-exclude')) + '=/usr/bin/', distAssets('linux/problem-report-link') + '=/usr/bin/mullvad-problem-report', distAssets('shell-completions/mullvad.bash') + '=/usr/share/bash-completion/completions/mullvad', @@ -304,6 +320,21 @@ function packLinux() { targets: builder.Platform.LINUX.createTarget(), config: { ...config, + beforeBuild: (options) => { + switch (options.arch) { + case 'x64': + process.env.TARGET_TRIPLE = 'x86_64-unknown-linux-gnu'; + break; + case 'arm64': + process.env.TARGET_TRIPLE = 'aarch64-unknown-linux-gnu'; + break; + default: + delete process.env.TARGET_TRIPLE; + break; + } + + return true; + }, afterPack: async (context) => { config.afterPack?.(context); @@ -328,6 +359,27 @@ function root(relativePath) { return path.join(path.resolve(__dirname, '../../'), relativePath); } +function getLinuxTargetArch() { + if (targets) { + if (targets === 'aarch64-unknown-linux-gnu') { + return 'arm64'; + } + throw new Error(`Invalid or unknown target (only one may be specified)`); + } + // Use host architecture. + return undefined; +} + +function getLinuxTargetSubdir() { + if (targets) { + if (targets === 'aarch64-unknown-linux-gnu') { + return targets; + } + throw new Error(`Invalid or unknown target (only one may be specified)`); + } + return ''; +} + function getMacArch() { if (universal) { return 'universal'; |
