diff options
| -rw-r--r-- | README.md | 19 | ||||
| -rwxr-xr-x | gui/scripts/build-proto.sh | 10 | ||||
| -rwxr-xr-x | gui/scripts/build_mi_proto.sh | 20 |
3 files changed, 16 insertions, 33 deletions
@@ -303,29 +303,32 @@ Due to inability to build the management interface proto files on ARM64 (see [this](https://github.com/grpc/grpc-node/issues/1497) issue) the Apple ARM64 build must be done in 2 stages: 1. Build management interface proto files on a non-ARM64 platform -2. Use the built proto files during the main build by setting the `MI_PROTO_BUILD_DIR` environment variable - to the path the proto files +2. Use the built proto files during the main build by setting the `MANAGEMENT_INTERFACE_PROTO_BUILD_DIR` + environment variable to the path the proto files To build the management interface proto files there is a script (execute it on a non-ARM64 platform): ```bash cd gui/scripts -./build_mi_proto.sh +npm ci +./build-proto.sh ``` -After that transfer the resulting build directory to your Apple ARM64 platform, and set the value of -`MI_PROTO_BUILD_DIR` to the transfer destination while running the main build. +After that copy the files from `gui/src/main/management_interface/` and `gui/build/src/main/management_interface/` +directories into a single directory on your Apple Silicon Mac, and set the value of +`MANAGEMENT_INTERFACE_PROTO_BUILD_DIR` to that directory while running the main build. -Another prerequisite is `protobuf`, which can be installed by running: +On your Apple Silicon Mac install `protobuf` by running: ```bash brew install protobuf ``` -When all is done run the main build: +When all is done run the main build. Assuming that you copied the proto files into `/tmp/management_interface_proto` +directory, the build command will look as follows: ```bash -MI_PROTO_BUILD_DIR=/Users/doe/mullvadvpn-app/gui/scripts/mi_proto ./build.sh --dev-build +MANAGEMENT_INTERFACE_PROTO_BUILD_DIR=/tmp/management_interface_proto ./build.sh --dev-build ``` If you want to build each component individually, or run in development mode, read the following diff --git a/gui/scripts/build-proto.sh b/gui/scripts/build-proto.sh index 5a09d111e3..29e5f2793c 100755 --- a/gui/scripts/build-proto.sh +++ b/gui/scripts/build-proto.sh @@ -6,7 +6,7 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" cd "$SCRIPT_DIR" PLATFORM="$(uname -s)-$(uname -m)" -MI_PROTO_BUILD_DIR=${MI_PROTO_BUILD_DIR:-} +MANAGEMENT_INTERFACE_PROTO_BUILD_DIR=${MANAGEMENT_INTERFACE_PROTO_BUILD_DIR:-} NODE_MODULES_DIR="$(cd ../node_modules/.bin && pwd)" PROTO_DIR="../../mullvad-management-interface/proto" PROTO_FILENAME="management_interface.proto" @@ -22,14 +22,14 @@ mkdir -p $DESTINATION_DIR mkdir -p $TYPES_DESTINATION_DIR if [[ "${PLATFORM}" == "Darwin-arm64" ]]; then - if [[ -n "${MI_PROTO_BUILD_DIR}" ]]; then - cp $MI_PROTO_BUILD_DIR/*.js $DESTINATION_DIR - cp $MI_PROTO_BUILD_DIR/*.ts $TYPES_DESTINATION_DIR + 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 "(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 "and set MI_PROTO_BUILD_DIR environment variable to the directory of the build." + >&2 echo "and set MANAGEMENT_INTERFACE_PROTO_BUILD_DIR environment variable to the directory of the build." exit 1 fi else diff --git a/gui/scripts/build_mi_proto.sh b/gui/scripts/build_mi_proto.sh deleted file mode 100755 index abfae36cbc..0000000000 --- a/gui/scripts/build_mi_proto.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env bash - -# This script is used to build the management interface proto files to later use them on the platforms -# unsupported by grpc-tools (e.g. Apple Silicon). - -set -eu - -SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -PROTO_BUILD_DIR="$SCRIPT_DIR/mi_proto" - -npm ci -npm run build-proto - -mkdir -p "$PROTO_BUILD_DIR" -cp $SCRIPT_DIR/../../gui/src/main/management_interface/* $PROTO_BUILD_DIR -cp $SCRIPT_DIR/../../gui/build/src/main/management_interface/* $PROTO_BUILD_DIR - -echo "" -echo "Management interface proto files built successfully." -echo "Build directory: $PROTO_BUILD_DIR" |
