# Contributor: August Klein # Maintainer: André Klitzing pkgname=cppcheck pkgver=2.11.1 pkgrel=0 pkgdesc="Static analysis tool for C/C++ code" url="https://cppcheck.sourceforge.io/" # riscv64 broken, "Could not find qmake spec 'default'." arch="all !riscv64" license="GPL-3.0-or-later" makedepends=" cmake docbook-xsl pcre-dev python3 qt6-qtcharts-dev qt6-qttools-dev samurai tinyxml2-dev " subpackages="$pkgname-doc $pkgname-htmlreport::noarch $pkgname-gui" source="$pkgname-$pkgver.tar.gz::https://github.com/danmar/cppcheck/archive/refs/tags/$pkgver.tar.gz set_datadir.patch " 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_GUI=ON \ -DBUILD_TESTS="$(want_check && echo ON || echo OFF)" \ -DFILESDIR=/usr/share/cppcheck \ -DHAVE_RULES=ON \ -DUSE_BUNDLED_TINYXML2=OFF \ -DUSE_MATCHCOMPILER=ON \ -DUSE_QT6=ON \ -DWITH_QCHART=ON cmake --build build } check() { # fails outside of x86 with: # Expected: # [test.cpp:5]: (style) Condition 'buffer.back()=='\0'' is always false\n # Actual: # [test.cpp:3] -> [test.cpp:5]: (style) Condition 'buffer.back()=='\0'' is always false\n # TestThreadExecutor: flaky result ctest -E "(TestCondition|TestThreadExecutor)" --test-dir build --output-on-failure } 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 mkdir -p "$pkgdir"/usr/share/cppcheck/lang mv "$pkgdir"/usr/bin/cppcheck*.qm "$pkgdir"/usr/share/cppcheck/lang } 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/cppcheck/lang amove usr/share/icons amove usr/share/applications } sha512sums=" 62ca46a960981e1616263c2ecb310df555299dfd8a15fadac9b2d053cf128ec0514b37b111dbb80b4c2cf3bbf3912e224d59ab2f027af60635147b149cd9af32 cppcheck-2.11.1.tar.gz deead176705825da12796e42ea5f4a9dfb6dfa0c816057862b41d9f8f3121c4272d0bbf98ddea88c2e63e0504ff0cf603cd5b082e6e6cf41403f2ba0377ebc2e set_datadir.patch "