Adding support for Linux s390x

We have added support for Linux s390x platform in Bazel.


Closes #1891.

--
Reviewed-on: https://github.com/bazelbuild/bazel/pull/1891
MOS_MIGRATED_REVID=135777047
diff --git a/scripts/bootstrap/buildenv.sh b/scripts/bootstrap/buildenv.sh
index 4a94687..8345dc3 100755
--- a/scripts/bootstrap/buildenv.sh
+++ b/scripts/bootstrap/buildenv.sh
@@ -40,7 +40,7 @@
 
 MACHINE_TYPE="$(uname -m)"
 MACHINE_IS_64BIT='no'
-if [ "${MACHINE_TYPE}" = 'amd64' -o "${MACHINE_TYPE}" = 'x86_64' ]; then
+if [ "${MACHINE_TYPE}" = 'amd64' -o "${MACHINE_TYPE}" = 'x86_64' -o "${MACHINE_TYPE}" = 's390x' ]; then
   MACHINE_IS_64BIT='yes'
 fi
 
@@ -49,6 +49,11 @@
   MACHINE_IS_ARM='yes'
 fi
 
+MACHINE_IS_Z='no'
+if [ "${MACHINE_TYPE}" = 's390x' ]; then
+  MACHINE_IS_Z='yes'
+fi
+
 # Extension for executables.
 EXE_EXT=""
 case "${PLATFORM}" in
diff --git a/scripts/bootstrap/compile.sh b/scripts/bootstrap/compile.sh
index f4939c1..123d050 100755
--- a/scripts/bootstrap/compile.sh
+++ b/scripts/bootstrap/compile.sh
@@ -43,8 +43,13 @@
   # JAVA_HOME must point to a Java installation.
   JAVA_HOME="${JAVA_HOME:-$(readlink -f $(which javac) | sed 's_/bin/javac__')}"
   if [ "${MACHINE_IS_64BIT}" = 'yes' ]; then
-    PROTOC=${PROTOC:-third_party/protobuf/protoc-linux-x86_64.exe}
-    GRPC_JAVA_PLUGIN=${GRPC_JAVA_PLUGIN:-third_party/grpc/protoc-gen-grpc-java-0.15.0-linux-x86_64.exe}
+    if [ "${MACHINE_IS_Z}" = 'yes' ]; then
+       PROTOC=${PROTOC:-third_party/protobuf/protoc-linux-s390x_64.exe}
+       GRPC_JAVA_PLUGIN=${GRPC_JAVA_PLUGIN:-third_party/grpc/protoc-gen-grpc-java-0.15.0-linux-s390x_64.exe}
+    else
+       PROTOC=${PROTOC:-third_party/protobuf/protoc-linux-x86_64.exe}
+       GRPC_JAVA_PLUGIN=${GRPC_JAVA_PLUGIN:-third_party/grpc/protoc-gen-grpc-java-0.15.0-linux-x86_64.exe}
+    fi
   else
     if [ "${MACHINE_IS_ARM}" = 'yes' ]; then
       PROTOC=${PROTOC:-third_party/protobuf/protoc-linux-arm32.exe}