diff --git a/cppcheck-1.70-libsuffix.patch b/cppcheck-1.70-libsuffix.patch new file mode 100644 index 0000000..f6f0b51 --- /dev/null +++ b/cppcheck-1.70-libsuffix.patch @@ -0,0 +1,14 @@ +diff -up cppcheck-1.70/lib/CMakeLists.txt.orig cppcheck-1.70/lib/CMakeLists.txt +--- cppcheck-1.70/lib/CMakeLists.txt.orig 2015-09-04 11:04:31.000000000 -0700 ++++ cppcheck-1.70/lib/CMakeLists.txt 2015-11-05 11:08:44.996474289 -0800 +@@ -42,8 +42,8 @@ endif() + + install(TARGETS ${PROJECT_NAME} + RUNTIME DESTINATION bin COMPONENT libraries +- LIBRARY DESTINATION lib PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE COMPONENT libraries +- ARCHIVE DESTINATION lib COMPONENT libraries) ++ LIBRARY DESTINATION lib${LIB_SUFFIX} PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE COMPONENT libraries ++ ARCHIVE DESTINATION lib${LIB_SUFFIX} COMPONENT libraries) + + install(FILES ${hdrs} + DESTINATION include/${PROJECT_NAME}/ diff --git a/cppcheck-1.70-tinyxml.patch b/cppcheck-1.70-tinyxml.patch new file mode 100644 index 0000000..25d6f00 --- /dev/null +++ b/cppcheck-1.70-tinyxml.patch @@ -0,0 +1,66 @@ +diff -up cppcheck-1.70/cli/CMakeLists.txt.tinyxml cppcheck-1.70/cli/CMakeLists.txt +--- cppcheck-1.70/cli/CMakeLists.txt.tinyxml 2015-09-04 20:04:31.000000000 +0200 ++++ cppcheck-1.70/cli/CMakeLists.txt 2015-11-05 18:53:51.310937488 +0100 +@@ -1,4 +1,3 @@ +-include_directories(SYSTEM ${PROJECT_SOURCE_DIR}/externals/tinyxml/) + include_directories(${PROJECT_SOURCE_DIR}/lib/) + + file(GLOB hdrs "*.h") +@@ -6,7 +5,7 @@ file(GLOB srcs "*.cpp") + file(GLOB mainfile "main.cpp") + list(REMOVE_ITEM srcs ${mainfile}) + +-link_libraries(${PROJECT_NAME} tinyxml) ++link_libraries(${PROJECT_NAME} -ltinyxml2) + + add_library(cli_lib OBJECT ${hdrs} ${srcs}) + +diff -up cppcheck-1.70/CMakeLists.txt.tinyxml cppcheck-1.70/CMakeLists.txt +--- cppcheck-1.70/CMakeLists.txt.tinyxml 2015-09-04 20:04:31.000000000 +0200 ++++ cppcheck-1.70/CMakeLists.txt 2015-11-05 18:54:41.847932573 +0100 +@@ -10,7 +10,6 @@ include(cmake/buildFiles.cmake REQUIRED) + + file(GLOB cfgs "cfg/*.cfg") + +-add_subdirectory(externals/tinyxml) + add_subdirectory(lib) # CppCheck Library + add_subdirectory(cli) # Client application + add_subdirectory(test) # Tests +diff -up cppcheck-1.70/gui/CMakeLists.txt.tinyxml cppcheck-1.70/gui/CMakeLists.txt +--- cppcheck-1.70/gui/CMakeLists.txt.tinyxml 2015-09-04 20:04:31.000000000 +0200 ++++ cppcheck-1.70/gui/CMakeLists.txt 2015-11-05 18:54:32.016937559 +0100 +@@ -11,7 +11,6 @@ if (BUILD_GUI) + endif() + + +- include_directories(SYSTEM ${PROJECT_SOURCE_DIR}/externals/tinyxml/) + include_directories(${PROJECT_SOURCE_DIR}/lib/) + + file(GLOB hdrs "*.h") +@@ -22,7 +21,7 @@ if (BUILD_GUI) + QT4_ADD_RESOURCES(resources "gui.qrc") + QT4_ADD_TRANSLATION(qms ${tss}) + +- link_libraries(${PROJECT_NAME} tinyxml ${QT_LIBRARIES}) ++ link_libraries(${PROJECT_NAME} -ltinyxml2 ${QT_LIBRARIES}) + + add_executable(cppcheck-gui ${hdrs} ${srcs} ${uis_hdrs} ${resources} ${qms}) + +diff -up cppcheck-1.70/test/CMakeLists.txt.tinyxml cppcheck-1.70/test/CMakeLists.txt +--- cppcheck-1.70/test/CMakeLists.txt.tinyxml 2015-09-04 20:04:31.000000000 +0200 ++++ cppcheck-1.70/test/CMakeLists.txt 2015-11-05 18:54:08.667937833 +0100 +@@ -3,13 +3,12 @@ if (BUILD_TESTS) + include_directories( + ${PROJECT_SOURCE_DIR}/lib/ + ${PROJECT_SOURCE_DIR}/cli/ +- ${PROJECT_SOURCE_DIR}/externals/tinyxml + ) + + file(GLOB hdrs "*.h") + file(GLOB srcs "*.cpp") + +- link_libraries(${PROJECT_NAME} tinyxml) ++ link_libraries(${PROJECT_NAME} -ltinyxml2) + + add_executable(testrunner ${hdrs} ${srcs} + $ diff --git a/cppcheck-1.70-translations.patch b/cppcheck-1.70-translations.patch new file mode 100644 index 0000000..3f6e0fb --- /dev/null +++ b/cppcheck-1.70-translations.patch @@ -0,0 +1,12 @@ +diff -up cppcheck-1.70/gui/CMakeLists.txt.orig cppcheck-1.70/gui/CMakeLists.txt +--- cppcheck-1.70/gui/CMakeLists.txt.orig 2015-11-05 10:38:42.248204919 -0800 ++++ cppcheck-1.70/gui/CMakeLists.txt 2015-11-05 10:45:01.897795689 -0800 +@@ -26,7 +26,7 @@ if (BUILD_GUI) + add_executable(cppcheck-gui ${hdrs} ${srcs} ${uis_hdrs} ${resources} ${qms}) + + install(TARGETS cppcheck-gui RUNTIME DESTINATION bin COMPONENT applications) +- install(FILES ${qms} DESTINATION bin COMPONENT applications) ++ install(FILES ${qms} DESTINATION share/${PROJECT_NAME}/ COMPONENT applications) + + set(CMAKE_AUTOMOC OFF) + diff --git a/cppcheck.spec b/cppcheck.spec index d6fc544..42cf4de 100644 --- a/cppcheck.spec +++ b/cppcheck.spec @@ -8,10 +8,19 @@ URL: http://cppcheck.wiki.sourceforge.net/ Source0: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.bz2 BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) +# Use system tinyxml2 +Patch0: cppcheck-1.70-tinyxml.patch +# Fix location of translations +Patch1: cppcheck-1.70-translations.patch +# Fix library install suffix +Patch2: cppcheck-1.70-libsuffix.patch + BuildRequires: pcre-devel BuildRequires: tinyxml2-devel >= 2.1.0 BuildRequires: docbook-style-xsl BuildRequires: libxslt +BuildRequires: qt4-devel +BuildRequires: cmake %description Cppcheck is a static analysis tool for C/C++ code. Unlike C/C++ @@ -20,34 +29,44 @@ 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). +%package gui +Summary: Graphical user interface for cppcheck +Group: Applications/Engineering +Requires: %{name}%{?_isa} = %{version}-%{release} + +%description gui +This package contains the graphical user interface for cppcheck. + %prep %setup -q +%patch0 -p1 -b .tinyxml +%patch1 -p1 -b .translations +%patch2 -p1 -b .libsuffix # Make sure bundled tinyxml is not used rm -r externals/tinyxml %build -# TINYXML= prevents use of bundled tinyxml -CXXFLAGS="%{optflags} -DNDEBUG $(pcre-config --cflags)" \ - LDFLAGS="$RPM_LD_FLAGS" LIBS=-ltinyxml2 make TINYXML= \ - CFGDIR=%{_datadir}/%{name} \ - HAVE_RULES=yes \ - DB2MAN=%{_datadir}/sgml/docbook/xsl-stylesheets/manpages/docbook.xsl \ - %{?_smp_mflags} all man +# Manuals +make DB2MAN=%{_datadir}/sgml/docbook/xsl-stylesheets/manpages/docbook.xsl man xsltproc --nonet -o man/manual.html \ %{_datadir}/sgml/docbook/xsl-stylesheets/xhtml/docbook.xsl \ man/manual.docbook +# Binaries +mkdir objdir-%{_target_platform} +cd objdir-%{_target_platform} +# Upstream doesn't support shared libraries (unversioned solib) +%cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_GUI=1 -DBUILD_SHARED_LIBS:BOOL=OFF + %install rm -rf %{buildroot} -install -D -p -m 755 cppcheck %{buildroot}%{_bindir}/cppcheck +make -C objdir-%{_target_platform} DESTDIR=%{buildroot} install install -D -p -m 644 cppcheck.1 %{buildroot}%{_mandir}/man1/cppcheck.1 -# Install cfg files -cd cfg -for f in *; do - install -D -p -m 644 $f %{buildroot}%{_datadir}/cppcheck/$f -done +# Don't ship devel stuff +rm -rf %{buildroot}%{_includedir}/CppCheck +rm %{buildroot}%{_libdir}/libCppCheck.* %check # Config is not available in the system-wide directory - delete executables and recompile @@ -63,12 +82,15 @@ CXXFLAGS="%{optflags} -DNDEBUG $(pcre-config --cflags)" \ rm -rf %{buildroot} %files -%defattr(-,root,root,-) %doc AUTHORS COPYING man/manual.html -%{_datadir}/cppcheck/ +%{_datadir}/CppCheck/ %{_bindir}/cppcheck %{_mandir}/man1/cppcheck.1* +%files gui +%{_bindir}/cppcheck-gui + + %changelog * Mon Sep 21 2015 Susi Lehtola - 1.70-1 - Update to 1.70.