opencv/opencv.spec
Dominique Leuenberger 96e8562f65 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
2018-06-02 09:53:10 +00:00

306 lines
9.8 KiB
RPMSpec

#
# spec file for package opencv
#
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
%define libname lib%{name}
%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.4.1
Release: 0
Summary: Collection of algorithms for computer vision
# 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 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: pkgconfig
BuildRequires: tbb-devel
BuildRequires: unzip
BuildRequires: pkgconfig(IlmBase)
BuildRequires: pkgconfig(OpenEXR)
BuildRequires: pkgconfig(glu)
BuildRequires: pkgconfig(gstreamer-plugins-base-1.0)
BuildRequires: pkgconfig(libdc1394-2)
BuildRequires: pkgconfig(libgphoto2)
BuildRequires: pkgconfig(libpng)
BuildRequires: pkgconfig(libtiff-4)
BuildRequires: pkgconfig(libv4l2)
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
BuildRequires: python2-numpy-devel
%else
BuildRequires: python-numpy-devel
%endif
%endif
%if %{with python3}
BuildRequires: python3-numpy-devel
BuildRequires: pkgconfig(python3)
%endif
%if %{with qt5}
BuildRequires: pkgconfig(Qt5Concurrent) >= 5.2.0
BuildRequires: pkgconfig(Qt5Gui) >= 5.2.0
BuildRequires: pkgconfig(Qt5OpenGL) >= 5.2.0
BuildRequires: pkgconfig(Qt5Test) >= 5.2.0
BuildRequires: pkgconfig(Qt5Widgets) >= 5.2.0
%else
BuildRequires: pkgconfig(QtCore)
BuildRequires: pkgconfig(QtGui)
BuildRequires: pkgconfig(QtOpenGL)
BuildRequires: pkgconfig(QtTest)
%endif
%if %{with ffmpeg}
BuildRequires: pkgconfig(libavcodec)
BuildRequires: pkgconfig(libavformat)
BuildRequires: pkgconfig(libavutil)
BuildRequires: pkgconfig(libswscale)
%endif
%description
OpenCV means Intel® Open Source Computer Vision Library. It is a collection of C
functions and a few C++ classes that implement some popular Image Processing and
Computer Vision algorithms.
%package -n %{libname}%{soname}
Summary: Libraries to use OpenCV computer vision
License: BSD-3-Clause
Group: System/Libraries
%description -n %{libname}%{soname}
The Open Computer Vision Library is a collection of algorithms and sample code
for various computer vision problems. The library is compatible with IPL and
utilizes Intel Integrated Performance Primitives for better performance.
%package devel
Summary: Development files for using the OpenCV library
License: BSD-3-Clause
Group: Development/Libraries/C and C++
Requires: %{libname}%{soname} = %{version}
Requires: %{name} = %{version}
Requires: pkgconfig(gl)
Requires: pkgconfig(glu)
Requires: pkgconfig(ice)
Requires: pkgconfig(sm)
Requires: pkgconfig(x11)
Requires: pkgconfig(xext)
Provides: %{name}-qt5-devel
Obsoletes: %{name}-qt5-devel
%description devel
This package contains the OpenCV C/C++ library and header files, as well as
documentation. It should be installed if you want to develop programs that will
use the OpenCV library.
%package -n python2-%{name}
Summary: Python 2 bindings for apps which use OpenCV
License: BSD-3-Clause
Group: Development/Libraries/Python
Provides: python-%{name} = %{version}-%{release}
Obsoletes: python-%{name} < %{version}-%{release}
Provides: python-%{name}-qt5
Obsoletes: python-%{name}-qt5
%description -n python2-%{name}
This package contains Python 2 bindings for the OpenCV library.
%package -n python3-%{name}
Summary: Python 3 bindings for apps which use OpenCV
License: BSD-3-Clause
Group: Development/Libraries/Python
Provides: python3-%{name}-qt5
Obsoletes: python3-%{name}-qt5
%description -n python3-%{name}
This package contains Python 3 bindings for the OpenCV library.
%package doc
Summary: Documentation and examples for OpenCV
License: BSD-3-Clause
Group: Documentation/Other
Recommends: python
# Since this package also contains examples that need -devel to be compiled
Suggests: %{name}-devel
Provides: %{name}-qt5-doc
Obsoletes: %{name}-qt5-doc
%description doc
This package contains the documentation and examples for the OpenCV library.
%prep
%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
%build
# Dynamic dispatch: https://github.com/opencv/opencv/wiki/CPU-optimizations-build-options
# x86: disable SSE on 32bit, do not dispatch AVX and later - SSE3
# is the highest extension available on any non-64bit x86 CPU
# ARM: ARMv6, e.g. RPi1, only has VFPv2
%cmake \
%if %{with tests}
-DBUILD_TESTS=ON \
%endif
-DINSTALL_C_EXAMPLES=ON \
-DINSTALL_PYTHON_EXAMPLES=ON \
-DENABLE_OMIT_FRAME_POINTER=OFF \
-DWITH_QT=ON \
-DWITH_OPENGL=ON \
-DWITH_UNICAP=ON \
-DWITH_XINE=ON \
-DWITH_IPP=OFF \
-DWITH_TBB=ON \
%ifarch %{ix86}
-DCPU_BASELINE_DISABLE=SSE \
-DCPU_DISPATCH=SSE,SSE2,SSE3 \
%endif
%ifarch x86_64
-DCPU_BASELINE=SSE2 \
-DCPU_DISPATCH=SSE3,SSE4_1,SSE4_2,AVX,FP16,AVX2 \
%endif
%ifarch %{arm}
%ifarch armv7l armv7hl
-DCPU_BASELINE=VFPV3 \
-DCPU_DISPATCH=NEON \
%else
-DCPU_BASELINE_DISABLE=NEON,VFPV3 \
%endif
%endif
%ifarch aarch64
-DCPU_BASELINE=NEON \
-DCPU_DISPATCH=FP16 \
%endif
%if 0%{?suse_version} >= 1500
-DPYTHON_DEFAULT_EXECUTABLE=/usr/bin/python3 \
%endif
make %{?_smp_mflags} VERBOSE=1
%check
%if %{with tests}
export LD_LIBRARY_PATH=$(pwd)/build/lib:$LD_LIBRARY_PATH
%ctest
%endif
%install
%cmake_install
mkdir -p %{buildroot}%{_docdir}/%{name}-doc
mv %{buildroot}%{_datadir}/OpenCV/samples %{buildroot}%{_docdir}/%{name}-doc/examples
# Fix rpmlint warning "doc-file-dependency"
chmod 644 %{buildroot}%{_docdir}/%{name}-doc/examples/python/*.py
%fdupes -s %{buildroot}%{_docdir}/%{name}-doc/examples
%fdupes -s %{buildroot}%{_includedir}
%post -n %{libname}%{soname} -p /sbin/ldconfig
%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}
%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
%{_libdir}/pkgconfig/opencv.pc
%{_datadir}/OpenCV/OpenCVConfig*.cmake
%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
%files doc
%{_docdir}/%{name}-doc/
%changelog