summaryrefslogtreecommitdiffstats
path: root/.gitlab/ci/docker/debian10/install_iwyu.sh
blob: 260570e8ecf0d0842c82005d1d9bc3d2c59941f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/sh

set -e

# Install development tools.
apt-get update
apt-get install -y \
    clang-6.0 \
    libclang-6.0-dev \
    llvm-6.0-dev \
    libz-dev \
    g++ \
    cmake \
    ninja-build \
    git

cd /root
git clone "https://github.com/include-what-you-use/include-what-you-use.git"
cd include-what-you-use
readonly llvm_version="$( clang-6.0 --version | head -n1 | cut -d' ' -f3 | cut -d. -f-2 )"
git checkout "clang_$llvm_version"
mkdir build
cd build

cmake -GNinja \
    -DCMAKE_BUILD_TYPE=Release \
    "-DCMAKE_INSTALL_PREFIX=/usr/lib/llvm-$llvm_version" \
    "-DIWYU_LLVM_ROOT_PATH=/usr/lib/llvm-$llvm_version" \
    ..
ninja
DESTDIR=/root/iwyu-destdir ninja install
tar -C /root/iwyu-destdir -cf /root/iwyu.tar .