PKGBUILDs/extra/cppcheck/PKGBUILD
2024-09-22 18:34:42 -04:00

101 lines
3.1 KiB
Bash

# Maintainer: George Rawlinson <grawlinson@archlinux.org>
# Contributor: Jelle van der Waa <jelle@archlinux.org>
# Contributor: Stéphane Gaudreault <stephane@archlinux.org>
# ALARM: Kevin Mihelich <kevin@archlinuxarm.org>
# - remove makedepend on pandoc, don't generate manuals, don't install manuals we didn't generate
pkgname=cppcheck
pkgver=2.15.0
pkgrel=1
pkgdesc='A tool for static C/C++ code analysis'
arch=('x86_64')
url='http://cppcheck.sourceforge.net/'
license=('GPL-3.0-or-later')
depends=(
'python-pygments'
'tinyxml2'
'pcre'
)
makedepends=(
'git'
'docbook-xsl'
'qt6-tools'
'qt6-base'
'qt6-declarative'
'python'
'cmake'
'clang'
)
optdepends=(
'qt6-tools: run cppcheck-gui'
'python-pygments: cppcheck-htmlreport'
'clang: for cppcheck-gui integration'
)
source=(
"$pkgname::git+https://github.com/danmar/cppcheck.git#tag=$pkgver"
'translations-location.patch'
)
sha512sums=('6cac4707c6912911100285fdbf3023b0d99f760f179182f7bf26f5126dc9bb5e687374e1f5a77f94e48a811de80bc03b632ab63c2d606e608efea60577819ffe'
'd3528834d719017ec3a0e08005a293089b556622928defa1b37f940e62cb01165dcbd741e6d5e989c0156fb8789f7e63702af8b2390738648b2300a92f4ab0ae')
b2sums=('44cca73ed0e057cdd37976ed72ef3c225c2f259c24a6237ba362b7d38598fd95f91f988a80e2f7d350afbd1aebe7ab1741a8ed547fa96467a71abc430dbc7c8a'
'8156920eacc630cb5eceb2387937b747c84c6325bef906717cfbad68c122bdd27965da1e8070a560a0bed3a7b7c59ff5f0e116bb1d035c4c42f430c927a75b1f')
prepare() {
cd "$pkgname"
# fix location of translations
patch -p1 -i "$srcdir/translations-location.patch"
}
build() {
export CXXFLAGS+=" -DNDEBUG"
# Manuals
pushd "$pkgname"
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
#pandoc man/writing-addons.md -o man/writing-addons.html -s --number-sections --toc
popd
cd "$pkgname"
cmake \
-B build \
-S . \
-D CMAKE_INSTALL_PREFIX=/usr \
-D CMAKE_BUILD_TYPE=RelWithDebInfo \
-D USE_MATCHCOMPILER=ON \
-D HAVE_RULES=ON \
-D BUILD_GUI=ON \
-D BUILD_SHARED_LIBS=OFF \
-D BUILD_TESTS=ON \
-D FILESDIR=/usr/share/cppcheck \
-D USE_BUNDLED_TINYXML2=OFF \
-D USE_QT6=ON
cmake --build build
}
check() {
cd "$pkgname/build/bin"
./testrunner -g -q
}
package() {
cd "$pkgname"
DESTDIR="$pkgdir" cmake --install build
install -vDm644 -t "$pkgdir/usr/share/man/man1" cppcheck.1
install -vDm755 -t "$pkgdir/usr/bin" htmlreport/cppcheck-htmlreport
#install -vDm644 -t "$pkgdir/usr/share/doc/" man/manual.html
#install -vDm644 -t "$pkgdir/usr/share/doc/" man/reference-cfg-format.html
#install -vDm644 -t "$pkgdir/usr/share/doc/" man/writing-addons.html
# 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/
}