summaryrefslogtreecommitdiff
path: root/user/cppcheck/APKBUILD
blob: 99f618aa1245ae0b187aa1dc1170552bf9d71b5d (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.1
pkgrel=0
pkgdesc="Tool for static C/C++ code analysis"
url="http://cppcheck.sourceforge.net/"
arch="all"
license="GPL-3.0-only"
depends=""
makedepends="cmake pcre-dev qt5-qtbase-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="7e1ef473168f9af35db0979f85ddb4d66b91c09051e27bc28ea7453dbe94fbf799515701c737820e0a3bea77da0d8ef171313612f65e954718a80bbcb56d54ed  cppcheck-2.1.tar.gz"