diff options
| author | Andrii Yurchuk <ay@mntw.re> | 2021-02-10 18:48:28 +0100 |
|---|---|---|
| committer | Andrii Yurchuk <ay@mntw.re> | 2021-02-26 19:03:00 +0100 |
| commit | c7717f006e8f2e255e521a53c5c86eaaec6a616c (patch) | |
| tree | 422bc321ac6566bc4787e26d9443741e8e9acec8 /gui/scripts | |
| parent | b09da89cf6a974e3ba8bd6b0cfebebb3765d5a50 (diff) | |
| download | mullvadvpn-c7717f006e8f2e255e521a53c5c86eaaec6a616c.tar.xz mullvadvpn-c7717f006e8f2e255e521a53c5c86eaaec6a616c.zip | |
Allow building on Apple Silicon
Diffstat (limited to 'gui/scripts')
| -rwxr-xr-x | gui/scripts/build-proto.sh | 36 |
1 files changed, 25 insertions, 11 deletions
diff --git a/gui/scripts/build-proto.sh b/gui/scripts/build-proto.sh index a6cf6a5d94..5a09d111e3 100755 --- a/gui/scripts/build-proto.sh +++ b/gui/scripts/build-proto.sh @@ -5,6 +5,8 @@ set -eu SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" cd "$SCRIPT_DIR" +PLATFORM="$(uname -s)-$(uname -m)" +MI_PROTO_BUILD_DIR=${MI_PROTO_BUILD_DIR:-} NODE_MODULES_DIR="$(cd ../node_modules/.bin && pwd)" PROTO_DIR="../../mullvad-management-interface/proto" PROTO_FILENAME="management_interface.proto" @@ -19,15 +21,27 @@ fi mkdir -p $DESTINATION_DIR mkdir -p $TYPES_DESTINATION_DIR -"$NODE_MODULES_DIR/grpc_tools_node_protoc" \ - --js_out=import_style=commonjs,binary:$DESTINATION_DIR \ - --grpc_out=generate_package_definition:$DESTINATION_DIR \ - --proto_path=$PROTO_DIR \ - $PROTO_DIR/$PROTO_FILENAME - -"$NODE_MODULES_DIR/grpc_tools_node_protoc" \ - --plugin=protoc-gen-ts=$TS_PROTOC_PLUGIN \ - --ts_out=generate_package_definition:$TYPES_DESTINATION_DIR \ - --proto_path=$PROTO_DIR \ - $PROTO_DIR/$PROTO_FILENAME +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 + 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." + exit 1 + fi +else + "$NODE_MODULES_DIR/grpc_tools_node_protoc" \ + --js_out=import_style=commonjs,binary:$DESTINATION_DIR \ + --grpc_out=generate_package_definition:$DESTINATION_DIR \ + --proto_path=$PROTO_DIR \ + $PROTO_DIR/$PROTO_FILENAME + "$NODE_MODULES_DIR/grpc_tools_node_protoc" \ + --plugin=protoc-gen-ts=$TS_PROTOC_PLUGIN \ + --ts_out=generate_package_definition:$TYPES_DESTINATION_DIR \ + --proto_path=$PROTO_DIR \ + $PROTO_DIR/$PROTO_FILENAME +fi |
