#!/bin/bash

install_version=${1:-"8.0.0"}
package_name="clang+llvm-${install_version}"

# Download and install
cd /tmp
rm -f ${package_name}-x86_64-linux-gnu-ubuntu-16.04.tar.xz
wget https://tools.mindspore.cn/tools/build/llvm/${package_name}/${package_name}-x86_64-linux-gnu-ubuntu-16.04.tar.xz
rm -rf ${package_name}-x86_64-linux-gnu-ubuntu-16.04
tar -xf ${package_name}-x86_64-linux-gnu-ubuntu-16.04.tar.xz
rm -rf /usr/local/llvm
mv /tmp/${package_name}-x86_64-linux-gnu-ubuntu-16.04 /usr/local/llvm

# Delete package
rm -f /tmp/${package_name}-x86_64-linux-gnu-ubuntu-16.04.tar.xz
