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