cppcheck-1.77.ebuild 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. # Copyright 1999-2017 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=5
  4. PYTHON_COMPAT=( python{2_7,3_4,3_5} )
  5. inherit distutils-r1 eutils qt4-r2 toolchain-funcs flag-o-matic
  6. DESCRIPTION="static analyzer of C/C++ code"
  7. HOMEPAGE="http://cppcheck.sourceforge.net"
  8. SRC_URI="mirror://sourceforge/${PN}/${P}.tar.bz2"
  9. LICENSE="GPL-3"
  10. SLOT="0"
  11. KEYWORDS="amd64 ~arm ~x86"
  12. IUSE="htmlreport pcre qt4"
  13. RDEPEND="htmlreport? ( dev-python/pygments[${PYTHON_USEDEP}] )
  14. >=dev-libs/tinyxml2-2
  15. qt4? ( dev-qt/qtgui:4 )
  16. pcre? ( dev-libs/libpcre )"
  17. DEPEND="${RDEPEND}
  18. app-text/docbook-xsl-stylesheets
  19. dev-libs/libxslt
  20. virtual/pkgconfig"
  21. src_prepare() {
  22. append-cxxflags -std=c++0x
  23. # Drop bundled libs, patch Makefile generator and re-run it
  24. rm -r externals/tinyxml || die
  25. epatch "${FILESDIR}"/${PN}-1.75-tinyxml2.patch
  26. tc-export CXX
  27. emake dmake
  28. ./dmake || die
  29. default
  30. }
  31. src_configure() {
  32. if use pcre ; then
  33. sed -e '/HAVE_RULES=/s:=no:=yes:' \
  34. -i Makefile
  35. fi
  36. if use qt4 ; then
  37. pushd gui
  38. qt4-r2_src_configure
  39. popd
  40. fi
  41. }
  42. src_compile() {
  43. export LIBS="$(pkg-config --libs tinyxml2)"
  44. emake ${PN} man \
  45. CFGDIR="${EROOT}usr/share/${PN}/cfg" \
  46. DB2MAN="${EROOT}usr/share/sgml/docbook/xsl-stylesheets/manpages/docbook.xsl"
  47. if use qt4 ; then
  48. pushd gui
  49. qt4-r2_src_compile
  50. popd
  51. fi
  52. if use htmlreport ; then
  53. pushd htmlreport
  54. distutils-r1_src_compile
  55. popd
  56. fi
  57. }
  58. src_test() {
  59. # safe final version
  60. mv -v ${PN}{,.final}
  61. mv -v lib/library.o{,.final}
  62. mv -v cli/cppcheckexecutor.o{,.final}
  63. #trigger recompile with CFGDIR inside ${S}
  64. emake check CFGDIR="${S}/cfg"
  65. # restore
  66. mv -v ${PN}{.final,}
  67. mv -v lib/library.o{.final,}
  68. mv -v cli/cppcheckexecutor.o{.final,}
  69. }
  70. src_install() {
  71. # it's not autotools-based, so "${ED}" here, not "${D}", bug 531760
  72. emake install DESTDIR="${ED}"
  73. insinto "/usr/share/${PN}/cfg"
  74. doins cfg/*.cfg
  75. if use qt4 ; then
  76. dobin gui/${PN}-gui
  77. dodoc gui/{projectfile.txt,gui.${PN}}
  78. fi
  79. if use htmlreport ; then
  80. pushd htmlreport
  81. distutils-r1_src_install
  82. popd
  83. find "${D}" -name "*.egg-info" -delete
  84. else
  85. rm "${ED}/usr/bin/cppcheck-htmlreport" || die
  86. fi
  87. doman ${PN}.1
  88. dodoc -r triage
  89. }