From 96e8562f6570bfec722002bffbb1fe7a734a2da067122baf87721d3fc23ae960 Mon Sep 17 00:00:00 2001 From: Dominique Leuenberger Date: Sat, 2 Jun 2018 09:53:10 +0000 Subject: [PATCH] Accepting request 612803 from KDE:Extra - Add patch to fix use of headers from C: * build-workaround-issues-with-c.patch - Update to 3.4.1: * Added support for quantized TensorFlow networks * OpenCV is now able to use Intel DL inference engine as DNN acceleration backend * Added AVX-512 acceleration to the performance-critical kernels * For more information, read https://github.com/opencv/opencv/wiki/ChangeLog#version341 - Update contrib modules to 3.4.1: * No changelog available - Change mechanism the contrib modules are built - Include LICENSE of contrib tarball as well - Build with python3 on >= 15 - Add patch to fix build on i386 without SSE: * fix-build-i386-nosse.patch - Refresh patches: * fix_processor_detection_for_32bit_on_64bit.patch * opencv-build-compare.patch - Mention all libs explicitly - Rebase 3.4.0 update from i@marguerite.su - update to 3.4.0 * Added faster R-CNN support * Javascript bindings have been extended to cover DNN module * DNN has been further accelerated for iGPU using OpenCL * On-disk caching of precompiled OpenCL kernels has been finally implemented OBS-URL: https://build.opensuse.org/request/show/612803 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/opencv?expand=0&rev=71 --- build-workaround-issues-with-c.patch | 56 +++++++++++++++++++ fix-build-i386-nosse.patch | 27 +++++++++ ...ocessor_detection_for_32bit_on_64bit.patch | 12 ++-- opencv-3.3.1.tar.gz | 3 - opencv-3.4.1.tar.gz | 3 + opencv-build-compare.patch | 20 ++++--- opencv-lib_suffix.patch | 23 ++++++++ opencv.changes | 51 +++++++++++++++++ opencv.spec | 56 ++++++++++++++++--- opencv_contrib-3.4.1.tar.gz | 3 + opencv_contrib_face-3.1.0.tar.bz2 | 3 - 11 files changed, 230 insertions(+), 27 deletions(-) create mode 100644 build-workaround-issues-with-c.patch create mode 100644 fix-build-i386-nosse.patch delete mode 100644 opencv-3.3.1.tar.gz create mode 100644 opencv-3.4.1.tar.gz create mode 100644 opencv-lib_suffix.patch create mode 100644 opencv_contrib-3.4.1.tar.gz delete mode 100644 opencv_contrib_face-3.1.0.tar.bz2 diff --git a/build-workaround-issues-with-c.patch b/build-workaround-issues-with-c.patch new file mode 100644 index 0000000..f92f524 --- /dev/null +++ b/build-workaround-issues-with-c.patch @@ -0,0 +1,56 @@ +From 549b5df22520b60b91dd77096434d79425b31ac2 Mon Sep 17 00:00:00 2001 +From: Alexander Alekhin +Date: Mon, 28 May 2018 18:07:23 +0300 +Subject: [PATCH] build: workaround issues with C compilation mode + +- cvdef.h + cvRound (double only) +- highgui_c.h +--- + modules/core/include/opencv2/core/cvdef.h | 8 +++++++- + modules/highgui/include/opencv2/highgui/highgui_c.h | 2 ++ + 2 files changed, 9 insertions(+), 1 deletion(-) + +diff --git a/modules/core/include/opencv2/core/cvdef.h b/modules/core/include/opencv2/core/cvdef.h +index a87ced09d78..4ab72b34cc1 100644 +--- a/modules/core/include/opencv2/core/cvdef.h ++++ b/modules/core/include/opencv2/core/cvdef.h +@@ -480,7 +480,7 @@ Cv64suf; + // Integer types portatibility + #ifdef OPENCV_STDINT_HEADER + #include OPENCV_STDINT_HEADER +-#else ++#elif defined(__cplusplus) + #if defined(_MSC_VER) && _MSC_VER < 1600 /* MSVS 2010 */ + namespace cv { + typedef signed char int8_t; +@@ -517,9 +517,15 @@ typedef ::int64_t int64_t; + typedef ::uint64_t uint64_t; + } + #endif ++#else // pure C ++#include + #endif + + + //! @} + ++#ifndef __cplusplus ++#include "opencv2/core/fast_math.hpp" // define cvRound(double) ++#endif ++ + #endif // OPENCV_CORE_CVDEF_H +diff --git a/modules/highgui/include/opencv2/highgui/highgui_c.h b/modules/highgui/include/opencv2/highgui/highgui_c.h +index 1eb414a76ca..35413139c79 100644 +--- a/modules/highgui/include/opencv2/highgui/highgui_c.h ++++ b/modules/highgui/include/opencv2/highgui/highgui_c.h +@@ -135,8 +135,10 @@ CVAPI(int) cvNamedWindow( const char* name, int flags CV_DEFAULT(CV_WINDOW_AUTOS + CVAPI(void) cvSetWindowProperty(const char* name, int prop_id, double prop_value); + CVAPI(double) cvGetWindowProperty(const char* name, int prop_id); + ++#ifdef __cplusplus // FIXIT remove in OpenCV 4.0 + /* Get window image rectangle coordinates, width and height */ + CVAPI(cv::Rect)cvGetWindowImageRect(const char* name); ++#endif + + /* display image within window (highgui windows remember their content) */ + CVAPI(void) cvShowImage( const char* name, const CvArr* image ); diff --git a/fix-build-i386-nosse.patch b/fix-build-i386-nosse.patch new file mode 100644 index 0000000..b103880 --- /dev/null +++ b/fix-build-i386-nosse.patch @@ -0,0 +1,27 @@ +From 7dc162cb4252ccf461f1c63650abde3c8807b79c Mon Sep 17 00:00:00 2001 +From: Alexander Alekhin +Date: Mon, 9 Apr 2018 18:25:51 +0300 +Subject: [PATCH] core: fix mm_pause() for non-SSE i386 builds + +replaced to safe binary compatible 'rep; nop' asm instruction +--- + modules/core/src/parallel_impl.cpp | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/modules/core/src/parallel_impl.cpp b/modules/core/src/parallel_impl.cpp +index 78d9eb63694..bc64fce7a81 100644 +--- a/modules/core/src/parallel_impl.cpp ++++ b/modules/core/src/parallel_impl.cpp +@@ -49,7 +49,11 @@ DECLARE_CV_YIELD + DECLARE_CV_PAUSE + #endif + #ifndef CV_PAUSE +-#if defined __GNUC__ && (defined __i386__ || defined __x86_64__) ++# if defined __GNUC__ && (defined __i386__ || defined __x86_64__) ++# if !defined(__SSE__) ++ static inline void cv_non_sse_mm_pause() { __asm__ __volatile__ ("rep; nop"); } ++# define _mm_pause cv_non_sse_mm_pause ++# endif + # define CV_PAUSE(v) do { for (int __delay = (v); __delay > 0; --__delay) { _mm_pause(); } } while (0) + # elif defined __GNUC__ && defined __aarch64__ + # define CV_PAUSE(v) do { for (int __delay = (v); __delay > 0; --__delay) { asm volatile("yield" ::: "memory"); } } while (0) diff --git a/fix_processor_detection_for_32bit_on_64bit.patch b/fix_processor_detection_for_32bit_on_64bit.patch index 8bb109e..0bbc7a0 100644 --- a/fix_processor_detection_for_32bit_on_64bit.patch +++ b/fix_processor_detection_for_32bit_on_64bit.patch @@ -1,6 +1,8 @@ ---- opencv-3.3.0/cmake/OpenCVDetectCXXCompiler.cmake_orig 2017-10-27 06:32:16.790452991 +0200 -+++ opencv-3.3.0/cmake/OpenCVDetectCXXCompiler.cmake 2017-10-27 06:34:33.035306589 +0200 -@@ -60,6 +60,7 @@ +Index: opencv-3.4.1/cmake/OpenCVDetectCXXCompiler.cmake +=================================================================== +--- opencv-3.4.1.orig/cmake/OpenCVDetectCXXCompiler.cmake ++++ opencv-3.4.1/cmake/OpenCVDetectCXXCompiler.cmake +@@ -60,6 +60,7 @@ if(CMAKE_COMPILER_IS_GNUCXX) endif() endif() @@ -8,8 +10,8 @@ if(MSVC64 OR MINGW64) set(X86_64 1) elseif(MINGW OR (MSVC AND NOT CMAKE_CROSSCOMPILING)) -@@ -76,11 +77,17 @@ - set(PPC64LE 1) +@@ -78,11 +79,17 @@ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^ + set(PPC64 1) endif() -# Workaround for 32-bit operating systems on 64-bit x86_64 processor diff --git a/opencv-3.3.1.tar.gz b/opencv-3.3.1.tar.gz deleted file mode 100644 index 4105f50..0000000 --- a/opencv-3.3.1.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:5dca3bb0d661af311e25a72b04a7e4c22c47c1aa86eb73e70063cd378a2aa6ee -size 85868197 diff --git a/opencv-3.4.1.tar.gz b/opencv-3.4.1.tar.gz new file mode 100644 index 0000000..83e9826 --- /dev/null +++ b/opencv-3.4.1.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f1b87684d75496a1054405ae3ee0b6573acaf3dad39eaf4f1d66fdd7e03dc852 +size 87051748 diff --git a/opencv-build-compare.patch b/opencv-build-compare.patch index c746693..a82faff 100644 --- a/opencv-build-compare.patch +++ b/opencv-build-compare.patch @@ -1,8 +1,10 @@ ---- opencv-3.3.0.orig/CMakeLists.txt 2017-05-28 15:04:38.466895124 +0200 -+++ opencv-3.3.0/CMakeLists.txt 2017-05-28 15:05:23.251389916 +0200 -@@ -843,11 +843,11 @@ - status(" Timestamp:" ${TIMESTAMP}) - endif() +Index: opencv-3.4.1/CMakeLists.txt +=================================================================== +--- opencv-3.4.1.orig/CMakeLists.txt ++++ opencv-3.4.1/CMakeLists.txt +@@ -966,11 +966,11 @@ endif() + if(OPENCV_TIMESTAMP) + status(" Timestamp:" ${OPENCV_TIMESTAMP}) endif() -status(" Host:" ${CMAKE_HOST_SYSTEM_NAME} ${CMAKE_HOST_SYSTEM_VERSION} ${CMAKE_HOST_SYSTEM_PROCESSOR}) +status(" Host:" "Linux") @@ -14,9 +16,11 @@ status(" CMake generator:" ${CMAKE_GENERATOR}) status(" CMake build tool:" ${CMAKE_BUILD_TOOL}) if(MSVC) ---- opencv-3.3.0.orig/cmake/OpenCVUtils.cmake 2016-12-23 13:54:44.000000000 +0100 -+++ opencv-3.3.0/cmake/OpenCVUtils.cmake 2017-05-28 15:07:42.728928083 +0200 -@@ -550,15 +550,18 @@ +Index: opencv-3.4.1/cmake/OpenCVUtils.cmake +=================================================================== +--- opencv-3.4.1.orig/cmake/OpenCVUtils.cmake ++++ opencv-3.4.1/cmake/OpenCVUtils.cmake +@@ -730,15 +730,18 @@ function(status text) if(${status_cond}) string(REPLACE ";" " " status_then "${status_then}") string(REGEX REPLACE "^[ \t]+" "" status_then "${status_then}") diff --git a/opencv-lib_suffix.patch b/opencv-lib_suffix.patch new file mode 100644 index 0000000..b884541 --- /dev/null +++ b/opencv-lib_suffix.patch @@ -0,0 +1,23 @@ +Index: opencv-3.4.0/CMakeLists.txt +=================================================================== +--- opencv-3.4.0.orig/CMakeLists.txt ++++ opencv-3.4.0/CMakeLists.txt +@@ -421,7 +421,7 @@ else() + ocv_update(OPENCV_CONFIG_INSTALL_PATH ".") + else() + include(GNUInstallDirs) +- ocv_update(OPENCV_LIB_INSTALL_PATH ${CMAKE_INSTALL_LIBDIR}${LIB_SUFFIX}) ++ ocv_update(OPENCV_LIB_INSTALL_PATH ${CMAKE_INSTALL_LIBDIR}) + ocv_update(OPENCV_3P_LIB_INSTALL_PATH share/OpenCV/3rdparty/${OPENCV_LIB_INSTALL_PATH}) + ocv_update(OPENCV_SAMPLES_SRC_INSTALL_PATH share/OpenCV/samples) + ocv_update(OPENCV_JAR_INSTALL_PATH share/OpenCV/java) +@@ -430,7 +430,7 @@ else() + if(NOT DEFINED OPENCV_CONFIG_INSTALL_PATH) + math(EXPR SIZEOF_VOID_P_BITS "8 * ${CMAKE_SIZEOF_VOID_P}") + if(LIB_SUFFIX AND NOT SIZEOF_VOID_P_BITS EQUAL LIB_SUFFIX) +- ocv_update(OPENCV_CONFIG_INSTALL_PATH ${CMAKE_INSTALL_LIBDIR}${LIB_SUFFIX}/cmake/opencv) ++ ocv_update(OPENCV_CONFIG_INSTALL_PATH ${CMAKE_INSTALL_LIBDIR}/cmake/opencv) + else() + ocv_update(OPENCV_CONFIG_INSTALL_PATH share/OpenCV) + endif() + diff --git a/opencv.changes b/opencv.changes index 743d0b2..e72285c 100644 --- a/opencv.changes +++ b/opencv.changes @@ -1,3 +1,54 @@ +------------------------------------------------------------------- +Tue May 29 08:26:53 UTC 2018 - fabian@ritter-vogt.de + +- Add patch to fix use of headers from C: + * build-workaround-issues-with-c.patch + +------------------------------------------------------------------- +Mon May 28 11:04:23 UTC 2018 - fvogt@suse.com + +- Update to 3.4.1: + * Added support for quantized TensorFlow networks + * OpenCV is now able to use Intel DL inference engine as DNN + acceleration backend + * Added AVX-512 acceleration to the performance-critical kernels + * For more information, read + https://github.com/opencv/opencv/wiki/ChangeLog#version341 +- Update contrib modules to 3.4.1: + * No changelog available +- Change mechanism the contrib modules are built +- Include LICENSE of contrib tarball as well +- Build with python3 on >= 15 +- Add patch to fix build on i386 without SSE: + * fix-build-i386-nosse.patch +- Refresh patches: + * fix_processor_detection_for_32bit_on_64bit.patch + * opencv-build-compare.patch +- Mention all libs explicitly +- Rebase 3.4.0 update from i@marguerite.su +- update to 3.4.0 + * Added faster R-CNN support + * Javascript bindings have been extended to + cover DNN module + * DNN has been further accelerated for iGPU + using OpenCL + * On-disk caching of precompiled OpenCL + kernels has been finally implemented + * possible to load and run pre-compiled + OpenCL kernels via T-API + * Bit-exact 8-bit and 16-bit resize has been + implemented (currently supported only + bilinear interpolation) +- update face module to 3.4.0 +- add opencv-lib_suffix.patch, remove LIB_SUFFIX + from OPENCV_LIB_INSTALL_PATH, as CMAKE_INSTALL + _LIBDIR is arch dependent. + +------------------------------------------------------------------- +Mon Mar 12 08:48:12 UTC 2018 - schwab@suse.de + +- Add option to build without openblas + ------------------------------------------------------------------- Mon Jan 8 09:35:37 UTC 2018 - tchvatal@suse.com diff --git a/opencv.spec b/opencv.spec index 09efbd9..59c1343 100644 --- a/opencv.spec +++ b/opencv.spec @@ -17,38 +17,44 @@ %define libname lib%{name} -%define soname 3_3 +%define soname 3_4 # disabled by default as many fail %bcond_with tests %bcond_without qt5 %bcond_without ffmpeg %bcond_without python2 %bcond_without python3 +%bcond_without openblas Name: opencv -Version: 3.3.1 +Version: 3.4.1 Release: 0 Summary: Collection of algorithms for computer vision -# GPL-2.9 AND Apache-2.0 files are in 3rdparty/ittnotify which is not build -License: BSD-3-Clause AND GPL-2.0 AND Apache-2.0 +# GPL-2.0 AND Apache-2.0 files are in 3rdparty/ittnotify which is not build +License: BSD-3-Clause AND GPL-2.0-only AND Apache-2.0 Group: Development/Libraries/C and C++ Url: http://opencv.org/ Source0: https://github.com/opencv/opencv/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz -# This is the FACE module from the opencv_contrib package. Packaged separately to prevent too much usntable modules -Source1: opencv_contrib_face-3.1.0.tar.bz2 +# This is the FACE module from the opencv_contrib package. Packaged separately to prevent too much unstable modules +Source1: https://github.com/opencv/opencv_contrib/archive/%{version}.tar.gz#/opencv_contrib-%{version}.tar.gz # PATCH-FIX-OPENCSUSE opencv-gles.patch -- Make sure PERSPECTIVE_CORRECTION_HINT is validated first, https://github.com/opencv/opencv/issues/9171 Patch1: opencv-gles.patch +# PATCH-FIX-UPSTREAM +Patch2: fix-build-i386-nosse.patch +# PATCH-FIX-UPSTREAM +Patch3: build-workaround-issues-with-c.patch # PATCH-FIX-OPENSUSE opencv-build-compare.patch -- avoid republish if some random external version number changes Patch8: opencv-build-compare.patch # PATCH-FIX-OPENSUSE 0001-Do-not-include-glx.h-when-using-GLES.patch -- Fix build error on 32bit ARM, due to incompatible pointer types, https://github.com/opencv/opencv/issues/9171 Patch11: 0001-Do-not-include-glx.h-when-using-GLES.patch # PATCH-FIX-OPENSUSE fix_processor_detection_for_32bit_on_64bit.patch -- Fix CPU detection for 32bit build on qemu-system-aarch64 Patch12: fix_processor_detection_for_32bit_on_64bit.patch +# PATCH-FIX-OPENSUSE remove LIB_SUFFIX from OPENCV_LIB_INSTALL_PATH because CMAKE_INSTALL_LIBDIR is arch dependent +Patch13: opencv-lib_suffix.patch BuildRequires: cmake BuildRequires: fdupes BuildRequires: libeigen3-devel BuildRequires: libjasper-devel BuildRequires: libjpeg-devel -BuildRequires: openblas-devel BuildRequires: pkgconfig BuildRequires: tbb-devel BuildRequires: unzip @@ -65,6 +71,9 @@ BuildRequires: pkgconfig(libv4lconvert) BuildRequires: pkgconfig(zlib) Provides: opencv-qt5 Obsoletes: opencv-qt5 +%if %{with openblas} +BuildRequires: openblas-devel +%endif %if %{with python2} BuildRequires: pkgconfig(python) %if 0%{?suse_version} > 1325 @@ -170,6 +179,10 @@ This package contains the documentation and examples for the OpenCV library. %setup -q -a 1 %autopatch -p1 +# Only copy over modules we need +mv opencv_contrib-%{version}/modules/{face,tracking,plot} modules/ +cp opencv_contrib-%{version}/LICENSE LICENSE.contrib + # Remove Windows specific files rm -f doc/packaging.txt @@ -211,6 +224,9 @@ rm -f doc/packaging.txt -DCPU_BASELINE=NEON \ -DCPU_DISPATCH=FP16 \ %endif +%if 0%{?suse_version} >= 1500 + -DPYTHON_DEFAULT_EXECUTABLE=/usr/bin/python3 \ +%endif make %{?_smp_mflags} VERBOSE=1 @@ -235,14 +251,36 @@ chmod 644 %{buildroot}%{_docdir}/%{name}-doc/examples/python/*.py %postun -n %{libname}%{soname} -p /sbin/ldconfig %files +%license LICENSE LICENSE.contrib %{_bindir}/opencv_* %{_datadir}/OpenCV %exclude %{_datadir}/OpenCV/OpenCVConfig*.cmake %files -n %{libname}%{soname} -%{_libdir}/lib*.so.* +%license LICENSE LICENSE.contrib +%{_libdir}/libopencv_calib3d.so.* +%{_libdir}/libopencv_core.so.* +%{_libdir}/libopencv_dnn.so.* +%{_libdir}/libopencv_face.so.* +%{_libdir}/libopencv_features2d.so.* +%{_libdir}/libopencv_flann.so.* +%{_libdir}/libopencv_highgui.so.* +%{_libdir}/libopencv_imgcodecs.so.* +%{_libdir}/libopencv_imgproc.so.* +%{_libdir}/libopencv_ml.so.* +%{_libdir}/libopencv_objdetect.so.* +%{_libdir}/libopencv_photo.so.* +%{_libdir}/libopencv_plot.so.* +%{_libdir}/libopencv_shape.so.* +%{_libdir}/libopencv_stitching.so.* +%{_libdir}/libopencv_superres.so.* +%{_libdir}/libopencv_tracking.so.* +%{_libdir}/libopencv_video.so.* +%{_libdir}/libopencv_videoio.so.* +%{_libdir}/libopencv_videostab.so.* %files devel +%license LICENSE LICENSE.contrib %{_includedir}/opencv/ %{_includedir}/opencv2/ %{_libdir}/lib*.so @@ -251,11 +289,13 @@ chmod 644 %{buildroot}%{_docdir}/%{name}-doc/examples/python/*.py %if %{with python2} %files -n python2-%{name} +%license LICENSE LICENSE.contrib %{python_sitearch}/cv2.so %endif %if %{with python3} %files -n python3-%{name} +%license LICENSE LICENSE.contrib %{python3_sitearch}/cv2.%{py3_soflags}.so %endif diff --git a/opencv_contrib-3.4.1.tar.gz b/opencv_contrib-3.4.1.tar.gz new file mode 100644 index 0000000..5663f03 --- /dev/null +++ b/opencv_contrib-3.4.1.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:298c69ee006d7675e1ff9d371ba8b0d9e7e88374bb7ba0f9d0789851d352ec6e +size 57126844 diff --git a/opencv_contrib_face-3.1.0.tar.bz2 b/opencv_contrib_face-3.1.0.tar.bz2 deleted file mode 100644 index 67b98b8..0000000 --- a/opencv_contrib_face-3.1.0.tar.bz2 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:8c5ffca434938ac7fd818ac90eaf48f2fd3ee3dec2089e4c03971eae38ffe694 -size 2052039