2023-09-21 22:46:18 +00:00

85 lines
2.4 KiB
Plaintext

# Contributor: August Klein <amatcoder@gmail.com>
# Maintainer: André Klitzing <aklitzing@gmail.com>
pkgname=cppcheck
pkgver=2.12.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="
b9779317d55ed7582344bdf0fedad17aa8a070452c9583836590cd5617f406fa2ec7896529d06b393e4d1f18f863aa687f2cc33ca0bd2ac727e888485acf3264 cppcheck-2.12.1.tar.gz
deead176705825da12796e42ea5f4a9dfb6dfa0c816057862b41d9f8f3121c4272d0bbf98ddea88c2e63e0504ff0cf603cd5b082e6e6cf41403f2ba0377ebc2e set_datadir.patch
"