From 19d37668800c067d7dec47cbf5d674db7fed08af Mon Sep 17 00:00:00 2001 From: Susi Lehtola Date: Thu, 5 Nov 2015 20:46:34 +0100 Subject: [PATCH] Include GUI. --- cppcheck-1.70-translations.patch | 28 ++++++++++++++++++++++++---- cppcheck.desktop | 11 +++++++++++ cppcheck.spec | 17 ++++++++++++++--- 3 files changed, 49 insertions(+), 7 deletions(-) create mode 100644 cppcheck.desktop diff --git a/cppcheck-1.70-translations.patch b/cppcheck-1.70-translations.patch index 3f6e0fb..cfbbd49 100644 --- a/cppcheck-1.70-translations.patch +++ b/cppcheck-1.70-translations.patch @@ -1,12 +1,32 @@ -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 +diff -up cppcheck-1.70/gui/CMakeLists.txt.translations cppcheck-1.70/gui/CMakeLists.txt +--- cppcheck-1.70/gui/CMakeLists.txt.translations 2015-11-05 11:37:19.343945331 -0800 ++++ cppcheck-1.70/gui/CMakeLists.txt 2015-11-05 11:37:19.344945349 -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) ++ install(FILES ${qms} DESTINATION share/${PROJECT_NAME}/lang/ COMPONENT applications) set(CMAKE_AUTOMOC OFF) +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 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 +- translationFile = appPath + "/" + mTranslations[index].mFilename + ".qm"; ++ QString translationFile("/usr/share/CppCheck/lang/" + mTranslations[index].mFilename + ".qm"); + + if (!mTranslator->load(translationFile) && !failure) { + translationFile += ".qm"; diff --git a/cppcheck.desktop b/cppcheck.desktop new file mode 100644 index 0000000..06c7311 --- /dev/null +++ b/cppcheck.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Name=CppCheck +GenericName=C++ Source code analyzer +Comment=Perform static code analysis on your C++ programs +Exec=cppcheck-gui +Icon=cppcheck +Terminal=false +Type=Application +StartupNotify=true +Categories=Development;Utility;Qt; + diff --git a/cppcheck.spec b/cppcheck.spec index 42cf4de..2b43037 100644 --- a/cppcheck.spec +++ b/cppcheck.spec @@ -1,11 +1,12 @@ Name: cppcheck Version: 1.70 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Tool for static C/C++ code analysis Group: Development/Languages License: GPLv3+ URL: http://cppcheck.wiki.sourceforge.net/ Source0: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.bz2 +Source1: cppcheck.desktop BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) # Use system tinyxml2 @@ -21,6 +22,7 @@ BuildRequires: docbook-style-xsl BuildRequires: libxslt BuildRequires: qt4-devel BuildRequires: cmake +BuildRequires: desktop-file-utils %description Cppcheck is a static analysis tool for C/C++ code. Unlike C/C++ @@ -68,9 +70,13 @@ install -D -p -m 644 cppcheck.1 %{buildroot}%{_mandir}/man1/cppcheck.1 rm -rf %{buildroot}%{_includedir}/CppCheck rm %{buildroot}%{_libdir}/libCppCheck.* +# Install desktop file +desktop-file-install --dir=%{buildroot}%{_datadir}/applications %{SOURCE1} +# Install logo +install -D -p -m 644 gui/icon.png %{buildroot}%{_datadir}/pixmaps/cppcheck.png + %check -# Config is not available in the system-wide directory - delete executables and recompile -find . -name \*.o -delete +# CMake build doesn't have check... CXXFLAGS="%{optflags} -DNDEBUG $(pcre-config --cflags)" \ LDFLAGS="$RPM_LD_FLAGS" LIBS=-ltinyxml2 make TINYXML= \ CFGDIR=$(pwd)/cfg \ @@ -89,9 +95,14 @@ rm -rf %{buildroot} %files gui %{_bindir}/cppcheck-gui +%{_datadir}/applications/cppcheck.desktop +%{_datadir}/pixmaps/cppcheck.png %changelog +* Thu Nov 5 2015 Susi Lehtola - 1.70-2 +- Include GUI (BZ #1278318). + * Mon Sep 21 2015 Susi Lehtola - 1.70-1 - Update to 1.70.