Package Init
This commit is contained in:
commit
ee6554d440
16
cppcheck-1.78-cfgdir.patch
Normal file
16
cppcheck-1.78-cfgdir.patch
Normal file
@ -0,0 +1,16 @@
|
||||
diff -up cppcheck-1.78/CMakeLists.txt.orig cppcheck-1.78/CMakeLists.txt
|
||||
diff -up cppcheck-1.78/cmake/options.cmake.orig cppcheck-1.78/cmake/options.cmake
|
||||
--- cppcheck-1.78/cmake/options.cmake.orig 2017-04-01 11:05:13.000000000 +0200
|
||||
+++ cppcheck-1.78/cmake/options.cmake 2017-04-09 14:13:30.130818011 +0200
|
||||
@@ -23,6 +23,11 @@ option(ANALYZE_DATAFLOW "Clang dynam
|
||||
option(WARNINGS_ARE_ERRORS "Treat warnings as errors" OFF)
|
||||
option(WARNINGS_ANSI_ISO "Issue all the mandatory diagnostics Listed in C standard" ON)
|
||||
|
||||
+option(CFGDIR "Configuration file directory" OFF)
|
||||
+if(CFGDIR)
|
||||
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DCFG=${CFGDIR}")
|
||||
+endif(CFGDIR)
|
||||
+
|
||||
set(USE_MATCHCOMPILER "Auto" CACHE STRING "Usage of match compliler")
|
||||
set_property(CACHE USE_MATCHCOMPILER PROPERTY STRINGS Auto Off On Verify)
|
||||
if (USE_MATCHCOMPILER STREQUAL "Auto")
|
||||
32
cppcheck-1.81-translations.patch
Normal file
32
cppcheck-1.81-translations.patch
Normal file
@ -0,0 +1,32 @@
|
||||
diff -up cppcheck-1.81/gui/CMakeLists.txt.translations cppcheck-1.81/gui/CMakeLists.txt
|
||||
--- cppcheck-1.81/gui/CMakeLists.txt.translations 2017-10-18 16:41:50.647580110 +0200
|
||||
+++ cppcheck-1.81/gui/CMakeLists.txt 2017-10-18 16:42:38.432882931 +0200
|
||||
@@ -27,7 +27,7 @@ if (BUILD_GUI)
|
||||
qt5_use_modules(cppcheck-gui ${GUI_QT_COMPONENTS})
|
||||
|
||||
install(TARGETS cppcheck-gui RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR} COMPONENT applications)
|
||||
- install(FILES ${qms} DESTINATION ${CMAKE_INSTALL_FULL_BINDIR} COMPONENT applications)
|
||||
+ install(FILES ${qms} DESTINATION share/${PROJECT_NAME}/lang/ COMPONENT applications)
|
||||
|
||||
install(FILES cppcheck-gui.desktop DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications)
|
||||
|
||||
diff -up cppcheck-1.81/gui/translationhandler.cpp.translations cppcheck-1.81/gui/translationhandler.cpp
|
||||
--- cppcheck-1.81/gui/translationhandler.cpp.translations 2017-10-07 23:11:39.000000000 +0200
|
||||
+++ cppcheck-1.81/gui/translationhandler.cpp 2017-10-18 16:41:50.649580081 +0200
|
||||
@@ -116,15 +116,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) {
|
||||
//If it failed, lets check if the default file exists
|
||||
38
cppcheck-1.83-cmake.patch
Normal file
38
cppcheck-1.83-cmake.patch
Normal file
@ -0,0 +1,38 @@
|
||||
diff -up cppcheck-1.83/cmake/findDependencies.cmake.qt5cmake cppcheck-1.83/cmake/findDependencies.cmake
|
||||
--- cppcheck-1.83/cmake/findDependencies.cmake.qt5cmake 2018-04-02 09:02:50.000000000 +0200
|
||||
+++ cppcheck-1.83/cmake/findDependencies.cmake 2018-06-02 16:50:28.656036644 +0200
|
||||
@@ -1,6 +1,8 @@
|
||||
if (BUILD_GUI)
|
||||
- set(GUI_QT_COMPONENTS Core Gui Widgets PrintSupport)
|
||||
- find_package(Qt5 COMPONENTS ${GUI_QT_COMPONENTS})
|
||||
+ find_package(Qt5Core)
|
||||
+ find_package(Qt5Gui)
|
||||
+ find_package(Qt5Widgets)
|
||||
+ find_package(Qt5PrintSupport)
|
||||
find_package(Qt5LinguistTools)
|
||||
endif()
|
||||
|
||||
diff -up cppcheck-1.83/CMakeLists.txt.qt5cmake cppcheck-1.83/CMakeLists.txt
|
||||
--- cppcheck-1.83/CMakeLists.txt.qt5cmake 2018-06-02 16:47:11.038242820 +0200
|
||||
+++ cppcheck-1.83/CMakeLists.txt 2018-06-02 16:47:11.070242301 +0200
|
||||
@@ -1,5 +1,5 @@
|
||||
project(CppCheck)
|
||||
-cmake_minimum_required(VERSION 2.8.4)
|
||||
+cmake_minimum_required(VERSION 2.8.11)
|
||||
|
||||
include(GNUInstallDirs)
|
||||
|
||||
diff -up cppcheck-1.83/gui/CMakeLists.txt.qt5cmake cppcheck-1.83/gui/CMakeLists.txt
|
||||
--- cppcheck-1.83/gui/CMakeLists.txt.qt5cmake 2018-06-02 16:47:11.049242641 +0200
|
||||
+++ cppcheck-1.83/gui/CMakeLists.txt 2018-06-02 16:47:24.622022436 +0200
|
||||
@@ -24,8 +24,8 @@ if (BUILD_GUI)
|
||||
target_link_libraries(cppcheck-gui pcre)
|
||||
endif()
|
||||
target_link_libraries(cppcheck-gui tinyxml2)
|
||||
- qt5_use_modules(cppcheck-gui ${GUI_QT_COMPONENTS})
|
||||
-
|
||||
+ target_link_libraries(cppcheck-gui Qt5::Core Qt5::Gui Qt5::Widgets Qt5::PrintSupport)
|
||||
+
|
||||
install(TARGETS cppcheck-gui RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR} COMPONENT applications)
|
||||
install(FILES ${qms} DESTINATION share/${PROJECT_NAME}/lang/ COMPONENT applications)
|
||||
|
||||
78
cppcheck-1.83-tinyxml.patch
Normal file
78
cppcheck-1.83-tinyxml.patch
Normal file
@ -0,0 +1,78 @@
|
||||
--- cppcheck-1.83.orig/cli/CMakeLists.txt 2018-04-02 03:02:50.000000000 -0400
|
||||
+++ cppcheck-1.83.orig/cli/CMakeLists.txt 2018-04-12 12:46:04.990212969 -0400
|
||||
@@ -1,5 +1,4 @@
|
||||
include_directories(${PROJECT_SOURCE_DIR}/lib/)
|
||||
-include_directories(SYSTEM ${PROJECT_SOURCE_DIR}/externals/tinyxml/)
|
||||
include_directories(${PROJECT_SOURCE_DIR}/externals/simplecpp/)
|
||||
|
||||
file(GLOB hdrs "*.h")
|
||||
@@ -8,13 +7,14 @@
|
||||
list(REMOVE_ITEM srcs ${mainfile})
|
||||
|
||||
add_library(cli_objs OBJECT ${hdrs} ${srcs})
|
||||
-add_executable(cppcheck ${hdrs} ${mainfile} $<TARGET_OBJECTS:cli_objs> $<TARGET_OBJECTS:lib_objs> $<TARGET_OBJECTS:tinyxml_objs> $<TARGET_OBJECTS:simplecpp_objs>)
|
||||
+add_executable(cppcheck ${hdrs} ${mainfile} $<TARGET_OBJECTS:cli_objs> $<TARGET_OBJECTS:lib_objs> $<TARGET_OBJECTS:simplecpp_objs>)
|
||||
if (HAVE_RULES)
|
||||
target_link_libraries(cppcheck pcre)
|
||||
endif()
|
||||
if (MSVC)
|
||||
target_link_libraries(cppcheck Shlwapi.lib)
|
||||
endif()
|
||||
+target_link_libraries(cppcheck tinyxml2)
|
||||
|
||||
install(TARGETS cppcheck
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR}
|
||||
--- cppcheck-1.83.orig/CMakeLists.txt 2018-04-02 03:02:50.000000000 -0400
|
||||
+++ cppcheck-1.83.orig/CMakeLists.txt 2018-04-12 12:45:04.959219411 -0400
|
||||
@@ -16,7 +16,6 @@
|
||||
enable_testing()
|
||||
endif()
|
||||
|
||||
-add_subdirectory(externals/tinyxml)
|
||||
add_subdirectory(externals/simplecpp)
|
||||
add_subdirectory(lib) # CppCheck Library
|
||||
add_subdirectory(cli) # Client application
|
||||
--- cppcheck-1.83.orig/gui/CMakeLists.txt 2018-04-02 03:02:50.000000000 -0400
|
||||
+++ cppcheck-1.83.orig/gui/CMakeLists.txt 2018-04-12 12:45:04.959219411 -0400
|
||||
@@ -10,7 +10,6 @@
|
||||
endif()
|
||||
|
||||
include_directories(${PROJECT_SOURCE_DIR}/lib/)
|
||||
- include_directories(SYSTEM ${PROJECT_SOURCE_DIR}/externals/tinyxml/)
|
||||
|
||||
file(GLOB hdrs "*.h")
|
||||
file(GLOB srcs "*.cpp")
|
||||
@@ -20,10 +19,11 @@
|
||||
QT5_ADD_RESOURCES(resources "gui.qrc")
|
||||
QT5_ADD_TRANSLATION(qms ${tss})
|
||||
|
||||
- add_executable(cppcheck-gui ${hdrs} ${srcs} ${uis_hdrs} ${resources} ${qms} $<TARGET_OBJECTS:lib_objs> $<TARGET_OBJECTS:tinyxml_objs> $<TARGET_OBJECTS:simplecpp_objs>)
|
||||
+ add_executable(cppcheck-gui ${hdrs} ${srcs} ${uis_hdrs} ${resources} ${qms} $<TARGET_OBJECTS:lib_objs> $<TARGET_OBJECTS:simplecpp_objs>)
|
||||
if (HAVE_RULES)
|
||||
target_link_libraries(cppcheck-gui pcre)
|
||||
endif()
|
||||
+ target_link_libraries(cppcheck-gui tinyxml2)
|
||||
qt5_use_modules(cppcheck-gui ${GUI_QT_COMPONENTS})
|
||||
|
||||
install(TARGETS cppcheck-gui RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR} COMPONENT applications)
|
||||
--- cppcheck-1.83.orig/test/CMakeLists.txt 2018-04-02 03:02:50.000000000 -0400
|
||||
+++ cppcheck-1.83.orig/test/CMakeLists.txt 2018-04-12 12:45:04.959219411 -0400
|
||||
@@ -1,16 +1,16 @@
|
||||
if (BUILD_TESTS)
|
||||
|
||||
include_directories(${PROJECT_SOURCE_DIR}/lib/ ${PROJECT_SOURCE_DIR}/cli/)
|
||||
- include_directories(SYSTEM ${PROJECT_SOURCE_DIR}/externals/tinyxml)
|
||||
include_directories(${PROJECT_SOURCE_DIR}/externals/simplecpp/)
|
||||
|
||||
file(GLOB hdrs "*.h")
|
||||
file(GLOB srcs "*.cpp")
|
||||
|
||||
- add_executable(testrunner ${hdrs} ${srcs} $<TARGET_OBJECTS:lib_objs> $<TARGET_OBJECTS:cli_objs> $<TARGET_OBJECTS:tinyxml_objs> $<TARGET_OBJECTS:simplecpp_objs>)
|
||||
+ add_executable(testrunner ${hdrs} ${srcs} $<TARGET_OBJECTS:lib_objs> $<TARGET_OBJECTS:cli_objs> $<TARGET_OBJECTS:simplecpp_objs>)
|
||||
if (HAVE_RULES)
|
||||
target_link_libraries(testrunner pcre)
|
||||
endif()
|
||||
+ target_link_libraries(testrunner tinyxml2)
|
||||
|
||||
add_custom_target(copy_cfg ALL
|
||||
COMMENT "Copying cfg files")
|
||||
BIN
cppcheck-1.83.tar.gz
Normal file
BIN
cppcheck-1.83.tar.gz
Normal file
Binary file not shown.
66
cppcheck.spec
Normal file
66
cppcheck.spec
Normal file
@ -0,0 +1,66 @@
|
||||
Name: cppcheck
|
||||
Version: 1.83
|
||||
Release: 5
|
||||
Summary: Tool for static C/C++ code analysis
|
||||
License: GPLv3+
|
||||
URL: http://cppcheck.wiki.sourceforge.net/
|
||||
Source0: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz
|
||||
|
||||
Patch0000: cppcheck-1.83-tinyxml.patch
|
||||
Patch0001: cppcheck-1.81-translations.patch
|
||||
Patch0002: cppcheck-1.78-cfgdir.patch
|
||||
Patch0003: cppcheck-1.83-cmake.patch
|
||||
|
||||
BuildRequires: gcc-c++ pcre-devel docbook-style-xsl libxslt cmake desktop-file-utils tinyxml2-devel >= 2.1.0
|
||||
|
||||
Requires: python2-pygments
|
||||
Provides: %{name}-htmlreport = %{version}-%{release}
|
||||
Obsoletes: %{name}-htmlreport < %{version}-%{release}
|
||||
|
||||
%description
|
||||
Cppcheck is a static analysis tool for C/C++ code.
|
||||
Cppcheck primarily detects only real errors in the code (i.e. have zero false positives)
|
||||
instead of syntax errors which C/C++ compilers and many other analysis tools detect commonly.
|
||||
|
||||
%package help
|
||||
Summary: Documentation for cppcheck
|
||||
%description help
|
||||
Documentation for cppcheck
|
||||
|
||||
%prep
|
||||
%autosetup -p1
|
||||
rm -r externals/tinyxml
|
||||
|
||||
%build
|
||||
%make_build 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
|
||||
|
||||
mkdir objdir-%{_target_platform}
|
||||
cd objdir-%{_target_platform}
|
||||
%cmake .. -DCMAKE_BUILD_TYPE=Release -DHAVE_RULES=1 -DBUILD_GUI=0 -DBUILD_SHARED_LIBS:BOOL=OFF -DBUILD_TESTS=1 -DCFGDIR=%{_datadir}/CppCheck
|
||||
%make_build cppcheck
|
||||
|
||||
%install
|
||||
%make_install -C objdir-%{_target_platform}
|
||||
install -D -p -m 644 cppcheck.1 %{buildroot}%{_mandir}/man1/cppcheck.1
|
||||
install -D -p -m 755 htmlreport/cppcheck-htmlreport %{buildroot}%{_bindir}/cppcheck-htmlreport
|
||||
|
||||
%check
|
||||
cd objdir-%{_target_platform}/bin
|
||||
./testrunner -g -q
|
||||
|
||||
%files
|
||||
%doc AUTHORS COPYING
|
||||
%{_datadir}/CppCheck/
|
||||
%{_bindir}/cppcheck
|
||||
%{_bindir}/cppcheck-htmlreport
|
||||
|
||||
%files help
|
||||
%doc man/manual.html
|
||||
%{_mandir}/man1/cppcheck.1*
|
||||
|
||||
%changelog
|
||||
* Mon Nov 18 2019 lihao <lihao129@huawei.com> - 1.83-5
|
||||
- Package Init
|
||||
Loading…
x
Reference in New Issue
Block a user