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

- Remove 'USE_QT6' config option, which is now obsolete since support for
  building with Qt5 is gone.

- Build with Boost for improved performance (see [1]).

- Auto detection of whether backtrace-related functions provided by 'execinfo.h'
  are available is broken on musl builds due to [2] and wrongly assumes that the
  header file exists. Work around this by explicitly disabling backtrace support
  via NO_UNIX_BACKTRACE_SUPPORT.

- Disable tests that fail on 32-bit platforms on those. Upstream doesn't have
  32-bit builds in CI, so it's unclear when/if they get fixed (see [3]).

[0]: https://github.com/danmar/cppcheck/releases/tag/2.19.0
[1]: https://github.com/danmar/cppcheck/blob/2.19.0/TUNING.md#use-boost
[2]: 23c3aa30b9
[3]: https://sourceforge.net/p/cppcheck/discussion/development/thread/e46c73e930/?limit=25#5760
2025-12-29 08:08:48 +00:00

97 lines
3.0 KiB
Plaintext

# Contributor: August Klein <amatcoder@gmail.com>
# Maintainer: André Klitzing <aklitzing@gmail.com>
pkgname=cppcheck
pkgver=2.19.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_TESTS="$(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="
50c628788b646798dc58a7d2e6ac5b02c97d57b3a98fd60653b8a5f55aa3b3ee8cecc5c7f4f6066fdbca3fbc2de982811c458b7c58b2c27b99f2b6d3b71d1876 cppcheck-2.19.0.tar.gz
25bc3a2ab30ddf220230a194ce1e0f867cb7a67b3e47b1ff7a00b1ed5b93ba15376b5ee8fe882842c476fb0c20454430db73d22d97e5b2f84041844487fc465b 0001-gui-Set-default-DATADIR-and-language.patch
c8347a0817be0fa9faacc59fef88f750b683cf85afd839d0082c17f9ae7038aa742356c64ba79d0f9e6123c1c1f29c777b568ccfc8f09926f1396e48ea2995f8 0002-test-signal-Remove-usage-of-feenableexcept.patch
"