PKGBUILDs/community/cppcheck/PKGBUILD

77 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>
# Maintainer: Stéphane Gaudreault <stephane@archlinux.org>
# ALARM: Kevin Mihelich <kevin@archlinuxarm.org>
# - remove makedepend on pandoc, don't generate manuals
pkgname=cppcheck
2020-05-11 20:52:39 +00:00
pkgver=2.0
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')
makedepends=('docbook-xsl' 'qt5-tools' 'qt5-base' 'python' 'cmake')
optdepends=('qt5-base: run cppcheck-gui'
2020-05-11 20:52:39 +00:00
'python-pygments: cppcheck-htmlreport'
'clang-tidy: 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
translations-location.patch cppcheck-1.90-tinyxml.patch)
2020-05-11 20:52:39 +00:00
sha1sums=('a6e5bdba6a453d5931a9e8ff2e2122255402dcb3'
2020-02-26 04:34:21 +00:00
'03b0888438cf92ccdcbf307dbc3c35e65c91b844'
'12d885e1b0a0a899faa190182a9ad5a8e53476a5')
prepare() {
cd "${pkgname}-${pkgver}"
patch -Np1 -i $srcdir/translations-location.patch
patch -Np1 -i $srcdir/cppcheck-1.90-tinyxml.patch
2020-05-11 20:52:39 +00:00
sed -i 's/2.0/2.0.0/' cmake/versions.cmake
2020-02-26 04:34:21 +00:00
# Make sure bundled tinyxml is not used
rm -r externals/tinyxml
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 \
..
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/
}