1
0
mirror of https://github.com/skeeto/w64devkit.git synced 2025-07-30 04:03:05 +03:00

Add the Cppcheck command line program

Cppcheck is a static analysis tool that's pretty easy to build and
include. Its "addons" are excluded since they depend on Python, as are
the "platforms" configuration since none of them are useful for Windows
applications. The "win32A" and "win32W" platforms are already embedded
within the tool.

It has a "FILESDIR" option to locate its configuration data. Relative
paths are unsupported, and so this feature is useless for a "portable"
Windows application. Fortunately it searches next to the executable, so
it can still find its configuration as long as it resides in the same
directory. These should not be in bin/, so build an alias to redirect
execution into share/.

This is yet another open source project that does not publish a stable
source tarball, so this build is likely to fail in the future when
GitHub changes its tarball layout. The --remote-header-name curl option
tells it to pick up the GitHub-provided name rather than use the request
path. Fortunately this doesn't seem to interfere with other downloads.
This commit is contained in:
Christopher Wellons
2022-07-07 21:07:34 -04:00
parent 4282797c5e
commit b854d363b9
3 changed files with 41 additions and 3 deletions

View File

@ -14,6 +14,7 @@ ARG MINGW_VERSION=10.0.0
ARG MPC_VERSION=1.2.1
ARG MPFR_VERSION=4.1.0
ARG NASM_VERSION=2.15.05
ARG CPPCHECK_VERSION=2.8
ARG VIM_VERSION=9.0
RUN apt-get update && apt-get install --yes --no-install-recommends \
@ -21,7 +22,7 @@ RUN apt-get update && apt-get install --yes --no-install-recommends \
# Download, verify, and unpack
RUN curl --insecure --location --remote-name-all \
RUN curl --insecure --location --remote-name-all --remote-header-name \
https://ftp.gnu.org/gnu/binutils/binutils-$BINUTILS_VERSION.tar.xz \
https://ftp.gnu.org/gnu/gcc/gcc-$GCC_VERSION/gcc-$GCC_VERSION.tar.xz \
https://ftp.gnu.org/gnu/gdb/gdb-$GDB_VERSION.tar.xz \
@ -34,7 +35,8 @@ RUN curl --insecure --location --remote-name-all \
http://ftp.vim.org/pub/vim/unix/vim-$VIM_VERSION.tar.bz2 \
https://www.nasm.us/pub/nasm/releasebuilds/$NASM_VERSION/nasm-$NASM_VERSION.tar.xz \
http://deb.debian.org/debian/pool/main/u/universal-ctags/universal-ctags_0+git$CTAGS_VERSION.orig.tar.gz \
https://downloads.sourceforge.net/project/mingw-w64/mingw-w64/mingw-w64-release/mingw-w64-v$MINGW_VERSION.tar.bz2
https://downloads.sourceforge.net/project/mingw-w64/mingw-w64/mingw-w64-release/mingw-w64-v$MINGW_VERSION.tar.bz2 \
https://github.com/danmar/cppcheck/archive/$CPPCHECK_VERSION.tar.gz
COPY src/SHA256SUMS $PREFIX/src/
RUN sha256sum -c $PREFIX/src/SHA256SUMS \
&& tar xJf binutils-$BINUTILS_VERSION.tar.xz \
@ -49,7 +51,8 @@ RUN sha256sum -c $PREFIX/src/SHA256SUMS \
&& tar xzf make-$MAKE_VERSION.tar.gz \
&& tar xjf mingw-w64-v$MINGW_VERSION.tar.bz2 \
&& tar xJf nasm-$NASM_VERSION.tar.xz \
&& tar xjf vim-$VIM_VERSION.tar.bz2
&& tar xjf vim-$VIM_VERSION.tar.bz2 \
&& tar xzf cppcheck-$CPPCHECK_VERSION.tar.gz
COPY src/w64devkit.c src/w64devkit.ico src/alias.c src/debugbreak.c \
$PREFIX/src/
@ -413,6 +416,20 @@ RUN sed -i /RT_MANIFEST/d win32/ctags.rc \
OPT= CFLAGS=-Os LDFLAGS=-s \
&& cp ctags.exe $PREFIX/bin/
WORKDIR /cppcheck-$CPPCHECK_VERSION
RUN $ARCH-g++ -Os -s -o cppcheck.exe \
-Ilib -Iexternals/simplecpp -Iexternals/tinyxml2 -Iexternals/picojson \
cli/*.cpp lib/*.cpp \
externals/tinyxml2/tinyxml2.cpp externals/simplecpp/simplecpp.cpp \
-lshlwapi \
&& mkdir $PREFIX/share/cppcheck/ \
&& cp -r cppcheck.exe cfg/ $PREFIX/share/cppcheck \
&& $ARCH-gcc -DEXE=../share/cppcheck/cppcheck.exe -DCMD=cppcheck \
-Os -ffreestanding -fno-ident -fno-asynchronous-unwind-tables \
-s -nostdlib \
-o $PREFIX/bin/cppcheck.exe \
$PREFIX/src/alias.c -lkernel32
# Pack up a release
WORKDIR /