Moritz Haase 2a7abfb03b community/cppcheck: upgrade to 2.20.0
Update to the latest upstream release. Release notes are available at [0].

- Use the standard 'BUILD_TESTING' option to en-/disable tests, as the
  non-standard 'BUILD_TEST' has been deprecated and will be removed in 2.22.

[0]: https://github.com/danmar/cppcheck/releases/tag/2.20.0
2026-03-03 10:07:50 +00:00

97 lines
3.0 KiB
Plaintext

# Contributor: August Klein <amatcoder@gmail.com>
# Maintainer: André Klitzing <aklitzing@gmail.com>
pkgname=cppcheck
pkgver=2.20.0
pkgrel=0
pkgdesc="Static analysis tool for C/C++ code"
url="https://cppcheck.sourceforge.io/"
arch="all"
license="GPL-3.0-or-later"
makedepends="
boost-dev
cmake
docbook-xsl
pcre-dev
python3
samurai
tinyxml2-dev
"
subpackages="$pkgname-doc $pkgname-htmlreport::noarch"
source="$pkgname-$pkgver.tar.gz::https://github.com/danmar/cppcheck/archive/refs/tags/$pkgver.tar.gz
0001-gui-Set-default-DATADIR-and-language.patch
0002-test-signal-Remove-usage-of-feenableexcept.patch
"
case "$CARCH" in
armhf) ;; # qt6-qtdeclarative
*)
makedepends="$makedepends qt6-qtcharts-dev qt6-qttools-dev"
subpackages="$subpackages $pkgname-gui"
_opts="-DBUILD_GUI=ON -DWITH_QCHART=ON"
;;
esac
build() {
make DB2MAN=/usr/share/xml/docbook/xsl-stylesheets-*/manpages/docbook.xsl man
cmake -B build -G Ninja \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_BUILD_TYPE=MinSizeRel \
-DBUILD_TESTING="$(want_check && echo ON || echo OFF)" \
-DFILESDIR=/usr/share/cppcheck \
-DHAVE_RULES=ON \
-DUSE_BUNDLED_TINYXML2=OFF \
-DUSE_MATCHCOMPILER=ON \
-DUSE_BOOST=ON \
-DNO_UNIX_BACKTRACE_SUPPORT=ON \
$_opts
cmake --build build
}
check() {
_excluded_tests=""
case "$CARCH" in
# A few tests are known to fail on 32-bit architectures, so we don't run them.
# See https://sourceforge.net/p/cppcheck/discussion/development/thread/e46c73e930/?limit=25#5760
armhf|armv7|x86)
_excluded_tests="^(Test64BitPortability|TestCondition)$"
;;
esac
# The tests are pretty brittle when it comes to running them in parallel. Some create temporary files in the
# same (base) directory, others access those files and/or fail when they suddenly disappear. As a workaround,
# run them sequentially.
ctest -E "$_excluded_tests" -j 1 --test-dir build
}
package() {
DESTDIR="$pkgdir" cmake --install build
install -Dm644 cppcheck.1 -t "$pkgdir"/usr/share/man/man1
install -Dm755 htmlreport/cppcheck-htmlreport -t "$pkgdir"/usr/bin
}
htmlreport() {
pkgdesc="Utility to generate a html report of a XML file produced by cppcheck"
depends="$pkgname=$pkgver-r$pkgrel python3 py3-pygments"
amove usr/bin/cppcheck-htmlreport
}
gui() {
pkgdesc="Qt gui for cppcheck"
depends="$pkgname=$pkgver-r$pkgrel"
amove usr/bin/cppcheck-gui
amove usr/share/icons
amove usr/share/applications
mkdir -p "$subpkgdir"/usr/share/cppcheck/lang
mv "$pkgdir"/usr/bin/cppcheck*.qm "$subpkgdir"/usr/share/cppcheck/lang
}
sha512sums="
072179cf35f91708735a85966517b5788554c32443558865af64d782cfc082acd073219ab511f5e2f98bd8f1dc8c0d02447452a00f15524eda2ca20be6af8108 cppcheck-2.20.0.tar.gz
25bc3a2ab30ddf220230a194ce1e0f867cb7a67b3e47b1ff7a00b1ed5b93ba15376b5ee8fe882842c476fb0c20454430db73d22d97e5b2f84041844487fc465b 0001-gui-Set-default-DATADIR-and-language.patch
c8347a0817be0fa9faacc59fef88f750b683cf85afd839d0082c17f9ae7038aa742356c64ba79d0f9e6123c1c1f29c777b568ccfc8f09926f1396e48ea2995f8 0002-test-signal-Remove-usage-of-feenableexcept.patch
"