1#!/usr/bin/env bash 2 3# Install a newer CMake version 4curl -sSL https://cmake.org/files/v3.6/cmake-3.6.1-Linux-x86_64.sh -o install-cmake.sh 5chmod +x install-cmake.sh 6sudo ./install-cmake.sh --prefix=/usr/local --skip-license 7 8# Checkout LLVM sources 9git clone --depth=1 https://github.com/llvm-mirror/llvm.git llvm-source 10git clone --depth=1 https://github.com/llvm-mirror/libcxx.git llvm-source/projects/libcxx 11git clone --depth=1 https://github.com/llvm-mirror/libcxxabi.git llvm-source/projects/libcxxabi 12 13# Setup libc++ options 14if [ -z "$BUILD_32_BITS" ]; then 15 export BUILD_32_BITS=OFF && echo disabling 32 bit build 16fi 17 18# Build and install libc++ (Use unstable ABI for better sanitizer coverage) 19mkdir llvm-build && cd llvm-build 20cmake -DCMAKE_C_COMPILER=${C_COMPILER} -DCMAKE_CXX_COMPILER=${COMPILER} \ 21 -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=/usr \ 22 -DLIBCXX_ABI_UNSTABLE=ON \ 23 -DLLVM_USE_SANITIZER=${LIBCXX_SANITIZER} \ 24 -DLLVM_BUILD_32_BITS=${BUILD_32_BITS} \ 25 ../llvm-source 26make cxx -j2 27sudo make install-cxxabi install-cxx 28cd ../ 29