summaryrefslogtreecommitdiff
path: root/user/cppcheck/APKBUILD
blob: e4304ae7286cd41191ab1b612f9536e60b3d3142 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# Contributor: A. Wilcox <awilfox@adelielinux.org>
# Maintainer: A. Wilcox <awilfox@adelielinux.org>
pkgname=cppcheck
pkgver=2.7
pkgrel=0
pkgdesc="Tool for static C/C++ code analysis"
url="https://cppcheck.sourceforge.io/"
arch="all"
license="GPL-3.0-only"
depends=""
makedepends="cmake pcre-dev qt5-qtbase-dev qt5-qttools-dev z3-dev"
subpackages="$pkgname-gui"
source="cppcheck-$pkgver.tar.gz::https://github.com/danmar/cppcheck/archive/$pkgver.tar.gz"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=RelWithDebugInfo \
		-DCMAKE_CXX_FLAGS="$CXXFLAGS" \
		-DCMAKE_C_FLAGS="$CFLAGS" \
		-DBUILD_GUI=ON \
		-DBUILD_TESTS=ON \
		-DHAVE_RULES=ON \
		-DUSE_MATCHCOMPILER=ON \
		-DUSE_Z3=ON \
		${CMAKE_CROSSOPTS} \
		.
	make
}

check() {
	CTEST_OUTPUT_ON_FAILURE=TRUE ctest
}

package() {
	make DESTDIR="$pkgdir" install
}

gui() {
	pkgdesc="$pkgdesc (Qt UI)"
	depends="cppcheck"
	mkdir -p "$subpkgdir"/usr/share "$subpkgdir"/usr/bin
	mv "$pkgdir"/usr/bin/cppcheck-gui "$subpkgdir"/usr/bin/
	mv "$pkgdir"/usr/bin/*.qm "$subpkgdir"/usr/bin/
	mv "$pkgdir"/usr/share/applications "$subpkgdir"/usr/share/
	mv "$pkgdir"/usr/share/icons "$subpkgdir"/usr/share/
}

sha512sums="22da64126ec76fa2b3c533fe4c82d8c3a46a274bce78aa2495bffed5491c604891ba46684499a28a4a22ab928979e9388e52df36ad0e2b001b81619c26791aad  cppcheck-2.7.tar.gz"