Skip to content

Commit

Permalink
Remove build_mi_proto.sh. Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Ch00k committed Feb 26, 2021
1 parent 5d0a06e commit 4223df0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 33 deletions.
19 changes: 11 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions gui/scripts/build-proto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand Down
20 changes: 0 additions & 20 deletions gui/scripts/build_mi_proto.sh

This file was deleted.

0 comments on commit 4223df0

Please sign in to comment.