aboutsummaryrefslogtreecommitdiff
path: root/devel/cppcheck/Makefile
blob: 80150a1fbb5784931c9d300e19e76b05f5d551a9 (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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# Created by: Gabor Pali <pgj@FreeBSD.org>
# $FreeBSD$

PORTNAME=	cppcheck
PORTVERSION=	1.81
CATEGORIES=	devel
MASTER_SITES=	SF

MAINTAINER=	amdmi3@FreeBSD.org
COMMENT?=	Static analysis of C/C++ code

LICENSE=	GPLv3+
LICENSE_FILE=	${WRKSRC}/COPYING

BROKEN_powerpc64=	fails to compile: analyzerinfo.cpp: 'to_string' is not a member of 'std'

USES=			compiler:c++11-lib cmake tar:bzip2

.if defined(GUI_ONLY)
COMMENT=		Static analysis of C/C++ code (GUI)

RUN_DEPENDS=		cppcheck:devel/cppcheck

CMAKE_ARGS=		-DBUILD_GUI=TRUE
USE_QT5=		core gui widgets printsupport qmake_build buildtools_build linguisttools_build

BUILD_WRKSRC=		${WRKSRC}/gui
INSTALL_WRKSRC=		${WRKSRC}/gui

PLIST=			${PKGDIR}/pkg-plist-gui

PKGNAMESUFFIX=		-gui
.else
USES+=			shebangfix
SHEBANG_FILES=		htmlreport/cppcheck-htmlreport

OPTIONS_DEFINE=		RULES HTMLREPORT MANPAGES MATCHCOMPILER TEST
OPTIONS_DEFAULT=	RULES HTMLREPORT MANPAGES MATCHCOMPILER
OPTIONS_SUB=		yes

RULES_DESC=		User-defined rule support (requires PCRE)
RULES_CMAKE_BOOL=	HAVE_RULES
RULES_LIB_DEPENDS=	libpcre.so:devel/pcre
RULES_USES=		localbase:ldflags

TEST_CMAKE_BOOL=	BUILD_TESTS

HTMLREPORT_DESC=	Install cppcheck-htmlreport
HTMLREPORT_USES=	python:2,${PYUSE:C/ /,/W}
HTMLREPORT_RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}pygments>0:textproc/py-pygments@${PY_FLAVOR}
HTMLREPORT_PLIST_FILES=	bin/cppcheck-htmlreport
HTMLREPORT_VARS=	PYUSE+=run

MANPAGES_BUILD_DEPENDS=	xsltproc:textproc/libxslt \
			${LOCALBASE}/share/xsl/docbook/manpages/docbook.xsl:textproc/docbook-xsl

MATCHCOMPILER_DESC=	Build-time optimizations via Python
MATCHCOMPILER_CMAKE_BOOL=	USE_MATCHCOMPILER
MATCHCOMPILER_USES=	python:2,${PYUSE:C/ /,/W}
MATCHCOMPILER_VARS=	PYUSE+=build

post-install-HTMLREPORT-on:
	${INSTALL_SCRIPT} ${WRKSRC}/htmlreport/cppcheck-htmlreport ${STAGEDIR}${PREFIX}/bin

post-build-MANPAGES-on:
	cd ${WRKSRC}/man && ${LOCALBASE}/bin/xsltproc --nonet --param man.charmap.use.subset "0" \
		${LOCALBASE}/share/xsl/docbook/manpages/docbook.xsl cppcheck.1.xml

post-install-MANPAGES-on:
	${INSTALL_MAN} ${WRKSRC}/man/cppcheck.1 ${STAGEDIR}${PREFIX}/man/man1

do-test-TEST-on:
	cd ${WRKSRC} && ctest
.endif

.include <bsd.port.mk>