Skip to content

Commit

Permalink
cppcheck-native: Import from meta-sca@1340a465cd183eccc43d9a6334c7cdf…
Browse files Browse the repository at this point in the history
…f0b5888b2
  • Loading branch information
herb-kuta-lge committed Jul 1, 2020
1 parent c4db427 commit ac4efb8
Show file tree
Hide file tree
Showing 5 changed files with 109 additions and 0 deletions.
9 changes: 9 additions & 0 deletions recipes-sca/cppcheck-native/cppcheck-native_1.87.bb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
require cppcheck.inc

SRC_URI = " https://github.com/danmar/cppcheck/archive/${PV}.tar.gz \
file://0001-makefile.patch \
file://0002-pkgconfig-instaed-of-pcre-config.patch \
file://cppcheck.sca.description"
SRC_URI[md5sum] = "eba3b8b4d69045bd24104c2d0cc0cb0c"
SRC_URI[sha256sum] = "ea7ac1cd2f5c00ecffd596fd0f7281cba44308e565a634fae02b77ecd927c153"
LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504"
34 changes: 34 additions & 0 deletions recipes-sca/cppcheck-native/cppcheck.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
SUMMARY = "Static code analyzer for C/C++"
DESCRIPTION = " Static code analyzer for C/C++."

HOMEPAGE = " http://cppcheck.sourceforge.net/"
BUGTRACKER = " https://trac.cppcheck.net/"
LICENSE = "GPLv3"

inherit native

inherit pkgconfig

DEPENDS = "libpcre-native"

## we don't need debug packages
INHIBIT_PACKAGE_DEBUG_SPLIT = "1"

EXTRA_OEMAKE = "HAVE_RULES=yes"

do_compile() {
oe_runmake
}

FILES_${PN} = "${bindir}/** ${datadir}"


do_install() {
install -d ${D}${bindir}
install -d ${D}${datadir}
install ${B}/cppcheck ${D}${bindir}
cp -R ${B}/addons ${D}${bindir}
cp -R ${B}/cfg ${D}${bindir}
install -D ${B}/htmlreport/cppcheck-htmlreport ${D}${bindir}
install ${WORKDIR}/cppcheck.sca.description ${D}${datadir}
}
43 changes: 43 additions & 0 deletions recipes-sca/cppcheck-native/files/0001-makefile.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
--- a/Makefile
+++ b/Makefile
@@ -102,9 +102,11 @@
endif
endif

-ifndef PREFIX
- PREFIX=/usr
-endif
+DESTDIR?= ""
+prefix?= "/usr"
+bindir?= "$(prefix)/bin"
+BINDIR=$(bindir)
+PREFIX=$(prefix)

ifndef INCLUDE_FOR_LIB
INCLUDE_FOR_LIB=-Ilib -Iexternals/simplecpp -Iexternals/tinyxml
@@ -117,8 +119,6 @@
ifndef INCLUDE_FOR_TEST
INCLUDE_FOR_TEST=-Ilib -Icli -Iexternals/simplecpp -Iexternals/tinyxml
endif
-
-BIN=$(DESTDIR)$(PREFIX)/bin

# For 'make man': sudo apt-get install xsltproc docbook-xsl docbook-xml on Linux
DB2MAN?=/usr/share/sgml/docbook/stylesheet/xsl/nwalsh/manpages/docbook.xsl
@@ -287,11 +287,11 @@
ctags -R --exclude=doxyoutput --exclude=test/cfg cli externals gui lib test

install: cppcheck
- install -d ${BIN}
- install cppcheck ${BIN}
- install addons/*.py ${BIN}
- install addons/*/*.py ${BIN}
- install htmlreport/cppcheck-htmlreport ${BIN}
+ install -d ${DESTDIR}${BINDIR}
+ install cppcheck ${DESTDIR}${BINDIR}
+ install addons/*.py ${DESTDIR}${BINDIR}
+ install addons/*/*.py ${DESTDIR}${BINDIR}
+ install htmlreport/cppcheck-htmlreport ${DESTDIR}${BINDIR}
ifdef CFGDIR
install -d ${DESTDIR}${CFGDIR}
install -m 644 cfg/* ${DESTDIR}${CFGDIR}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
--- a/Makefile
+++ b/Makefile-1
@@ -94,11 +94,11 @@
endif

ifeq ($(HAVE_RULES),yes)
- override CXXFLAGS += -DHAVE_RULES -DTIXML_USE_STL $(shell pcre-config --cflags)
+ override CXXFLAGS += -DHAVE_RULES -DTIXML_USE_STL $(shell pkg-config libpcre --cflags)
ifdef LIBS
- LIBS += $(shell pcre-config --libs)
+ LIBS += $(shell pkg-config libpcre --libs)
else
- LIBS=$(shell pcre-config --libs)
+ LIBS=$(shell pkg-config libpcre --libs)
endif
endif

6 changes: 6 additions & 0 deletions recipes-sca/cppcheck-native/files/cppcheck.sca.description
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"languages": ["C", "CPP"],
"buildspeed" : "fast",
"execspeed": "fast",
"quality": "good"
}

0 comments on commit ac4efb8

Please sign in to comment.