1#!/usr/bin/env bash 2# Copyright 2018 The TensorFlow Authors. All Rights Reserved. 3# 4# Licensed under the Apache License, Version 2.0 (the "License"); 5# you may not use this file except in compliance with the License. 6# You may obtain a copy of the License at 7# 8# http://www.apache.org/licenses/LICENSE-2.0 9# 10# Unless required by applicable law or agreed to in writing, software 11# distributed under the License is distributed on an "AS IS" BASIS, 12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13# See the License for the specific language governing permissions and 14# limitations under the License. 15# ============================================================================== 16 17# This script is to be used to install bzel on non x86_64 systems 18# It will compile bazel from source and install it in /usr/local/bin 19 20# Select bazel version. 21BAZEL_VERSION="3.7.2" 22 23set +e 24local_bazel_ver=$(bazel version 2>&1 | grep -i label | awk '{print $3}') 25 26if [[ "$local_bazel_ver" == "$BAZEL_VERSION" ]]; then 27 exit 0 28fi 29 30set -e 31 32# Compile bazel from source 33mkdir -p /bazel 34cd /bazel 35 36curl -fSsL -O https://github.com/bazelbuild/bazel/releases/download/$BAZEL_VERSION/bazel-$BAZEL_VERSION-dist.zip 37unzip bazel-$BAZEL_VERSION-dist.zip 38env EXTRA_BAZEL_ARGS="--host_javabase=@local_jdk//:jdk" bash ./compile.sh 39cp output/bazel /usr/local/bin/ 40rm -rf /bazel 41