|
| 1 | +version: 2 |
| 2 | +jobs: |
| 3 | + build: |
| 4 | + docker: |
| 5 | + - image: ubuntu:14.04 |
| 6 | + steps: |
| 7 | + - run: |
| 8 | + name: Install basic dependencies |
| 9 | + command: | |
| 10 | + export DEBIAN_FRONTEND=noninteractive |
| 11 | + apt-get -y update |
| 12 | + apt-get -yq install software-properties-common |
| 13 | + add-apt-repository -y ppa:ubuntu-toolchain-r/test |
| 14 | + apt-get -y update |
| 15 | + apt-get -yq install curl git-core g++-6 binutils-dev ninja-build |
| 16 | + echo "export CC=gcc-6" >> $BASH_ENV |
| 17 | + echo "export CXX=g++-6" >> $BASH_ENV |
| 18 | + - checkout |
| 19 | + - run: |
| 20 | + name: Checkout git submodules |
| 21 | + command: git submodule update --init --recursive |
| 22 | + - run: |
| 23 | + name: Install CMake |
| 24 | + command: | |
| 25 | + curl -L -o cmake-x64.tar.gz https://cmake.org/files/v3.10/cmake-3.10.0-Linux-x86_64.tar.gz |
| 26 | + mkdir cmake-x64 |
| 27 | + tar -xf cmake-x64.tar.gz --strip 1 -C cmake-x64 |
| 28 | + echo "export PATH=$PWD/cmake-x64/bin:$PATH" >> $BASH_ENV |
| 29 | + - run: |
| 30 | + name: Build LLVM |
| 31 | + command: | |
| 32 | + ninja --version |
| 33 | + cmake --version |
| 34 | + mkdir ninja-llvm |
| 35 | + cd ninja-llvm |
| 36 | + cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$(dirname $PWD)/llvm-x64 -DLLVM_TARGETS_TO_BUILD="X86;AArch64;ARM;PowerPC;NVPTX" -DLLVM_BINUTILS_INCDIR=/usr/include -DCMAKE_CXX_FLAGS=-static-libstdc++ .. |
| 37 | + ninja -j3 install |
| 38 | + cd .. |
| 39 | + - run: |
| 40 | + name: Build compiler-rt & libFuzzer |
| 41 | + command: | |
| 42 | + export LLVM_VERSION=$(llvm-x64/bin/llvm-config --version) |
| 43 | + export LLVM_VERSION=${LLVM_VERSION:0:5} |
| 44 | + echo "$LLVM_VERSION" |
| 45 | + # Download & extract compiler-rt |
| 46 | + curl -L -o compiler-rt.src.tar.xz http://releases.llvm.org/$LLVM_VERSION/compiler-rt-$LLVM_VERSION.src.tar.xz |
| 47 | + mkdir compiler-rt |
| 48 | + tar -xpf compiler-rt.src.tar.xz --strip 1 -C compiler-rt |
| 49 | + # Build compiler-rt |
| 50 | + mkdir ninja-compiler-rt |
| 51 | + cd ninja-compiler-rt |
| 52 | + cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$(dirname $PWD)/llvm-x64/lib/clang/$LLVM_VERSION -DLLVM_CONFIG_PATH=$(dirname $PWD)/llvm-x64/bin/llvm-config ../compiler-rt |
| 53 | + ninja -j3 install |
| 54 | + cd .. |
| 55 | + # Build libFuzzer |
| 56 | + cd lib/Fuzzer |
| 57 | + ./build.sh |
| 58 | + cd ../.. |
| 59 | + cp lib/Fuzzer/libFuzzer.a llvm-x64/lib |
| 60 | + - run: |
| 61 | + name: Pack installation dir |
| 62 | + command: | |
| 63 | + cd llvm-x64 |
| 64 | + tar -cJf ../llvm-${CIRCLE_SHA1}-linux-x86_64.tar.xz * |
| 65 | + cd .. |
| 66 | + - store_artifacts: |
| 67 | + path: llvm-${CIRCLE_SHA1}-linux-x86_64.tar.xz |
| 68 | + - run: |
| 69 | + name: Deploy to GitHub CI release |
| 70 | + command: | |
| 71 | + curl -L -o github-release.tar.bz2 https://github.com/aktau/github-release/releases/download/v0.7.2/linux-amd64-github-release.tar.bz2 |
| 72 | + tar -xf github-release.tar.bz2 --strip 3 |
| 73 | + # Note: needs GITHUB_TOKEN environment variable |
| 74 | + ./github-release upload --user ldc-developers --repo llvm --tag CI --name llvm-${CIRCLE_SHA1}-linux-x86_64.tar.xz --file llvm-${CIRCLE_SHA1}-linux-x86_64.tar.xz --description 'built on $(date "+%Y%m%d")' |
0 commit comments