summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorLinus Färnstrand <faern@faern.net>2021-12-27 21:47:58 +0100
committerLinus Färnstrand <linus@mullvad.net>2021-12-29 13:57:09 +0100
commit2dafa505bda64cddb84369d90f8a1f599f7050d5 (patch)
tree1c2c0542cdaf76b5edf927290c98190d351b5f0c
parent56de07e2b35f08c7d5668cd04c0d4410262c3c57 (diff)
downloadmullvadvpn-2dafa505bda64cddb84369d90f8a1f599f7050d5.tar.xz
mullvadvpn-2dafa505bda64cddb84369d90f8a1f599f7050d5.zip
Make build.sh produce single architecture pkg by default (--universal)
Add --universal flag for building universal app for both Intel and Apple Silicon
-rw-r--r--README.md4
-rwxr-xr-xbuild.sh25
-rwxr-xr-xci/buildserver-build.sh7
-rw-r--r--gui/tasks/distribution.js3
4 files changed, 18 insertions, 21 deletions
diff --git a/README.md b/README.md
index 2a4003c3e1..927bafe818 100644
--- a/README.md
+++ b/README.md
@@ -310,8 +310,8 @@ Building this requires at least 1GB of memory.
#### macOS
-By default a universal app is built on macOS. To build specifically for x86_64 or ARM64 add
-`--target x86_64-apple-darwin` or `--target aarch64-apple-darwin`.
+By default, `build.sh` produces a pkg for your current architecture only. To build a universal
+app that works on both Intel and Apple Silicon macs, build with `--universal`.
##### Apple ARM64 (aka Apple Silicon)
diff --git a/build.sh b/build.sh
index 15f05dd311..51aa3ee8de 100755
--- a/build.sh
+++ b/build.sh
@@ -26,9 +26,14 @@ while [[ "$#" -gt 0 ]]; do
--dev-build)
BUILD_MODE="dev"
;;
- --target)
- TARGET=("$2")
- shift
+ --universal)
+ if [[ "$(uname -s)" == "Darwin" ]]; then
+ TARGETS=(x86_64-apple-darwin aarch64-apple-darwin)
+ NPM_PACK_ARGS+=(--universal)
+ else
+ echo "--universal only works on macOS"
+ exit 1
+ fi
;;
*)
echo "Unknown parameter: $1"
@@ -38,12 +43,6 @@ while [[ "$#" -gt 0 ]]; do
shift
done
-if [[ "$(uname -s)" == "Darwin" && -z ${TARGET:-""} ]]; then
- echo "Defaulting to universal macOS target since no target was provided"
- TARGET=(x86_64-apple-darwin aarch64-apple-darwin)
- NPM_PACK_ARGS+=(--universal)
-fi
-
if [[ "$BUILD_MODE" == "release" ]]; then
if [[ $(git diff --shortstat 2> /dev/null | tail -n1) != "" ]]; then
echo "Dirty working directory!"
@@ -99,10 +98,6 @@ else
CARGO_ARGS+=(--locked)
fi
-if [[ "${TARGET:-""}" == "aarch64-apple-darwin" ]]; then
- NPM_PACK_ARGS+=(--arm64)
-fi
-
if [[ ("$(uname -s)" == "Darwin") ]]; then
BINARIES=(
mullvad-daemon
@@ -251,8 +246,8 @@ fi
./update-api-address.sh
# Compile for all defined targets, or the current architecture if unspecified.
-if [[ -n ${TARGET:-""} ]]; then
- for t in ${TARGET[*]}; do
+if [[ -n ${TARGETS:-""} ]]; then
+ for t in ${TARGETS[*]}; do
source env.sh "$t"
build "$t"
done
diff --git a/ci/buildserver-build.sh b/ci/buildserver-build.sh
index 802a45ddc0..0ddec68c90 100755
--- a/ci/buildserver-build.sh
+++ b/ci/buildserver-build.sh
@@ -107,7 +107,12 @@ build_ref() {
nvm install --latest-npm
fi
- ./build.sh || return 0
+ BUILD_ARGS=()
+ if [[ "$(uname -s)" == "Darwin" ]]; then
+ BUILD_ARGS+=(--universal)
+ fi
+ ./build.sh "${BUILD_ARGS[@]}" || return 0
+
case "$(uname -s)" in
MINGW*|MSYS_NT*)
echo "Packaging all PDB files..."
diff --git a/gui/tasks/distribution.js b/gui/tasks/distribution.js
index 205a966030..de6ca3bd57 100644
--- a/gui/tasks/distribution.js
+++ b/gui/tasks/distribution.js
@@ -8,7 +8,6 @@ const { version } = require('../package.json');
const compression = process.argv.includes('--no-compression') ? 'store' : 'normal';
const noAppleNotarization = process.argv.includes('--no-apple-notarization');
-const arm64 = process.argv.includes('--arm64');
const universal = process.argv.includes('--universal');
const config = {
@@ -299,8 +298,6 @@ function root(relativePath) {
function getMacArch() {
if (universal) {
return 'universal';
- } else if (arm64) {
- return 'arm64';
} else {
// Not specifying an arch makes Electron builder build for the arch it's running on.
return undefined;