# Contributor: August Klein # Maintainer: André Klitzing pkgname=cppcheck pkgver=2.20.1 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=" 1debb9f8901427f2ec08fe42493ddabcff365d5b1fa36a92a872f3e8f662e921e0ee1158ff2c43ff5d85e67e56a44b97236ecf12ecc1e4df0d1075e4736e4f8d cppcheck-2.20.1.tar.gz 25bc3a2ab30ddf220230a194ce1e0f867cb7a67b3e47b1ff7a00b1ed5b93ba15376b5ee8fe882842c476fb0c20454430db73d22d97e5b2f84041844487fc465b 0001-gui-Set-default-DATADIR-and-language.patch c8347a0817be0fa9faacc59fef88f750b683cf85afd839d0082c17f9ae7038aa742356c64ba79d0f9e6123c1c1f29c777b568ccfc8f09926f1396e48ea2995f8 0002-test-signal-Remove-usage-of-feenableexcept.patch "