From 0994c5b3e5b21203c662f22a90943dd351745d01 Mon Sep 17 00:00:00 2001 From: Susi Lehtola Date: Thu, 12 Nov 2015 02:17:57 +0100 Subject: [PATCH 1/3] Disable SMP make. --- cppcheck.spec | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cppcheck.spec b/cppcheck.spec index 9d42850..f79bc72 100644 --- a/cppcheck.spec +++ b/cppcheck.spec @@ -60,7 +60,8 @@ mkdir objdir-%{_target_platform} cd objdir-%{_target_platform} # Upstream doesn't support shared libraries (unversioned solib) %cmake .. -DCMAKE_BUILD_TYPE=Release -DHAVE_RULES=1 -DBUILD_GUI=1 -DBUILD_SHARED_LIBS:BOOL=OFF -make %{?_smp_mflags} +# SMP make doesn't seem to work +make %install rm -rf %{buildroot} From 52e16fbe81efddeaeda9fbd004a44dfd910d84db Mon Sep 17 00:00:00 2001 From: Susi Lehtola Date: Fri, 13 Nov 2015 18:27:05 +0100 Subject: [PATCH 2/3] Fix BZ #1280242, patch by Mamoru Tasaka. --- cppcheck-1.70-link.patch | 22 ++++++++++++++++++++++ cppcheck.spec | 8 +++++++- 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 cppcheck-1.70-link.patch diff --git a/cppcheck-1.70-link.patch b/cppcheck-1.70-link.patch new file mode 100644 index 0000000..c695dde --- /dev/null +++ b/cppcheck-1.70-link.patch @@ -0,0 +1,22 @@ +--- cppcheck-1.70/cli/CMakeLists.txt.stlink 2015-11-13 15:07:57.987502410 +0900 ++++ cppcheck-1.70/cli/CMakeLists.txt 2015-11-13 16:13:30.256811541 +0900 +@@ -5,7 +5,7 @@ + file(GLOB mainfile "main.cpp") + list(REMOVE_ITEM srcs ${mainfile}) + +-link_libraries(${PROJECT_NAME} -ltinyxml2) ++link_libraries(-Wl,--whole-archive ${PROJECT_NAME} -Wl,--no-whole-archive -ltinyxml2) + + add_library(cli_lib OBJECT ${hdrs} ${srcs}) + +--- cppcheck-1.70/gui/CMakeLists.txt.stlink 2015-11-13 15:07:57.989502413 +0900 ++++ cppcheck-1.70/gui/CMakeLists.txt 2015-11-13 16:13:47.930824027 +0900 +@@ -21,7 +21,7 @@ + QT4_ADD_RESOURCES(resources "gui.qrc") + QT4_ADD_TRANSLATION(qms ${tss}) + +- link_libraries(${PROJECT_NAME} -ltinyxml2 ${QT_LIBRARIES}) ++ link_libraries(-Wl,--whole-archive ${PROJECT_NAME} -Wl,--no-whole-archive -ltinyxml2 ${QT_LIBRARIES}) + + add_executable(cppcheck-gui ${hdrs} ${srcs} ${uis_hdrs} ${resources} ${qms}) + diff --git a/cppcheck.spec b/cppcheck.spec index f79bc72..7e263d8 100644 --- a/cppcheck.spec +++ b/cppcheck.spec @@ -1,6 +1,6 @@ Name: cppcheck Version: 1.70 -Release: 3%{?dist} +Release: 4%{?dist} Summary: Tool for static C/C++ code analysis Group: Development/Languages License: GPLv3+ @@ -15,6 +15,8 @@ Patch0: cppcheck-1.70-tinyxml.patch Patch1: cppcheck-1.70-translations.patch # Fix library install suffix Patch2: cppcheck-1.70-libsuffix.patch +# Link whole library +Patch3: cppcheck-1.70-link.patch BuildRequires: pcre-devel BuildRequires: tinyxml2-devel >= 2.1.0 @@ -45,6 +47,7 @@ This package contains the graphical user interface for cppcheck. %patch0 -p1 -b .tinyxml %patch1 -p1 -b .translations %patch2 -p1 -b .libsuffix +%patch3 -p1 -b .link # Make sure bundled tinyxml is not used rm -r externals/tinyxml @@ -102,6 +105,9 @@ rm -rf %{buildroot} %changelog +* Fri Nov 13 2015 Susi Lehtola - 1.70-4 +- Link whole archive (BZ #1280242), patch by Mamoru Tasaka. + * Wed Nov 11 2015 Susi Lehtola - 1.70-3 - Enable HAVE_RULES. From bbcef80e636438f65a4f89e7bfd29c8cdfb0e960 Mon Sep 17 00:00:00 2001 From: Susi Lehtola Date: Fri, 13 Nov 2015 19:33:32 +0100 Subject: [PATCH 3/3] Compile tests with CMake. --- cppcheck.spec | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/cppcheck.spec b/cppcheck.spec index 7e263d8..52c8222 100644 --- a/cppcheck.spec +++ b/cppcheck.spec @@ -62,9 +62,9 @@ xsltproc --nonet -o man/manual.html \ mkdir objdir-%{_target_platform} cd objdir-%{_target_platform} # Upstream doesn't support shared libraries (unversioned solib) -%cmake .. -DCMAKE_BUILD_TYPE=Release -DHAVE_RULES=1 -DBUILD_GUI=1 -DBUILD_SHARED_LIBS:BOOL=OFF +%cmake .. -DCMAKE_BUILD_TYPE=Release -DHAVE_RULES=1 -DBUILD_GUI=1 -DBUILD_SHARED_LIBS:BOOL=OFF -DBUILD_TESTS=1 # SMP make doesn't seem to work -make +make cppcheck %install rm -rf %{buildroot} @@ -81,13 +81,8 @@ desktop-file-install --dir=%{buildroot}%{_datadir}/applications %{SOURCE1} install -D -p -m 644 gui/icon.png %{buildroot}%{_datadir}/pixmaps/cppcheck.png %check -# CMake build doesn't have check... -CXXFLAGS="%{optflags} -DNDEBUG $(pcre-config --cflags)" \ - LDFLAGS="$RPM_LD_FLAGS" LIBS=-ltinyxml2 make TINYXML= \ - CFGDIR=$(pwd)/cfg \ - HAVE_RULES=yes \ - DB2MAN=%{_datadir}/sgml/docbook/xsl-stylesheets/manpages/docbook.xsl \ - %{?_smp_mflags} check +cd objdir-%{_target_platform}/bin +./testrunner -g -q %clean rm -rf %{buildroot} @@ -107,6 +102,7 @@ rm -rf %{buildroot} %changelog * Fri Nov 13 2015 Susi Lehtola - 1.70-4 - Link whole archive (BZ #1280242), patch by Mamoru Tasaka. +- Compile and run tests using CMake. * Wed Nov 11 2015 Susi Lehtola - 1.70-3 - Enable HAVE_RULES.