blob: a32d327062f44da52e3f7bc68b90811a9063e88e [file] [log] [blame]
#!/bin/sh
# Copyright 2022 The Cobalt Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -e
CLANG_VERSION="${1:-365097-f7e52fbd-8}"
TOOLCHAIN_ROOT="${HOME}/starboard-toolchains/"
TOOLCHAIN_HOME="${TOOLCHAIN_ROOT}/x86_64-linux-gnu-clang-chromium-${CLANG_VERSION}"
if [ -d "${TOOLCHAIN_HOME}" ]; then
echo "Clang is already downloaded, exiting."
exit 0
fi
BASE_URL="https://commondatastorage.googleapis.com/chromium-browser-clang"
cd /tmp
mkdir -p ${TOOLCHAIN_HOME}
curl --silent -O -J ${BASE_URL}/Linux_x64/clang-${CLANG_VERSION}.tgz
tar xf clang-${CLANG_VERSION}.tgz -C ${TOOLCHAIN_HOME}
echo ${CLANG_VERSION} >> ${TOOLCHAIN_HOME}/cr_build_revision
rm clang-${CLANG_VERSION}.tgz
echo "Downloaded clang."