Skip to content

Commit ba1ee62

Browse files
authored
Install FileCheck for older (apt-based) distros (#770)
- Fixes #593, along with the changes just merged in #767. This installs `FileCheck` for older (`apt`-based) distros so that we can use `FileCheck` in testing without having to disable it anywhere. Notably, we can use `FileCheck` for `c2rust-analyze` tests. These older distros/default LLVM versions require the `llvm-${major}-tools` or `llvm-${major}.${minor}-tools` packages, while newer ones install `FileCheck` automatically, so this adds the installation of the older versions if `FileCheck` is not found in the expected location, `$(llvm-config --bindir)/FileCheck`, using the same `llvm-config` resolution used elsewhere. This changes the docker builds, so we'll need a `./scripts/docker_build.sh push-all`. This also adds an array of packages in the script, which makes adding to it easier, as well as allowing for inline comments (which don't work with `\` line continuation).
2 parents 4020fb9 + 1e80811 commit ba1ee62

File tree

1 file changed

+36
-24
lines changed

1 file changed

+36
-24
lines changed

scripts/provision_deb.sh

Lines changed: 36 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -21,31 +21,43 @@ apt-get install -y --no-install-recommends \
2121
apt-utils \
2222
apt-transport-https \
2323
ca-certificates
24-
# gnupg2: required for gnupg2 key retrieval
25-
# llvm: required for llvm-config
26-
apt-get install -qq \
27-
clang \
28-
cmake \
29-
curl \
30-
dirmngr \
31-
git \
32-
gnupg2 \
33-
gperf \
34-
htop \
35-
libclang-dev \
36-
libssl-dev \
37-
llvm \
38-
ninja-build \
39-
pkg-config \
40-
python-dev \
41-
python3-pip \
42-
python3-setuptools \
43-
software-properties-common \
44-
strace \
45-
unzip \
46-
libncurses5-dev \
47-
luarocks \
24+
25+
packages=(
26+
clang
27+
cmake
28+
curl
29+
dirmngr
30+
git
31+
gnupg2 # required for gnupg2 key retrieval
32+
gperf
33+
htop
34+
libclang-dev
35+
libssl-dev
36+
llvm # required for llvm-config
37+
ninja-build
38+
pkg-config
39+
python-dev
40+
python3-pip
41+
python3-setuptools
42+
software-properties-common
43+
strace
44+
unzip
45+
libncurses5-dev
46+
luarocks
4847
zlib1g-dev
48+
)
49+
50+
if ! [[ -x "$(llvm-config --bindir)/FileCheck" ]]; then
51+
IFS="." read -r major minor patch <<< "$(llvm-config --version)"
52+
if [[ ${major} -gt 6 ]]; then
53+
tools="llvm-${major}-tools"
54+
else
55+
tools="llvm-${major}.${minor}-tools"
56+
fi
57+
packages+=("${tools}")
58+
fi
59+
60+
apt-get install -qq "${packages[@]}"
4961

5062
apt-get clean # clear apt-caches to reduce image size
5163

0 commit comments

Comments
 (0)