PKGBUILDs/community/cppcheck/PKGBUILD

74 lines
2.4 KiB
Bash
Raw Normal View History

2020-02-26 04:34:21 +00:00
# Maintainer: Jelle van der Waa <jelle@archlinux.org>
2020-06-07 16:34:44 +00:00
# Contributor: Stéphane Gaudreault <stephane@archlinux.org>
2020-02-26 04:34:21 +00:00
# ALARM: Kevin Mihelich <kevin@archlinuxarm.org>
# - remove makedepend on pandoc, don't generate manuals
pkgname=cppcheck
2021-10-03 20:24:53 +00:00
pkgver=2.6
2021-07-11 20:18:50 +00:00
pkgrel=1
2020-02-26 04:34:21 +00:00
pkgdesc="A tool for static C/C++ code analysis"
arch=('x86_64')
url="http://cppcheck.sourceforge.net/"
license=('GPL')
depends=('python-pygments' 'tinyxml2')
2020-10-23 21:00:38 +00:00
makedepends=('docbook-xsl' 'qt5-tools' 'qt5-base' 'python' 'cmake' 'clang')
2021-06-14 17:48:46 +00:00
optdepends=('qt5-tools: run cppcheck-gui'
2020-05-11 20:52:39 +00:00
'python-pygments: cppcheck-htmlreport'
2020-06-07 16:34:44 +00:00
'clang: for cppcheck-gui integration')
2020-02-26 04:34:21 +00:00
source=($pkgname-$pkgver.tar.gz::https://github.com/danmar/cppcheck/archive/${pkgver}.tar.gz
2021-06-14 17:48:46 +00:00
translations-location.patch
https://github.com/danmar/cppcheck/commit/8d682884.patch)
2021-10-03 20:24:53 +00:00
sha1sums=('bf7808d527f9f3543d301c6b0b31d308bf97dfa2'
2021-06-14 17:48:46 +00:00
'03b0888438cf92ccdcbf307dbc3c35e65c91b844'
2021-07-11 20:18:50 +00:00
'f554bc1f0d9966e232ff13b2929d7a5851009278')
2020-02-26 04:34:21 +00:00
prepare() {
cd "${pkgname}-${pkgver}"
patch -Np1 -i $srcdir/translations-location.patch
2021-06-14 17:48:46 +00:00
patch -p1 < ../8d682884.patch # Fix build with GCC 11
2020-02-26 04:34:21 +00:00
mkdir build
}
build() {
cd "${pkgname}-${pkgver}"
export CXXFLAGS+=" -DNDEBUG"
# Manuals
xsversion=$(pacman -Qi docbook-xsl | grep ^Version | sed -e 's/.*: //' -e 's/-[0-9]$//')
make DB2MAN=/usr/share/xml/docbook/xsl-stylesheets-${xsversion}-nons/manpages/docbook.xsl man
#pandoc man/manual.md -o man/manual.html -s --number-sections --toc
#pandoc man/reference-cfg-format.md -o man/reference-cfg-format.html -s --number-sections --toc
cd build
cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release \
-DUSE_MATCHCOMPILER=yes -DHAVE_RULES=yes \
-DBUILD_GUI=yes -DBUILD_SHARED_LIBS:BOOL=OFF \
-DBUILD_TESTS=yes -DFILESDIR=/usr/share/cppcheck \
2020-12-12 00:27:19 +00:00
-DUSE_BUNDLED_TINYXML2=OFF \
2020-02-26 04:34:21 +00:00
..
make
}
check() {
cd "${pkgname}-${pkgver}/build/bin"
./testrunner -g -q
}
package() {
cd "${pkgname}-${pkgver}/build"
make DESTDIR="${pkgdir}" install
cd ..
install -D -p -m 644 cppcheck.1 "${pkgdir}"/usr/share/man/man1/cppcheck.1
install -D -p -m 755 htmlreport/cppcheck-htmlreport "${pkgdir}"/usr/bin/cppcheck-htmlreport
# Fix location of language files
install -d "${pkgdir}"/usr/share/cppcheck/cfg/lang
mv "${pkgdir}"/usr/bin/cppcheck_*.qm "${pkgdir}"/usr/share/cppcheck/cfg/lang/
}