forked from google/shadertrap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dev_shell.sh.template
executable file
·147 lines (111 loc) · 3.94 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
#!/usr/bin/env bash
# Copyright 2020 The ShaderTrap 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/libshadertrap/src/shadertrap_program.cc
test -f ./src/.clang-format
test -f ./src/iwyu.imp
SHADERTRAP_REPO_ROOT="$(pwd)"
export SHADERTRAP_REPO_ROOT
# If SHADERTRAP_SKIP_COMPILER_SET is unset:
if test -z ${SHADERTRAP_SKIP_COMPILER_SET+x}; then
export CC=clang-11
export CXX=clang++-11
fi
cd temp/
# Get clang-11, clang-format-11, clang-tidy-11.
CLANG_FILE="clang+llvm-11.0.1-x86_64-linux-gnu-ubuntu-16.04.tar.xz"
CLANG_URL="https://github.com/llvm/llvm-project/releases/download/llvmorg-11.0.1/clang+llvm-11.0.1-x86_64-linux-gnu-ubuntu-16.04.tar.xz"
CLANG_OUT="${CLANG_FILE%.tar.xz}"
if test ! -f "${CLANG_FILE}.touch"; then
curl -sSLo "${CLANG_FILE}" "${CLANG_URL}"
tar xf "${CLANG_FILE}"
# Make some *-11 symlinks.
ln -s clang++ "${CLANG_OUT}/bin/clang++-11"
ln -s clang-format "${CLANG_OUT}/bin/clang-format-11"
ln -s clang-tidy "${CLANG_OUT}/bin/clang-tidy-11"
touch "${CLANG_FILE}.touch"
rm "${CLANG_FILE}"
fi
PATH="$(pwd)/${CLANG_OUT}/bin:${PATH}"
export PATH
# Get cppcheck.
CPPCHECK_OUT="cppcheck-2.4.1"
if test ! -f "${CPPCHECK_OUT}.touch"; then
git clone --branch 2.4.1 --depth 1 https://github.com/danmar/cppcheck.git "${CPPCHECK_OUT}"
pushd "${CPPCHECK_OUT}"
# TODO(https://github.com/google/shadertrap/issues/52) Get rid of this patch in due course
git apply ${SHADERTRAP_REPO_ROOT}/temp/cppcheck.patch
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_OUT="cpplint-1.5.1"
if test ! -f "${CPPLINT_OUT}.touch"; then
git clone --branch 1.5.1 --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_OUT="iwyu-0.15"
if test ! -f "${IWYU_OUT}.touch"; then
git clone --branch 0.15 --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_OUT}"
cmake --build . --config Release
cmake -P cmake_install.cmake --config Release
popd
popd
touch "${IWYU_OUT}.touch"
fi
# iwyu is installed alongside clang.
# Get Android NDK.
# If SHADERTRAP_SKIP_ANDROID_NDK is unset:
if test -z ${SHADERTRAP_SKIP_ANDROID_NDK+x}; then
ANDROID_NDK_FILENAME="android-ndk-r21-linux-x86_64.zip"
ANDROID_NDK_OUT="android-ndk-r21"
if test ! -f "${ANDROID_NDK_OUT}.touch"; then
curl -sSLo "${ANDROID_NDK_FILENAME}" "https://dl.google.com/android/repository/${ANDROID_NDK_FILENAME}"
unzip -q "${ANDROID_NDK_FILENAME}"
rm "${ANDROID_NDK_FILENAME}"
test -d "${ANDROID_NDK_OUT}"
touch "${ANDROID_NDK_OUT}.touch"
fi
ANDROID_NDK_ROOT="$(pwd)/${ANDROID_NDK_OUT}"
export ANDROID_NDK_ROOT
fi
cd "${SHADERTRAP_REPO_ROOT}"
PATH="${SHADERTRAP_REPO_ROOT}/scripts:${PATH}"
export PATH
# If SHADERTRAP_SKIP_BASH is unset:
if test -z ${SHADERTRAP_SKIP_BASH+x}; then
bash
fi