[packages/cppcheck] up to 2.20.0

atler atler at pld-linux.org
Sun May 17 14:24:16 CEST 2026


commit 43a77345d212d9ce4020d82a79cbfffb1833976a
Author: Jan Palus <atler at pld-linux.org>
Date:   Sun May 17 14:23:57 2026 +0200

    up to 2.20.0

 cppcheck-gui-paths.patch    |  11 ----
 cppcheck-translations.patch |  35 ++++++-----
 cppcheck.spec               | 143 ++++++++++++++++++++++++++++----------------
 3 files changed, 110 insertions(+), 79 deletions(-)
---
diff --git a/cppcheck.spec b/cppcheck.spec
index 7dddee5..6b48da2 100644
--- a/cppcheck.spec
+++ b/cppcheck.spec
@@ -1,35 +1,43 @@
 #
 # Conditional build:
-%bcond_without	gui	# Qt4-based GUI
+%bcond_without	gui	# Qt6-based GUI
 #
 Summary:	Tool for static C/C++ code analysis
 Summary(pl.UTF-8):	Narzędzie do statycznej analizy kodu w C/C++
 Name:		cppcheck
-Version:	1.72
-Release:	2
+Version:	2.20.0
+Release:	1
 License:	GPL v3+
 Group:		Development/Tools
-Source0:	http://downloads.sourceforge.net/cppcheck/%{name}-%{version}.tar.bz2
-# Source0-md5:	2bd36f91ae0191ef5273bb7f6dc0d72e
-Patch0:		%{name}-gui-paths.patch
-Patch1:		%{name}-translations.patch
-URL:		http://cppcheck.sourceforge.net/
-BuildRequires:	cmake >= 2.8
+Source0:	https://downloads.sourceforge.net/cppcheck/%{name}-%{version}.tar.bz2
+# Source0-md5:	052140ea9d97107644440ec669a646b7
+Patch0:		%{name}-translations.patch
+URL:		http://cppcheck.sourceforge.io/
+BuildRequires:	boost-devel
+BuildRequires:	cmake >= 3.22
 BuildRequires:	docbook-style-xsl
 BuildRequires:	docbook-dtd45-xml
-BuildRequires:	libstdc++-devel
+BuildRequires:	libstdc++-devel >= 6:5.1
 BuildRequires:	libxslt-progs
 BuildRequires:	pcre-devel
-BuildRequires:	rpmbuild(macros) >= 1.603
+BuildRequires:	python3 >= 1:3.7
+BuildRequires:	python3-modules >= 1:3.7
+BuildRequires:	rpm-build >= 4.6
+BuildRequires:	rpmbuild(macros) >= 1.605
 BuildRequires:	sed >= 4.0
-BuildRequires:	tinyxml-devel
+BuildRequires:	tinyxml2-devel
 %if %{with gui}
-BuildRequires:	QtGui-devel >= 4
-BuildRequires:	QtHelp-devel >= 4
-BuildRequires:	qt4-build >= 4
-BuildRequires:	qt4-linguist >= 4
-BuildRequires:	qt4-qmake >= 4
+BuildRequires:	Qt6Charts-devel
+BuildRequires:	Qt6Core-devel
+BuildRequires:	Qt6Gui-devel
+BuildRequires:	Qt6Help-devel
+BuildRequires:	Qt6Network-devel
+BuildRequires:	Qt6PrintSupport-devel
+BuildRequires:	Qt6Widgets-devel
+BuildRequires:	qt6-build
+BuildRequires:	qt6-linguist
 %endif
+Requires:	%{name}-common = %{version}-%{release}
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
 %description
@@ -44,74 +52,109 @@ kompilatorów i innych narzędzi do analizy, nie wykrywa błędów
 składni. Wykrywa tylko te rodzaje błędów, których zwykle nie wykrywają
 kompilatory. Celem jest brak fałszywych alarmów.
 
+%package common
+Summary:	Common files for command line and GUI cppcheck
+Summary(pl.UTF-8):	Pliki wspólne dla cppcheck linii poleceń oraz interfejsu graficznego
+Group:		X11/Applications
+BuildArch:	noarch
+
+%description common
+Common files for command line and GUI cppcheck.
+
+%description common -l pl.UTF-8
+Pliki wspólne dla cppcheck linii poleceń oraz interfejsu graficznego.
+
 %package gui
-Summary:	Qt4-based GUI for cppcheck
-Summary(pl.UTF-8):	Oparty na Qt4 graficzny interfejs użytkownika do cppcheck
+Summary:	Qt6-based GUI for cppcheck
+Summary(pl.UTF-8):	Oparty na Qt6 graficzny interfejs użytkownika do cppcheck
 Group:		X11/Applications
-Requires:	%{name} = %{version}-%{release}
+Requires(post,postun):	desktop-file-utils
+Requires(post,postun):	gtk-update-icon-cache
+Requires:	%{name}-common = %{version}-%{release}
+Requires:	hicolor-icon-theme
 
 %description gui
-Qt4-based GUI for cppcheck.
+Qt6-based GUI for cppcheck.
 
 %description gui -l pl.UTF-8
-Oparty na Qt4 graficzny interfejs użytkownika do cppcheck.
+Oparty na Qt6 graficzny interfejs użytkownika do cppcheck.
 
 %prep
 %setup -q
 %patch -P0 -p1
-%patch -P1 -p1
 
-%{__sed} -i -e 's,-I[^ ]*/externals,,g' lib/lib.pri
+%{__sed} -i -e '1 s,#!.*env python.*,#!%{__python3},' htmlreport/cppcheck-htmlreport
 
 %build
 %{__make} DB2MAN=%{_datadir}/sgml/docbook/xsl-stylesheets/manpages/docbook.xsl man
 
-mkdir build
-cd build
-%{cmake} \
-	../ \
+%{cmake} -B build \
 	-DBUILD_SHARED_LIBS:BOOL=OFF \
 	-DBUILD_GUI:BOOL=%{?with_gui:ON}%{!?with_gui:OFF} \
-	-DHAVE_RULES:BOOL=ON
+	-DWITH_QCHART:BOOL=%{?with_gui:ON}%{!?with_gui:OFF} \
+	-DHAVE_RULES:BOOL=ON \
+	-DUSE_BOOST:BOOL=ON \
+	-DUSE_BUNDLED_TINYXML2:BOOL=OFF \
 
-
-%{__make}
+%{__make} -C build
 
 %install
 rm -rf $RPM_BUILD_ROOT
-cd build
 
-%{__make} install \
+%{__make} -C build install \
 	DESTDIR=$RPM_BUILD_ROOT
 
-install -Dp ../cppcheck.1 $RPM_BUILD_ROOT%{_mandir}/man1/cppcheck.1
+install -Dp cppcheck.1 $RPM_BUILD_ROOT%{_mandir}/man1/cppcheck.1
 
 %clean
 rm -rf $RPM_BUILD_ROOT
 
+%post gui
+%update_desktop_database_post
+%update_icon_cache hicolor
+
+%postun gui
+%update_desktop_database_postun
+%update_icon_cache hicolor
+
 %files
 %defattr(644,root,root,755)
-%doc AUTHORS readme.txt
 %attr(755,root,root) %{_bindir}/cppcheck
+%attr(755,root,root) %{_bindir}/cppcheck-htmlreport
 %{_mandir}/man1/cppcheck.1*
 
+%files common
+%doc AUTHORS TUNING.md readme.md releasenotes.txt
+%lang(ja) %doc readmeja.md
+%dir %{_datadir}/Cppcheck
+%dir %{_datadir}/Cppcheck/addons
+%{_datadir}/Cppcheck/addons/*.json
+%{_datadir}/Cppcheck/addons/*.py
+%dir %{_datadir}/Cppcheck/cfg
+%{_datadir}/Cppcheck/cfg/*.cfg
+%dir %{_datadir}/Cppcheck/platforms
+%{_datadir}/Cppcheck/platforms/*.xml
+
 %if %{with gui}
 %files gui
 %defattr(644,root,root,755)
 %attr(755,root,root) %{_bindir}/cppcheck-gui
-%dir %{_datadir}/CppCheck
-%{_datadir}/CppCheck/*.cfg
-%dir %{_datadir}/CppCheck/lang
-%lang(de) %{_datadir}/CppCheck/lang/cppcheck_de.qm
-%lang(es) %{_datadir}/CppCheck/lang/cppcheck_es.qm
-%lang(fi) %{_datadir}/CppCheck/lang/cppcheck_fi.qm
-%lang(fr) %{_datadir}/CppCheck/lang/cppcheck_fr.qm
-%lang(it) %{_datadir}/CppCheck/lang/cppcheck_it.qm
-%lang(ja) %{_datadir}/CppCheck/lang/cppcheck_ja.qm
-%lang(ko) %{_datadir}/CppCheck/lang/cppcheck_ko.qm
-%lang(nl) %{_datadir}/CppCheck/lang/cppcheck_nl.qm
-%lang(ru) %{_datadir}/CppCheck/lang/cppcheck_ru.qm
-%lang(sr) %{_datadir}/CppCheck/lang/cppcheck_sr.qm
-%lang(sv) %{_datadir}/CppCheck/lang/cppcheck_sv.qm
-%lang(zh_CN) %{_datadir}/CppCheck/lang/cppcheck_zh_CN.qm
+%dir %{_datadir}/Cppcheck/lang
+%lang(de) %{_datadir}/Cppcheck/lang/cppcheck_de.qm
+%lang(es) %{_datadir}/Cppcheck/lang/cppcheck_es.qm
+%lang(fi) %{_datadir}/Cppcheck/lang/cppcheck_fi.qm
+%lang(fr) %{_datadir}/Cppcheck/lang/cppcheck_fr.qm
+%lang(it) %{_datadir}/Cppcheck/lang/cppcheck_it.qm
+%lang(ja) %{_datadir}/Cppcheck/lang/cppcheck_ja.qm
+%lang(ka) %{_datadir}/Cppcheck/lang/cppcheck_ka.qm
+%lang(ko) %{_datadir}/Cppcheck/lang/cppcheck_ko.qm
+%lang(nl) %{_datadir}/Cppcheck/lang/cppcheck_nl.qm
+%lang(ru) %{_datadir}/Cppcheck/lang/cppcheck_ru.qm
+%lang(sr) %{_datadir}/Cppcheck/lang/cppcheck_sr.qm
+%lang(sv) %{_datadir}/Cppcheck/lang/cppcheck_sv.qm
+%lang(zh_CN) %{_datadir}/Cppcheck/lang/cppcheck_zh_CN.qm
+%lang(zh_TW) %{_datadir}/Cppcheck/lang/cppcheck_zh_TW.qm
+%{_desktopdir}/cppcheck-gui.desktop
+%{_iconsdir}/hicolor/64x64/apps/cppcheck-gui.png
+%{_iconsdir}/hicolor/scalable/apps/cppcheck-gui.svg
 %endif
diff --git a/cppcheck-gui-paths.patch b/cppcheck-gui-paths.patch
deleted file mode 100644
index 7623c23..0000000
--- a/cppcheck-gui-paths.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- cppcheck-1.49/gui/translationhandler.cpp.orig	2011-06-12 18:28:04.000000000 +0200
-+++ cppcheck-1.49/gui/translationhandler.cpp	2011-06-17 11:33:12.852111676 +0200
-@@ -148,7 +148,7 @@
- {
-     TranslationInfo info;
-     info.mName = name;
--    info.mFilename = filename;
-+    info.mFilename = QString("/usr/share/cppcheck-gui/") + filename;
-     int codeLength = QString(filename).length() - QString(filename).indexOf('_') - 1;
-     info.mCode = QString(filename).right(codeLength);
-     mTranslations.append(info);
diff --git a/cppcheck-translations.patch b/cppcheck-translations.patch
index 7a353ac..fc95858 100644
--- a/cppcheck-translations.patch
+++ b/cppcheck-translations.patch
@@ -1,31 +1,30 @@
 --- cppcheck-1.72/gui/CMakeLists.txt.orig	2016-01-11 15:46:49.455670218 +0100
 +++ cppcheck-1.72/gui/CMakeLists.txt	2016-01-11 15:50:01.915662141 +0100
 @@ -29,7 +29,7 @@
- 
+     endif()
  
      install(TARGETS cppcheck-gui RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR} COMPONENT applications)
 -    install(FILES ${qms} DESTINATION ${CMAKE_INSTALL_FULL_BINDIR} COMPONENT applications)
 +    install(FILES ${qms} DESTINATION share/${PROJECT_NAME}/lang/ COMPONENT applications)
  
-     set(CMAKE_AUTOMOC OFF)
+     install(FILES cppcheck-gui.desktop DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications)
+ 
+--- cppcheck-2.20.0/gui/translationhandler.cpp.orig	2026-03-02 16:22:31.000000000 +0100
++++ cppcheck-2.20.0/gui/translationhandler.cpp	2026-05-17 12:36:45.903353628 +0200
+@@ -100,15 +100,7 @@
  
-diff -up cppcheck-1.70/gui/translationhandler.cpp.translations cppcheck-1.70/gui/translationhandler.cpp
---- cppcheck-1.70/gui/translationhandler.cpp.translations	2015-09-04 11:04:31.000000000 -0700
-+++ cppcheck-1.70/gui/translationhandler.cpp	2015-11-05 11:38:34.991299374 -0800
-@@ -106,15 +106,7 @@ bool TranslationHandler::SetLanguage(con
-     if (datadir.isEmpty())
-         datadir = appPath;
+         QString datadir = getDataDir();
  
--    QString translationFile;
--    if (QFile::exists(datadir + "/lang/" + mTranslations[index].mFilename + ".qm"))
--        translationFile = datadir + "/lang/" + mTranslations[index].mFilename + ".qm";
+-        QString translationFile;
+-        if (QFile::exists(datadir + "/lang/" + mTranslations[index].mFilename + ".qm"))
+-            translationFile = datadir + "/lang/" + mTranslations[index].mFilename + ".qm";
 -
--    else if (QFile::exists(datadir + "/" + mTranslations[index].mFilename + ".qm"))
--        translationFile = datadir + "/" + mTranslations[index].mFilename + ".qm";
+-        else if (QFile::exists(datadir + "/" + mTranslations[index].mFilename + ".qm"))
+-            translationFile = datadir + "/" + mTranslations[index].mFilename + ".qm";
 -
--    else
--        translationFile = appPath + "/" + mTranslations[index].mFilename + ".qm";
-+    QString translationFile("/usr/share/CppCheck/lang/" + mTranslations[index].mFilename + ".qm");
+-        else
+-            translationFile = appPath + "/" + mTranslations[index].mFilename + ".qm";
++        QString translationFile("/usr/share/CppCheck/lang/" + mTranslations[index].mFilename + ".qm");
  
-     if (!mTranslator->load(translationFile) && !failure) {
-         translationFile += ".qm";
+         if (!mTranslator->load(translationFile)) {
+             failure = true;
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/cppcheck.git/commitdiff/43a77345d212d9ce4020d82a79cbfffb1833976a



More information about the pld-cvs-commit mailing list