Merge branch 'master' into epel7

This commit is contained in:
Susi Lehtola 2015-11-05 21:37:47 +01:00
commit b970517148
5 changed files with 174 additions and 18 deletions

View File

@ -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}/

View File

@ -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}
$<TARGET_OBJECTS:cli_lib>

View File

@ -0,0 +1,32 @@
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}/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";

11
cppcheck.desktop Normal file
View File

@ -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;

View File

@ -1,17 +1,28 @@
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
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
BuildRequires: desktop-file-utils
%description
Cppcheck is a static analysis tool for C/C++ code. Unlike C/C++
@ -20,38 +31,52 @@ 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.*
# 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 \
@ -63,13 +88,21 @@ 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
%{_datadir}/applications/cppcheck.desktop
%{_datadir}/pixmaps/cppcheck.png
%changelog
* Thu Nov 5 2015 Susi Lehtola <jussilehtola@fedoraproject.org> - 1.70-2
- Include GUI (BZ #1278318).
* Mon Sep 21 2015 Susi Lehtola <jussilehtola@fedoraproject.org> - 1.70-1
- Update to 1.70.