Compare commits

...

4 Commits

Author SHA1 Message Date
Wolfgang Stöggl f1c75b0502 Update to 2.7
- Remove patch:
  cppcheck-2.5-disable-test-testexprengine-array7.patch
2022-02-16 19:01:04 +01:00
Wolfgang Stöggl adcd842a08 Update to 2.6 2021-10-12 17:37:47 +02:00
Wolfgang Stöggl 699b9f1abe Update to 2.5
- Remove the following patch, which is not needed anymore in 2.5:
  cppcheck-2.3-gcc11.patch
- Add patch: cppcheck-2.5-disable-test-testexprengine-array7.patch
2021-07-10 07:08:42 +02:00
Wolfgang Stöggl 6dfcc379fa Update to 2.3
- Update spec file to current version from rawhide
- Enable building for EPEL 7 (#1902223)
2020-12-08 14:29:38 +01:00
5 changed files with 82 additions and 139 deletions

4
.gitignore vendored
View File

@ -41,3 +41,7 @@ cppcheck-1.44.tar.bz2
/cppcheck-1.88.tar.gz
/cppcheck-1.89.tar.gz
/cppcheck-1.90.tar.gz
/cppcheck-2.3.tar.gz
/cppcheck-2.5.tar.gz
/cppcheck-2.6.tar.gz
/cppcheck-2.7.tar.gz

View File

@ -1,84 +0,0 @@
diff -urp a/cli/CMakeLists.txt b/cli/CMakeLists.txt
--- a/cli/CMakeLists.txt 2019-12-21 11:51:10.000000000 +0100
+++ b/cli/CMakeLists.txt 2019-12-21 23:29:02.266101262 +0100
@@ -1,5 +1,4 @@
include_directories(${PROJECT_SOURCE_DIR}/lib/)
-include_directories(SYSTEM ${PROJECT_SOURCE_DIR}/externals/tinyxml/)
include_directories(${PROJECT_SOURCE_DIR}/externals/simplecpp/)
file(GLOB hdrs "*.h")
@@ -8,7 +7,7 @@ file(GLOB mainfile "main.cpp")
list(REMOVE_ITEM srcs ${mainfile})
add_library(cli_objs OBJECT ${hdrs} ${srcs})
-add_executable(cppcheck ${hdrs} ${mainfile} $<TARGET_OBJECTS:cli_objs> $<TARGET_OBJECTS:lib_objs> $<TARGET_OBJECTS:tinyxml_objs> $<TARGET_OBJECTS:simplecpp_objs>)
+add_executable(cppcheck ${hdrs} ${mainfile} $<TARGET_OBJECTS:cli_objs> $<TARGET_OBJECTS:lib_objs> $<TARGET_OBJECTS:simplecpp_objs>)
if (HAVE_RULES)
find_library(PCRE_LIBRARY pcre)
target_link_libraries(cppcheck ${PCRE_LIBRARY})
@@ -18,6 +17,7 @@ endif()
if (WIN32 AND NOT BORLAND)
target_link_libraries(cppcheck Shlwapi.lib)
endif()
+target_link_libraries(cppcheck tinyxml2)
install(TARGETS cppcheck
RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR}
diff -urp a/CMakeLists.txt b/CMakeLists.txt
--- a/CMakeLists.txt 2019-12-21 11:51:10.000000000 +0100
+++ b/CMakeLists.txt 2019-12-21 23:30:07.419801154 +0100
@@ -21,7 +21,6 @@ if (BUILD_TESTS)
enable_testing()
endif()
-add_subdirectory(externals/tinyxml)
add_subdirectory(externals/simplecpp)
add_subdirectory(lib) # CppCheck Library
add_subdirectory(cli) # Client application
diff -urp a/gui/CMakeLists.txt b/gui/CMakeLists.txt
--- a/gui/CMakeLists.txt 2019-12-21 11:51:10.000000000 +0100
+++ b/gui/CMakeLists.txt 2019-12-21 23:33:01.688541115 +0100
@@ -10,7 +10,6 @@ if (BUILD_GUI)
endif()
include_directories(${PROJECT_SOURCE_DIR}/lib/)
- include_directories(SYSTEM ${PROJECT_SOURCE_DIR}/externals/tinyxml/)
file(GLOB hdrs "*.h")
file(GLOB srcs "*.cpp")
@@ -20,11 +19,11 @@ if (BUILD_GUI)
QT5_ADD_RESOURCES(resources "gui.qrc")
QT5_ADD_TRANSLATION(qms ${tss})
- add_executable(cppcheck-gui ${hdrs} ${srcs} ${uis_hdrs} ${resources} ${qms} $<TARGET_OBJECTS:lib_objs> $<TARGET_OBJECTS:tinyxml_objs> $<TARGET_OBJECTS:simplecpp_objs>)
+ add_executable(cppcheck-gui ${hdrs} ${srcs} ${uis_hdrs} ${resources} ${qms} $<TARGET_OBJECTS:lib_objs> $<TARGET_OBJECTS:simplecpp_objs>)
if (HAVE_RULES)
target_link_libraries(cppcheck-gui pcre)
endif()
- target_link_libraries(cppcheck-gui Qt5::Core Qt5::Gui Qt5::Widgets Qt5::PrintSupport)
+ target_link_libraries(cppcheck-gui tinyxml2 Qt5::Core Qt5::Gui Qt5::Widgets Qt5::PrintSupport)
if(WITH_QCHART)
target_compile_definitions (cppcheck-gui PRIVATE HAVE_QCHART )
target_link_libraries(cppcheck-gui Qt5::Charts)
diff -urp a/test/CMakeLists.txt b/test/CMakeLists.txt
--- a/test/CMakeLists.txt 2019-12-21 11:51:10.000000000 +0100
+++ b/test/CMakeLists.txt 2019-12-21 23:34:50.432203245 +0100
@@ -12,16 +12,16 @@ if (BUILD_TESTS)
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -j ${CTEST_PARALLEL_LEVEL} -C ${CMAKE_CFG_INTDIR} --timeout 90)
include_directories(${PROJECT_SOURCE_DIR}/lib/ ${PROJECT_SOURCE_DIR}/cli/)
- include_directories(SYSTEM ${PROJECT_SOURCE_DIR}/externals/tinyxml)
include_directories(${PROJECT_SOURCE_DIR}/externals/simplecpp/)
file(GLOB hdrs "*.h")
file(GLOB srcs "*.cpp")
- add_executable(testrunner ${hdrs} ${srcs} $<TARGET_OBJECTS:lib_objs> $<TARGET_OBJECTS:cli_objs> $<TARGET_OBJECTS:tinyxml_objs> $<TARGET_OBJECTS:simplecpp_objs>)
+ add_executable(testrunner ${hdrs} ${srcs} $<TARGET_OBJECTS:lib_objs> $<TARGET_OBJECTS:cli_objs> $<TARGET_OBJECTS:simplecpp_objs>)
if (HAVE_RULES)
target_link_libraries(testrunner pcre)
endif()
+ target_link_libraries(testrunner tinyxml2)
add_custom_target(copy_cfg ALL
COMMENT "Copying cfg files")

View File

@ -1,7 +1,7 @@
diff -urp cppcheck-1.89.orig/gui/CMakeLists.txt cppcheck-1.89/gui/CMakeLists.txt
--- cppcheck-1.89.orig/gui/CMakeLists.txt 2019-12-07 13:41:32.651559443 -0500
+++ cppcheck-1.89/gui/CMakeLists.txt 2019-12-07 13:45:16.037535529 -0500
@@ -30,7 +30,7 @@ if (BUILD_GUI)
diff -urp cppcheck-2.2.orig/gui/CMakeLists.txt cppcheck-2.2/gui/CMakeLists.txt
--- cppcheck-2.2.orig/gui/CMakeLists.txt 2020-10-03 11:05:53.000000000 +0200
+++ cppcheck-2.2/gui/CMakeLists.txt 2020-10-04 07:18:23.309796000 +0200
@@ -40,7 +40,7 @@ if (BUILD_GUI)
endif()
install(TARGETS cppcheck-gui RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR} COMPONENT applications)
@ -10,12 +10,12 @@ diff -urp cppcheck-1.89.orig/gui/CMakeLists.txt cppcheck-1.89/gui/CMakeLists.txt
install(FILES cppcheck-gui.desktop DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications)
diff -urp cppcheck-1.89.orig/gui/translationhandler.cpp cppcheck-1.89/gui/translationhandler.cpp
--- cppcheck-1.89.orig/gui/translationhandler.cpp 2019-09-01 09:01:12.000000000 -0400
+++ cppcheck-1.89/gui/translationhandler.cpp 2019-12-07 13:46:47.085525782 -0500
@@ -116,15 +116,7 @@ bool TranslationHandler::setLanguage(con
if (datadir.isEmpty())
datadir = appPath;
diff -urp cppcheck-2.2.orig/gui/translationhandler.cpp cppcheck-2.2/gui/translationhandler.cpp
--- cppcheck-2.2.orig/gui/translationhandler.cpp 2020-10-03 11:05:53.000000000 +0200
+++ cppcheck-2.2/gui/translationhandler.cpp 2020-10-04 07:19:44.765892500 +0200
@@ -113,15 +113,7 @@ bool TranslationHandler::setLanguage(con
QString datadir = getDataDir();
- QString translationFile;
- if (QFile::exists(datadir + "/lang/" + mTranslations[index].mFilename + ".qm"))
@ -26,7 +26,7 @@ diff -urp cppcheck-1.89.orig/gui/translationhandler.cpp cppcheck-1.89/gui/transl
-
- else
- translationFile = appPath + "/" + mTranslations[index].mFilename + ".qm";
+ QString translationFile("/usr/share/Cppcheck/lang/" + mTranslations[index].mFilename + ".qm");
+ QString translationFile("/usr/share/Cppcheck/lang/" + mTranslations[index].mFilename + ".qm");
if (!mTranslator->load(translationFile) && !failure) {
//If it failed, lets check if the default file exists

View File

@ -1,20 +1,26 @@
# Gui built in all branches
%global gui 1
%undefine __cmake_in_source_build
%undefine __cmake3_in_source_build
%if 0%{?rhel} == 7
# Build fails with tinyxml2 version in EPEL 7 (currently tinyxml2-devel-2.1.0-2.20140406git6ee53e7)
# use more recent, bundled version
%global BUNDLED_TINYXML2 1
%else
%global BUNDLED_TINYXML2 0
%endif
Name: cppcheck
Version: 1.90
Release: 4%{?dist}
Version: 2.7
Release: 1%{?dist}
Summary: Tool for static C/C++ code analysis
License: GPLv3+
URL: http://cppcheck.wiki.sourceforge.net/
Source0: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz
Source0: https://github.com/danmar/%{name}/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz
# Use system tinyxml2
Patch0: cppcheck-1.90-tinyxml.patch
# Fix location of translations
Patch1: cppcheck-1.89-translations.patch
Patch0: cppcheck-2.2-translations.patch
# Select python3 explicitly
Patch2: cppcheck-1.88-htmlreport-python3.patch
Patch1: cppcheck-1.88-htmlreport-python3.patch
BuildRequires: gcc-c++
BuildRequires: pcre-devel
@ -24,22 +30,18 @@ BuildRequires: pandoc
BuildRequires: desktop-file-utils
BuildRequires: tinyxml2-devel >= 2.1.0
BuildRequires: zlib-devel
%if %{gui}
%if 0%{?rhel} == 7
# no qt5-devel metapackage!
BuildRequires: qt5-qtbase-devel
BuildRequires: qt5-qttools-devel
BuildRequires: qt5-linguist
BuildRequires: python%{python3_pkgversion}-devel
%if 0%{?rhel} >= 7
BuildRequires: cmake3
BuildRequires: python%{python3_pkgversion}-devel
%else
BuildRequires: qt5-devel
BuildRequires: python3-devel
BuildRequires: cmake
BuildRequires: python3-devel
BuildRequires: z3-devel >= 4.7.1
%endif
%else
Obsoletes: %{name}-gui < %{version}-%{release}
%endif
%description
Cppcheck is a static analysis tool for C/C++ code. Unlike C/C++
@ -48,20 +50,17 @@ errors in the code. Cppcheck primarily detects the types of bugs that
the compilers normally do not detect. The goal is to detect only real
errors in the code (i.e. have zero false positives).
%if %{gui}
%package gui
Summary: Graphical user interface for cppcheck
Requires: %{name}%{?_isa} = %{version}-%{release}
%description gui
This package contains the graphical user interface for cppcheck.
%endif
%package htmlreport
Summary: HTML reporting for cppcheck
Requires: %{name}%{?_isa} = %{version}-%{release}
%if 0%{?rhel} == 7
# RHEL packages aren't versioned
%if 0%{?rhel} >= 7
Requires: python%{python3_pkgversion}-pygments
%else
Requires: python3-pygments
@ -73,11 +72,22 @@ from xml files first generated using cppcheck.
%prep
%setup -q
%patch0 -p1 -b .tinyxml
%patch1 -p1 -b .translations
%patch2 -p1 -b .python3
# Make sure bundled tinyxml is not used
rm -r externals/tinyxml
%patch0 -p1 -b .translations
%patch1 -p1 -b .python3
%if !0%{?BUNDLED_TINYXML2}
# Make sure bundled tinyxml2 is not used
rm -r externals/tinyxml2
%endif
# Generate the Qt online-help file
cd gui/help
%if 0%{?rhel} == 7
# Use deprecated qcollectiongenerator with Qt < 5.12
qcollectiongenerator-qt5 online-help.qhcp -o online-help.qhc
%else
qhelpgenerator-qt5 online-help.qhcp -o online-help.qhc
%endif
%build
# Manuals
@ -86,35 +96,37 @@ pandoc man/manual.md -o man/manual.html -s --number-sections --toc
pandoc man/reference-cfg-format.md -o man/reference-cfg-format.html -s --number-sections --toc
# Binaries
mkdir objdir-%{_target_platform}
cd objdir-%{_target_platform}
# Upstream doesn't support shared libraries (unversioned solib)
%if 0%{?rhel} == 7
%cmake3 .. -DCMAKE_BUILD_TYPE=Release -DUSE_MATCHCOMPILER=yes -DHAVE_RULES=yes -DBUILD_GUI=%{gui} -DBUILD_SHARED_LIBS:BOOL=OFF -DBUILD_TESTS=yes -DFILESDIR=%{_datadir}/Cppcheck
%if 0%{?rhel} >= 7
# Build without Z3
%cmake3 -DCMAKE_BUILD_TYPE=Release -DUSE_MATCHCOMPILER=yes -DHAVE_RULES=yes -DBUILD_GUI=1 -DBUILD_SHARED_LIBS:BOOL=OFF -DBUILD_TESTS=yes -DFILESDIR=%{_datadir}/Cppcheck -DUSE_BUNDLED_TINYXML2=%BUNDLED_TINYXML2
%cmake3_build
%else
%cmake .. -DCMAKE_BUILD_TYPE=Release -DUSE_MATCHCOMPILER=yes -DHAVE_RULES=yes -DBUILD_GUI=%{gui} -DBUILD_SHARED_LIBS:BOOL=OFF -DBUILD_TESTS=yes -DFILESDIR=%{_datadir}/Cppcheck
%cmake -DCMAKE_BUILD_TYPE=Release -DUSE_MATCHCOMPILER=yes -DUSE_Z3=yes -DHAVE_RULES=yes -DBUILD_GUI=1 -DBUILD_SHARED_LIBS:BOOL=OFF -DBUILD_TESTS=yes -DFILESDIR=%{_datadir}/Cppcheck -DUSE_BUNDLED_TINYXML2=OFF
%cmake_build
%endif
# SMP make doesn't seem to work
make cppcheck
%install
rm -rf %{buildroot}
make -C objdir-%{_target_platform} DESTDIR=%{buildroot} install
%if 0%{?rhel} >= 7
%cmake3_install
%else
%cmake_install
%endif
install -D -p -m 644 cppcheck.1 %{buildroot}%{_mandir}/man1/cppcheck.1
%if %{gui}
# Install desktop file
desktop-file-validate %{buildroot}%{_datadir}/applications/cppcheck-gui.desktop
# Install logo
install -D -p -m 644 gui/cppcheck-gui.png %{buildroot}%{_datadir}/pixmaps/cppcheck-gui.png
%endif
# Install the Qt online-help file
install -D -p -m 644 gui/help/online-help.qhc %{buildroot}%{_datadir}/Cppcheck/help/online-help.qhc
install -D -p -m 644 gui/help/online-help.qch %{buildroot}%{_datadir}/Cppcheck/help/online-help.qch
# Install htmlreport
install -D -p -m 755 htmlreport/cppcheck-htmlreport %{buildroot}%{_bindir}/cppcheck-htmlreport
%check
cd objdir-%{_target_platform}/bin
cd %{_vpath_builddir}/bin
./testrunner -g -q
%files
@ -124,19 +136,30 @@ cd objdir-%{_target_platform}/bin
%{_bindir}/cppcheck
%{_mandir}/man1/cppcheck.1*
%if %{gui}
%files gui
%{_bindir}/cppcheck-gui
%{_datadir}/applications/cppcheck-gui.desktop
%{_datadir}/pixmaps/cppcheck-gui.png
%{_datadir}/icons/hicolor/64x64/apps/cppcheck-gui.png
%{_datadir}/icons/hicolor/scalable/apps/cppcheck-gui.svg
%endif
%files htmlreport
%{_bindir}/cppcheck-htmlreport
%changelog
* Tue Feb 08 2022 Wolfgang Stöggl <c72578@yahoo.de> - 2.7-1
- Update to 2.7.
* Sat Oct 02 2021 Wolfgang Stöggl <c72578@yahoo.de> - 2.6-1
- Update to 2.6.
* Sun Jul 04 2021 Wolfgang Stöggl <c72578@yahoo.de> - 2.5-1
- Update to 2.5.
* Tue Dec 08 2020 Wolfgang Stöggl <c72578@yahoo.de> - 2.3-1
- Update to 2.3.
- Enable building for EPEL 7 (#1902223)
* Tue Dec 24 2019 Wolfgang Stöggl <c72578@yahoo.de> - 1.90-4
- Use python3 on EPEL7

View File

@ -1 +1 @@
SHA512 (cppcheck-1.90.tar.gz) = 9d78ed05af3d46f399de1a993859cf41ec3abc9cd869e1e85c10af7f70e00487ada0c0134d049e0ace50b3f4913680b4f0e4fa94a5fde13833285879994303db
SHA512 (cppcheck-2.7.tar.gz) = 22da64126ec76fa2b3c533fe4c82d8c3a46a274bce78aa2495bffed5491c604891ba46684499a28a4a22ab928979e9388e52df36ad0e2b001b81619c26791aad