1# syntax=docker/dockerfile:1
2FROM --platform=linux/arm64/v8 debian:bookworm AS builder
3
4ENV DEBIAN_FRONTEND=noninteractive
5ENV CPPCHECK_VERSION=2.7
6ENV USER root
7
8# dependencies for cppcheck build
9RUN apt-get update && \
10    apt-get --quiet --yes install \
11        curl \
12        build-essential \
13        python-is-python3 \
14        libpcre3-dev
15
16RUN mkdir /build
17WORKDIR /build
18
19# cppcheck release build (see cppcheck readme.md)
20RUN curl -fsSLO https://github.com/danmar/cppcheck/archive/"$CPPCHECK_VERSION".tar.gz && \
21    tar xvzf "$CPPCHECK_VERSION".tar.gz && \
22    cd cppcheck-"$CPPCHECK_VERSION" && \
23    make install -j$(nproc) \
24        MATCHCOMPILER=yes \
25        FILESDIR=/usr/share/cppcheck \
26        HAVE_RULES=yes CXXFLAGS="-O2 -DNDEBUG -Wall -Wno-sign-compare -Wno-unused-function"
27
28FROM --platform=linux/arm64/v8 debian:bookworm
29COPY --from=builder /usr/bin/cppcheck /usr/bin/cppcheck
30COPY --from=builder /usr/share/cppcheck /usr/share/cppcheck
31
32LABEL maintainer.name="The Xen Project" \
33      maintainer.email="xen-devel@lists.xenproject.org"
34
35ENV DEBIAN_FRONTEND=noninteractive
36ENV USER root
37
38RUN mkdir /build
39WORKDIR /build
40
41# dependencies for cppcheck analysis including Xen-only build/cross-build
42RUN apt-get update && \
43    apt-get --quiet --yes install \
44        build-essential \
45        python-is-python3 \
46        libpcre3-dev \
47        flex \
48        bison \
49        gcc-arm-linux-gnueabihf \
50        gcc-x86-64-linux-gnu \
51        && \
52        apt-get autoremove -y && \
53        apt-get clean && \
54        rm -rf /var/lib/apt/lists* /tmp/* /var/tmp/*
55