From f9c1467c887fb369328f475bed6529c23502c723 Mon Sep 17 00:00:00 2001 From: Herb Kuta Date: Tue, 2 Apr 2019 16:30:36 -0700 Subject: [PATCH] DRAFT cppcheck-native: Import from meta-sca@1340a465cd183eccc43d9a6334c7cdff0b5888b2 --- .../cppcheck-native/cppcheck-native_1.87.bb | 9 ++++ recipes-sca/cppcheck-native/cppcheck.inc | 34 +++++++++++++++ .../cppcheck-native/files/0001-makefile.patch | 43 +++++++++++++++++++ ...002-pkgconfig-instaed-of-pcre-config.patch | 17 ++++++++ .../files/cppcheck.sca.description | 6 +++ 5 files changed, 109 insertions(+) create mode 100644 recipes-sca/cppcheck-native/cppcheck-native_1.87.bb create mode 100644 recipes-sca/cppcheck-native/cppcheck.inc create mode 100644 recipes-sca/cppcheck-native/files/0001-makefile.patch create mode 100644 recipes-sca/cppcheck-native/files/0002-pkgconfig-instaed-of-pcre-config.patch create mode 100644 recipes-sca/cppcheck-native/files/cppcheck.sca.description diff --git a/recipes-sca/cppcheck-native/cppcheck-native_1.87.bb b/recipes-sca/cppcheck-native/cppcheck-native_1.87.bb new file mode 100644 index 0000000..b47ef2e --- /dev/null +++ b/recipes-sca/cppcheck-native/cppcheck-native_1.87.bb @@ -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" diff --git a/recipes-sca/cppcheck-native/cppcheck.inc b/recipes-sca/cppcheck-native/cppcheck.inc new file mode 100644 index 0000000..87dc9cf --- /dev/null +++ b/recipes-sca/cppcheck-native/cppcheck.inc @@ -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} +} diff --git a/recipes-sca/cppcheck-native/files/0001-makefile.patch b/recipes-sca/cppcheck-native/files/0001-makefile.patch new file mode 100644 index 0000000..f0e00b2 --- /dev/null +++ b/recipes-sca/cppcheck-native/files/0001-makefile.patch @@ -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} diff --git a/recipes-sca/cppcheck-native/files/0002-pkgconfig-instaed-of-pcre-config.patch b/recipes-sca/cppcheck-native/files/0002-pkgconfig-instaed-of-pcre-config.patch new file mode 100644 index 0000000..bcd9961 --- /dev/null +++ b/recipes-sca/cppcheck-native/files/0002-pkgconfig-instaed-of-pcre-config.patch @@ -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 + diff --git a/recipes-sca/cppcheck-native/files/cppcheck.sca.description b/recipes-sca/cppcheck-native/files/cppcheck.sca.description new file mode 100644 index 0000000..efa930c --- /dev/null +++ b/recipes-sca/cppcheck-native/files/cppcheck.sca.description @@ -0,0 +1,6 @@ +{ + "languages": ["C", "CPP"], + "buildspeed" : "fast", + "execspeed": "fast", + "quality": "good" +} \ No newline at end of file