2025-09-03 20:52:41 +02:00

88 lines
2.9 KiB
Plaintext

# Contributor: August Klein <amatcoder@gmail.com>
# Maintainer: André Klitzing <aklitzing@gmail.com>
pkgname=cppcheck
pkgver=2.18.3
pkgrel=0
pkgdesc="Static analysis tool for C/C++ code"
url="https://cppcheck.sourceforge.io/"
arch="all"
license="GPL-3.0-or-later"
makedepends="
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
0003-Fix-expected-output-in-TestCondition-alwaysTrue-and-.patch
"
case "$CARCH" in
armhf) ;; # qt6-qtdeclarative
*)
makedepends="$makedepends qt6-qtcharts-dev qt6-qttools-dev"
subpackages="$subpackages $pkgname-gui"
_opts="-DBUILD_GUI=ON -DUSE_QT6=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 \
$_opts
cmake --build build
}
check() {
# 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 -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="
588a715fbd71ce75b36f4c171d7465c02ebbb15ef8ccab04529c2cb374f7c3d6aac0f2fe58e92ffb850295415db7ce920f8245d41e2fec5bd508ed5e3b75fbfd cppcheck-2.18.3.tar.gz
25bc3a2ab30ddf220230a194ce1e0f867cb7a67b3e47b1ff7a00b1ed5b93ba15376b5ee8fe882842c476fb0c20454430db73d22d97e5b2f84041844487fc465b 0001-gui-Set-default-DATADIR-and-language.patch
c8347a0817be0fa9faacc59fef88f750b683cf85afd839d0082c17f9ae7038aa742356c64ba79d0f9e6123c1c1f29c777b568ccfc8f09926f1396e48ea2995f8 0002-test-signal-Remove-usage-of-feenableexcept.patch
2be5ebfce28f32237a167b41831f32be77ae17122da166ff6a92cfe5176f79ca1276136e3b9dccaafb4362f049b1ec9b4ab2b8f4709b5450d4b3a592c5cd120a 0003-Fix-expected-output-in-TestCondition-alwaysTrue-and-.patch
"