summaryrefslogtreecommitdiffhomepage
path: root/build.sh
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 /build.sh
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
Diffstat (limited to 'build.sh')
-rwxr-xr-xbuild.sh25
1 files changed, 10 insertions, 15 deletions
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