From bc53bd0890a0a7739b985659adab598f9f4756c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20St=C3=B6ggl?= Date: Wed, 23 Mar 2022 06:10:01 +0100 Subject: [PATCH] Update tinyxml2 patch and add upstream link - Do not use z3 in case of i686. The i686 build fails since z3-4.8.15-1 --- cppcheck-2.7.3-tinyxml2.patch | 44 +++++++++++++++++++++++++++++++---- cppcheck.spec | 16 ++++++++++--- 2 files changed, 53 insertions(+), 7 deletions(-) diff --git a/cppcheck-2.7.3-tinyxml2.patch b/cppcheck-2.7.3-tinyxml2.patch index be17894..7dd6a97 100644 --- a/cppcheck-2.7.3-tinyxml2.patch +++ b/cppcheck-2.7.3-tinyxml2.patch @@ -1,15 +1,51 @@ +From 4ae07fe4859108638e244912a21245c2156eb8f9 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Wolfgang=20St=C3=B6ggl?= +Date: Tue, 22 Mar 2022 21:41:44 +0100 +Subject: [PATCH] Set tinyxml2_LIBRARIES after find_package() + +If tinyxml2 is found by find_package(), then tinyxml2_LIBRARIES +is empty. Set tinyxml2_LIBRARIES to "tinyxml2::tinyxml2" in this case. + +- Fixes "undefined reference to `tinyxml2::" +- printInfo.cmake: Fix indentation of tinyxml2_LIBRARIES +--- + cmake/findDependencies.cmake | 5 +++-- + cmake/printInfo.cmake | 3 ++- + 2 files changed, 5 insertions(+), 3 deletions(-) + diff --git a/cmake/findDependencies.cmake b/cmake/findDependencies.cmake -index 4d5b9efc5..6f6d9210c 100644 +index 4d5b9efc5e..b8c181763e 100644 --- a/cmake/findDependencies.cmake +++ b/cmake/findDependencies.cmake -@@ -48,7 +48,9 @@ endif() +@@ -48,12 +48,13 @@ endif() if (NOT USE_BUNDLED_TINYXML2) find_package(tinyxml2 QUIET) - if (NOT tinyxml2_FOUND) -+ if (tinyxml2_FOUND) -+ set(tinyxml2_LIBRARIES "tinyxml2") ++ if (TARGET tinyxml2::tinyxml2) ++ set(tinyxml2_LIBRARIES "tinyxml2::tinyxml2") + else() find_library(tinyxml2_LIBRARIES tinyxml2) if (NOT tinyxml2_LIBRARIES) message(FATAL_ERROR "tinyxml2 has not been found") + else() +- message(STATUS "tinyxml2_LIBRARY: ${tinyxml2_LIBRARY}") + set(tinyxml2_FOUND 1) + endif() + endif() +diff --git a/cmake/printInfo.cmake b/cmake/printInfo.cmake +index 2fd971b1de..da5d15c211 100644 +--- a/cmake/printInfo.cmake ++++ b/cmake/printInfo.cmake +@@ -52,9 +52,10 @@ if (USE_Z3) + message( STATUS "Z3_LIBRARIES = ${Z3_LIBRARIES}" ) + message( STATUS "Z3_CXX_INCLUDE_DIRS = ${Z3_CXX_INCLUDE_DIRS}" ) + endif() ++message( STATUS ) + message( STATUS "USE_BUNDLED_TINYXML2 = ${USE_BUNDLED_TINYXML2}" ) + if (NOT USE_BUNDLED_TINYXML2) +- message(STATUS "tinyxml2_LIBRARIES = ${tinyxml2_LIBRARIES}") ++ message(STATUS "tinyxml2_LIBRARIES = ${tinyxml2_LIBRARIES}") + endif() + message( STATUS ) + diff --git a/cppcheck.spec b/cppcheck.spec index 0d193ea..32bb65c 100644 --- a/cppcheck.spec +++ b/cppcheck.spec @@ -1,8 +1,15 @@ %undefine __cmake_in_source_build +%ifarch i686 +# i686 build fails since z3-4.8.15-1 +%define use_z3 no +%else +%define use_z3 yes +%endif + Name: cppcheck Version: 2.7.3 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Tool for static C/C++ code analysis License: GPLv3+ URL: http://cppcheck.wiki.sourceforge.net/ @@ -13,7 +20,7 @@ Patch0: cppcheck-2.2-translations.patch # Select python3 explicitly Patch1: cppcheck-1.88-htmlreport-python3.patch # Fix undefined reference to tinyxml2 -# cmake/findDependencies.cmake: tinyxml2 is found by find_package(tinyxml2 QUIET) +# https://github.com/danmar/cppcheck/pull/3932 Patch2: cppcheck-2.7.3-tinyxml2.patch BuildRequires: gcc-c++ @@ -76,7 +83,7 @@ pandoc man/reference-cfg-format.md -o man/reference-cfg-format.html -s --number- # Binaries # Upstream doesn't support shared libraries (unversioned solib) -%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 -DENABLE_OSS_FUZZ=OFF +%cmake -DCMAKE_BUILD_TYPE=Release -DUSE_MATCHCOMPILER=yes -DUSE_Z3=%{use_z3} -DHAVE_RULES=yes -DBUILD_GUI=1 -DBUILD_SHARED_LIBS:BOOL=OFF -DBUILD_TESTS=yes -DFILESDIR=%{_datadir}/Cppcheck -DUSE_BUNDLED_TINYXML2=OFF -DENABLE_OSS_FUZZ=OFF %cmake_build %install @@ -117,6 +124,9 @@ cd %{_vpath_builddir}/bin %{_bindir}/cppcheck-htmlreport %changelog +* Wed Mar 23 2022 Wolfgang Stöggl - 2.7.3-2 +- Update tinyxml2 patch, add upstream link and rebuild + * Sat Mar 19 2022 Wolfgang Stöggl - 2.7.3-1 - Update to 2.7.3.