From: Michael Weber Date: Thu, 4 Aug 2016 13:08:54 +0000 (+0200) Subject: dev-util/cppcheck: add live version (bug 590428). X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=9a345b0cdd668ad0678f49a306665354b6c3143c;p=gentoo.git dev-util/cppcheck: add live version (bug 590428). Package-Manager: portage-2.2.28 --- diff --git a/dev-util/cppcheck/cppcheck-9999.ebuild b/dev-util/cppcheck/cppcheck-9999.ebuild new file mode 100644 index 000000000000..937cc7f07e13 --- /dev/null +++ b/dev-util/cppcheck/cppcheck-9999.ebuild @@ -0,0 +1,105 @@ +# Copyright 1999-2016 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI=5 + +PYTHON_COMPAT=( python{2_7,3_3,3_4,3_5} ) + +inherit distutils-r1 eutils qt4-r2 toolchain-funcs flag-o-matic git-r3 + +DESCRIPTION="static analyzer of C/C++ code" +HOMEPAGE="http://cppcheck.sourceforge.net" +EGIT_REPO_URI="git://github.com/danmar/cppcheck.git" + +LICENSE="GPL-3" +SLOT="0" +KEYWORDS="" +IUSE="htmlreport pcre qt4" + +RDEPEND="htmlreport? ( dev-python/pygments[${PYTHON_USEDEP}] ) + >=dev-libs/tinyxml2-2 + qt4? ( dev-qt/qtgui:4 ) + pcre? ( dev-libs/libpcre )" +DEPEND="${RDEPEND} + app-text/docbook-xsl-stylesheets + dev-libs/libxslt + virtual/pkgconfig" + +src_prepare() { + append-cxxflags -std=c++0x + + # Drop bundled libs, patch Makefile generator and re-run it + rm -r externals/tinyxml || die + epatch "${FILESDIR}"/${PN}-9999-tinyxml2.patch + tc-export CXX + emake dmake + ./dmake || die + + epatch_user +} + +src_configure() { + if use pcre ; then + sed -e '/HAVE_RULES=/s:=no:=yes:' \ + -i Makefile + fi + if use qt4 ; then + pushd gui + qt4-r2_src_configure + popd + fi +} + +src_compile() { + export LIBS="$(pkg-config --libs tinyxml2)" + emake ${PN} man \ + CFGDIR="${EROOT}usr/share/${PN}/cfg" \ + DB2MAN="${EROOT}usr/share/sgml/docbook/xsl-stylesheets/manpages/docbook.xsl" + + if use qt4 ; then + pushd gui + qt4-r2_src_compile + popd + fi + if use htmlreport ; then + pushd htmlreport + distutils-r1_src_compile + popd + fi +} + +src_test() { + # safe final version + mv -v ${PN}{,.final} + mv -v lib/library.o{,.final} + mv -v cli/cppcheckexecutor.o{,.final} + #trigger recompile with CFGDIR inside ${S} + emake check CFGDIR="${S}/cfg" + # restore + mv -v ${PN}{.final,} + mv -v lib/library.o{.final,} + mv -v cli/cppcheckexecutor.o{.final,} +} + +src_install() { + # it's not autotools-based, so "${ED}" here, not "${D}", bug 531760 + emake install DESTDIR="${ED}" + + insinto "/usr/share/${PN}/cfg" + doins cfg/*.cfg + if use qt4 ; then + dobin gui/${PN}-gui + dodoc gui/{projectfile.txt,gui.${PN}} + fi + if use htmlreport ; then + pushd htmlreport + distutils-r1_src_install + popd + find "${D}" -name "*.egg-info" -delete + else + rm "${ED}/usr/bin/cppcheck-htmlreport" || die + fi + doman ${PN}.1 + dodoc -r triage +} diff --git a/dev-util/cppcheck/files/cppcheck-9999-tinyxml2.patch b/dev-util/cppcheck/files/cppcheck-9999-tinyxml2.patch new file mode 100644 index 000000000000..9d8558466595 --- /dev/null +++ b/dev-util/cppcheck/files/cppcheck-9999-tinyxml2.patch @@ -0,0 +1,55 @@ +--- cppcheck-9999/gui/gui.pro ++++ cppcheck-9999/gui/gui.pro +@@ -19,6 +19,7 @@ + DEFINES += CPPCHECKLIB_IMPORT + } + LIBS += -L$$PWD/../externals ++LIBS += `pkg-config --libs tinyxml2` + + DESTDIR = . + RCC_DIR = temp +--- cppcheck-9999/tools/dmake.cpp ++++ cppcheck-9999/tools/dmake.cpp +@@ -123,7 +123,6 @@ + + std::vector extfiles; + extfiles.push_back("externals/simplecpp/simplecpp.cpp"); +- extfiles.push_back("externals/tinyxml/tinyxml2.cpp"); + + std::vector clifiles; + getCppFiles(clifiles, "cli/", false); +@@ -172,7 +171,6 @@ + std::ofstream fout1("test/testfiles.pri"); + if (fout1.is_open()) { + fout1 << "# no manual edits - this file is autogenerated by dmake\n\n"; +- fout1 << "INCLUDEPATH += ../externals/tinyxml\n"; + fout1 << "\n\nSOURCES += "; + for (unsigned int i = 0; i < testfiles.size(); ++i) { + const std::string filename(testfiles[i].substr(5)); +@@ -337,9 +335,9 @@ + << "endif\n\n"; + + makeConditionalVariable(fout, "PREFIX", "/usr"); +- makeConditionalVariable(fout, "INCLUDE_FOR_LIB", "-Ilib -Iexternals/simplecpp -Iexternals/tinyxml"); +- makeConditionalVariable(fout, "INCLUDE_FOR_CLI", "-Ilib -Iexternals/simplecpp -Iexternals/tinyxml"); +- makeConditionalVariable(fout, "INCLUDE_FOR_TEST", "-Ilib -Icli -Iexternals/simplecpp -Iexternals/tinyxml"); ++ makeConditionalVariable(fout, "INCLUDE_FOR_LIB", "-Ilib -Iexternals/simplecpp"); ++ makeConditionalVariable(fout, "INCLUDE_FOR_CLI", "-Ilib -Iexternals/simplecpp"); ++ makeConditionalVariable(fout, "INCLUDE_FOR_TEST", "-Ilib -Icli -Iexternals/simplecpp"); + + fout << "BIN=$(DESTDIR)$(PREFIX)/bin\n\n"; + fout << "# For 'make man': sudo apt-get install xsltproc docbook-xsl docbook-xml on Linux\n"; +--- cppcheck-9999/externals/externals.pri ++++ cppcheck-9999/externals/externals.pri +@@ -1,8 +1,5 @@ +-INCLUDEPATH += $${PWD}/simplecpp \ +- $${PWD}/tinyxml ++INCLUDEPATH += $${PWD}/simplecpp + +-HEADERS += $${PWD}/simplecpp/simplecpp.h \ +- $${PWD}/tinyxml/tinyxml2.h ++HEADERS += $${PWD}/simplecpp/simplecpp.h + +-SOURCES += $${PWD}/simplecpp/simplecpp.cpp \ +- $${PWD}/tinyxml/tinyxml2.cpp ++SOURCES += $${PWD}/simplecpp/simplecpp.cpp