-
Notifications
You must be signed in to change notification settings - Fork 3
/
dev_shell.sh.template
executable file
·112 lines (88 loc) · 2.89 KB
/
dev_shell.sh.template
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#!/usr/bin/env bash
# Copyright 2022 The Dredd Project Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -e
set -u
set -x
# Check that it looks like we are in the repo root.
test -f ./src/dredd/src/main.cc
test -f ./src/.clang-format
test -f ./src/iwyu.imp
DREDD_REPO_ROOT="$(pwd)"
export DREDD_REPO_ROOT
# Check that the Clang/LLVM release has been downloaded.
CLANG_RELEASE="${DREDD_REPO_ROOT}/third_party/clang+llvm"
test -f ${CLANG_RELEASE}/bin/clang++
# If DREDD_SKIP_COMPILER_SET is unset:
if test -z ${DREDD_SKIP_COMPILER_SET+x}; then
export CC=clang
export CXX=clang++
fi
# Ensure that the downloaded Clang/LLVM release is on the path
PATH="${CLANG_RELEASE}/bin:${PATH}"
export PATH
cd temp/
# Get cppcheck.
CPPCHECK_VERSION="2.14.2"
CPPCHECK_OUT="cppcheck-${CPPCHECK_VERSION}"
if test ! -f "${CPPCHECK_OUT}.touch"; then
git clone --branch ${CPPCHECK_VERSION} --depth 1 https://github.com/danmar/cppcheck.git "${CPPCHECK_OUT}"
pushd "${CPPCHECK_OUT}"
mkdir build
pushd build
cmake -G Ninja .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=./install
cmake --build . --config Release
cmake -P cmake_install.cmake --config Release
popd
popd
touch "${CPPCHECK_OUT}.touch"
fi
PATH="$(pwd)/${CPPCHECK_OUT}/build/install/bin:${PATH}"
export PATH
# Get cpplint.
CPPLINT_VERSION="1.6.1"
CPPLINT_OUT="cpplint-${CPPLINT_VERSION}"
if test ! -f "${CPPLINT_OUT}.touch"; then
git clone --branch ${CPPLINT_VERSION} --depth 1 https://github.com/cpplint/cpplint.git "${CPPLINT_OUT}"
pushd "${CPPLINT_OUT}"
# No build step.
popd
touch "${CPPLINT_OUT}.touch"
fi
CPPLINT_PY="$(pwd)/${CPPLINT_OUT}/cpplint.py"
export CPPLINT_PY
# Get include what you use.
IWYU_VERSION="0.21"
IWYU_OUT="iwyu-${IWYU_VERSION}"
if test ! -f "${IWYU_OUT}.touch"; then
git clone --branch ${IWYU_VERSION} --depth 1 https://github.com/include-what-you-use/include-what-you-use.git "${IWYU_OUT}"
pushd "${IWYU_OUT}"
mkdir build
pushd build
cmake -G Ninja .. -DCMAKE_BUILD_TYPE=Release "-DCMAKE_INSTALL_PREFIX=${CLANG_RELEASE}"
cmake --build . --config Release
cmake -P cmake_install.cmake --config Release
popd
popd
touch "${IWYU_OUT}.touch"
fi
PATH="$(pwd)/${IWYU_OUT}/build/install/bin:${PATH}"
export PATH
cd "${DREDD_REPO_ROOT}"
PATH="${DREDD_REPO_ROOT}/scripts:${PATH}"
export PATH
# If DREDD_SKIP_BASH is unset:
if test -z ${DREDD_SKIP_BASH+x}; then
bash
fi