commit:     f194246c700ea0d84605d9eb337076f0e9a31001
Author:     David Roman <droman <AT> ifae <DOT> es>
AuthorDate: Wed Jul 23 08:26:38 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Oct  3 00:56:06 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f194246c

dev-util/cppcheck: add 2.18.2

Closes: https://bugs.gentoo.org/962707
Signed-off-by: David Roman <droman <AT> ifae.es>
Part-of: https://github.com/gentoo/gentoo/pull/43116
Closes: https://github.com/gentoo/gentoo/pull/43116
Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-util/cppcheck/Manifest               |   1 +
 dev-util/cppcheck/cppcheck-2.18.2.ebuild | 133 +++++++++++++++++++++++++++++++
 2 files changed, 134 insertions(+)

diff --git a/dev-util/cppcheck/Manifest b/dev-util/cppcheck/Manifest
index 2e2a66960bd1..6220a4f04eb6 100644
--- a/dev-util/cppcheck/Manifest
+++ b/dev-util/cppcheck/Manifest
@@ -1 +1,2 @@
 DIST cppcheck-2.17.1.tar.gz 3872633 BLAKE2B 
8a2404b2610386166c1e8d3bfe8b3405834bde8534974678043a658721a43a6a627c6d2793febe4c6c70856e823907e04ce46674acbca8354c5a452236f289cc
 SHA512 
ffd1caeba22493e45ad24c61af19c71adc25ba8eb2c3070152d150921024d68b4892d4e01575c9960e0b0aa1df9deae3514612b184afcf48e377022ca3bb0d85
+DIST cppcheck-2.18.2.tar.gz 3930679 BLAKE2B 
caa9be7676f50b7931f2e2aae3bb8cb94460fe183c3cd626659939a3d79f1b4f69e5163479500abac6cab966065b1084e9d6ad391e9b89375fc33ad430d93a2c
 SHA512 
fe562aa23a38313c925bde4b647a7783340aa2cfe2b355d2c2779a86c8ed5d490164e40d17bc398579303167a59b8812aa9185468be3516dc564169941afb5c1

diff --git a/dev-util/cppcheck/cppcheck-2.18.2.ebuild 
b/dev-util/cppcheck/cppcheck-2.18.2.ebuild
new file mode 100644
index 000000000000..a0b60d2d31a2
--- /dev/null
+++ b/dev-util/cppcheck/cppcheck-2.18.2.ebuild
@@ -0,0 +1,133 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{11..14} )
+inherit cmake python-single-r1 xdg
+
+DESCRIPTION="Static analyzer of C/C++ code"
+HOMEPAGE="https://github.com/danmar/cppcheck";
+SRC_URI="https://github.com/danmar/cppcheck/archive/refs/tags/${PV}.tar.gz -> 
${P}.tar.gz"
+
+LICENSE="GPL-3+"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~arm64 ~loong ~ppc64 ~riscv ~x86"
+IUSE="charts gui htmlreport pcre test"
+REQUIRED_USE="
+       ${PYTHON_REQUIRED_USE}
+       charts? ( gui )
+"
+RESTRICT="!test? ( test )"
+
+COMMON_DEPEND="
+       dev-libs/tinyxml2:=
+       gui? (
+               dev-qt/qtbase:6[gui,widgets,network]
+               charts? ( dev-qt/qtcharts:6 )
+       )
+       pcre? ( dev-libs/libpcre )
+"
+DEPEND="${COMMON_DEPEND}
+       gui? ( dev-qt/qttools:6[assistant,linguist] )
+"
+RDEPEND="${COMMON_DEPEND}
+       ${PYTHON_DEPS}
+       htmlreport? (
+               $(python_gen_cond_dep '
+                       dev-python/pygments[${PYTHON_USEDEP}]
+               ')
+       )
+"
+BDEPEND="
+       ${PYTHON_DEPS}
+       app-text/docbook-xsl-stylesheets
+       dev-libs/libxslt
+       virtual/pkgconfig
+       gui? ( dev-qt/qttools:6[assistant,linguist] )
+       test? (
+               htmlreport? (
+                       $(python_gen_cond_dep '
+                               dev-python/pytest[${PYTHON_USEDEP}]
+                               dev-python/pytest-timeout[${PYTHON_USEDEP}]
+                               dev-python/pygments[${PYTHON_USEDEP}]
+                       ')
+               )
+       )
+"
+
+src_prepare() {
+       cmake_src_prepare
+
+       # Modify to an existing docbook location
+       sed -i \
+               -e "s|set(DB2MAN .*|set(DB2MAN 
\"${EPREFIX}/usr/share/sgml/docbook/xsl-stylesheets/manpages/docbook.xsl\")|" \
+               man/CMakeLists.txt || die
+
+       # Make tests use cppcheck built in build dir.
+       sed -i -e "s|CPPCHECK_BIN = .*|CPPCHECK_BIN = 
'${BUILD_DIR}/bin/cppcheck'|" test/tools/htmlreport/test_htmlreport.py || die
+}
+
+src_configure() {
+       local mycmakeargs=(
+               -DFILESDIR="${EPREFIX}"/usr/share/${PF}/
+               -DBUILD_MANPAGE=ON
+
+               -DHAVE_RULES=$(usex pcre)
+
+               -DBUILD_GUI=$(usex gui)
+               -DUSE_QT6=$(usex gui)
+               -DWITH_QCHART=$(usex charts)
+
+               -DBUILD_TESTS=$(usex test)
+               -DREGISTER_TESTS=$(usex test)
+               -DREGISTER_GUI_TESTS=$(usex test)
+
+               -DUSE_MATCHCOMPILER=ON
+
+               -DDISABLE_DMAKE=ON
+               -DUSE_BUNDLED_TINYXML2=OFF
+
+               # Yes, this is necessary to use the correct python version.
+               # bug #826602
+               -DPython_EXECUTABLE=${PYTHON}
+       )
+
+       cmake_src_configure
+}
+
+src_compile() {
+       cmake_src_compile
+       cmake_build man
+}
+
+src_test() {
+       local CMAKE_SKIP_TESTS=(
+               # Out of source builds breaks test TestFileLister
+               # https://github.com/danmar/cppcheck/pull/5462
+               TestFileLister
+       )
+       cmake_src_test
+
+       rm test/cli/other_test.py || die
+       use htmlreport && TEST_CPPCHECK_EXE_LOOKUP_PATH="${BUILD_DIR}/bin/" 
epytest test
+}
+
+src_install() {
+       cmake_src_install
+
+       insinto /usr/share/${PF}/cfg
+       doins cfg/*.cfg
+
+       if use gui ; then
+               dobin "${WORKDIR}/${P}_build/bin/${PN}-gui"
+               dodoc gui/{projectfile.txt,gui.${PN}}
+       fi
+
+       use htmlreport && python_doscript htmlreport/cppcheck-htmlreport
+       python_fix_shebang "${ED}"/usr/share/${PF}
+       python_optimize "${ED}"/usr/share/${PF}
+
+       dodoc -r tools/triage
+       doman "${BUILD_DIR}"/man/cppcheck.1
+}

Reply via email to