2 # - Smartek GigEVisionSDK (http://www.smartekvision.com/ but I can't see SDK with Linux library?)
3 # - CUDA, CUFFT, CUBLAS, NVCUVID support (on bcond)
4 # - ipp (libippi): http://software.intel.com/en-us/articles/intel-ipp/ (proprietary)
8 %bcond_with tbb # Threading Building Blocks support (everywhere)
9 %bcond_with sse # use SSE instructions
10 %bcond_with sse2 # use SSE2 instructions
11 %bcond_with sse3 # use SSE3 instructions
12 %bcond_with ssse3 # use SSSE3 instructions
13 %bcond_with sse41 # use SSE4.1 instructions
14 %bcond_with sse42 # use SSE4.2 instructions
15 %bcond_with avx # use AVX instructions
16 %bcond_without opencl # OpenCL support
17 %bcond_with opencl_amdblas # AMD OpenCL BLAS routines
18 %bcond_with opencl_amdfft # AMD OpenCL FFT routines
19 %bcond_without opengl # OpenGL support
20 %bcond_without gomp # OpenMP support
22 %bcond_without java # Java binding
24 %bcond_without ffmpeg # FFMpeg support in highgui
25 %bcond_without gstreamer # GStreamer support in highgui
26 %bcond_with openni # OpenNI (Natural Interaction) support in highgui
27 %bcond_with pvapi # PvAPI (AVT GigE cameras) support in highgui (proprietary)
28 %bcond_with qt # Qt backend instead of GTK+ in highgui
29 %bcond_with unicap # Unicap support in highgui (GPL)
30 %bcond_without v4l # Video4Linux in highgui
31 %bcond_with ximea # m3API (XIMEA cameras) support in highgui (proprietary)
32 %bcond_with xine # XINE support in highgui (GPL)
34 %ifarch pentium3 pentium4 %{x8664}
37 %ifarch pentium4 %{x8664}
40 Summary: A library of programming functions mainly aimed at real time computer vision
41 Summary(pl.UTF-8): Biblioteka funkcji do grafiki komputerowej w czasie rzeczywistym
46 %if %{with unicap} || %{with xine}
47 License: GPL (enforced by used libraries), BSD (opencv itself)
52 Source0: https://github.com/Itseez/opencv/archive/%{version}.tar.gz
53 # Source0-md5: 9b8f1426bc01a1ae1e8b3bce11dc1e1c
54 Patch0: %{name}-cflags.patch
55 Patch1: %{name}-link.patch
56 Patch2: %{name}-unicap-c++.patch
57 Patch3: %{name}-c.patch
58 Patch4: %{name}-gcc.patch
59 Patch5: %{name}-ximea.patch
60 Patch6: %{name}-ocl-fft.patch
61 Patch7: java-ant-sourcelevel.patch
62 Patch8: %{name}-shared.patch
63 URL: http://opencv.willowgarage.com/
64 %{?with_pvapi:BuildRequires: AVT_GigE_SDK-devel}
65 %{?with_opencl:BuildRequires: OpenCL-devel}
66 BuildRequires: OpenEXR-devel
67 %{?with_opengl:BuildRequires: OpenGL-GLU-devel}
68 %{?with_opengl:BuildRequires: OpenGL-devel}
69 # as of OpenCV 2.3.1-2.4.3 there is also check for OpenNI-sensor-PrimeSense, but the result is not used
70 %{?with_openni:BuildRequires: OpenNI-devel}
71 %{?with_ximea:BuildRequires: XIMEA-devel >= 4}
72 %{?with_java:BuildRequires: ant}
73 %{?with_opencl_amdblas:BuildRequires: clAmdBlas-devel}
74 %{?with_opencl_amdfft:BuildRequires: clAmdFft-devel}
75 BuildRequires: cmake >= 2.8
76 BuildRequires: doxygen
77 BuildRequires: eigen3 >= 3
78 %{?with_ffmpeg:BuildRequires: ffmpeg-devel >= 0.7}
79 %{?with_gomp:BuildRequires: gcc-c++ >= 6:4.2}
81 BuildRequires: gstreamer-devel >= 0.10
82 BuildRequires: gstreamer-plugins-base-devel >= 0.10
84 BuildRequires: jasper-devel
85 %{?with_java:BuildRequires: jdk}
86 BuildRequires: libdc1394-devel
87 %{?with_gomp:BuildRequires: libgomp-devel}
88 BuildRequires: libjpeg-devel
89 BuildRequires: libpng-devel
90 BuildRequires: libraw1394-devel
91 BuildRequires: libstdc++-devel
92 BuildRequires: libtiff-devel
93 BuildRequires: libtool
95 BuildRequires: libucil-devel
96 BuildRequires: libunicap-devel
98 BuildRequires: libv4l-devel
99 BuildRequires: pkgconfig
100 BuildRequires: python
101 BuildRequires: python-devel
102 BuildRequires: python-numpy-devel
103 BuildRequires: rpm-pythonprov
104 BuildRequires: rpmbuild(macros) >= 1.606
105 BuildRequires: sed >= 4.0
106 BuildRequires: swig-python
107 %{?with_tbb:BuildRequires: tbb-devel}
108 %{?with_xine:BuildRequires: xine-lib-devel}
109 BuildRequires: zlib-devel
111 BuildRequires: QtCore-devel >= 4
112 BuildRequires: QtGui-devel >= 4
113 %{?with_opengl:BuildRequires: QtOpenGL-devel >= 4}
114 BuildRequires: qt4-qmake >= 4
116 BuildRequires: gtk+2-devel >= 2.0
117 %{?with_opengl:BuildRequires: gtkglext-devel >= 1.0}
119 Requires: %{name}-core = %{epoch}:%{version}-%{release}
120 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
122 %define sover %(v=%{version}; k=${v#?.?.?}; echo ${v%$k})
124 # build broken, can't find g++
125 %undefine with_ccache
128 OpenCV (Open Source Computer Vision) is a library of programming
129 functions mainly aimed at real time computer vision.
131 Example applications of the OpenCV library are:
132 - Human-Computer Interaction (HCI)
133 - Object Identification, Segmentation and Recognition
135 - Gesture Recognition
137 - Ego Motion, Motion Understanding
138 - Structure From Motion (SFM)
139 - Stereo and Multi-Camera Calibration and Depth Computation
142 %description -l pl.UTF-8
143 OpenCV (Open Source Computer Vision) to biblioteka funkcji
144 przeznaczonych głównie do grafiki komputerowej w czasie rzeczywistym.
146 Przykładowe zastosowania biblioteki OpenCV to
147 - interakcje człowiek-komputer (HCI)
148 - identyfikacja, segmentacja i rozpoznawanie obiektów
149 - rozpoznawanie twarzy
150 - rozpoznawanie gestów
153 - SFM (Structure From Motion)
154 - kalibracja dwu- i wielokamerowa, obliczanie głębi
158 Summary: OpenCV core libraries
159 Summary(pl.UTF-8): Podstawowe biblioteki OpenCV
161 Conflicts: opencv < 2.4.6.2-1
164 This package contains the OpenCV C/C++ core libraries.
166 %description core -l pl.UTF-8
167 Ten pakiet zawiera podstawowe biblioteki C/C++ OpenCV.
170 Summary: Header files for OpenCV library
171 Summary(pl.UTF-8): Pliki nagłówkowe biblioteki OpenCV
172 Group: Development/Libraries
173 Requires: %{name} = %{epoch}:%{version}-%{release}
174 Obsoletes: opencv-static
177 Header files for OpenCV library.
179 %description devel -l pl.UTF-8
180 Pliki nagłówkowe biblioteki OpenCV.
183 Summary: Manual for OpenCV
184 Summary(fr.UTF-8): Documentation pour OpenCV
185 Summary(it.UTF-8): Documentazione di OpenCV
186 Summary(pl.UTF-8): Podręcznik dla OpenCV
188 # noarch subpackages only when building with rpm5
189 %if "%{_rpmversion}" >= "5"
194 Documentation for OpenCV.
196 %description doc -l fr.UTF-8
197 Documentation pour OpenCV.
199 %description doc -l it.UTF-8
200 Documentazione di OpenCV.
202 %description doc -l pl.UTF-8
203 Dokumentacja do OpenCV.
205 %package -n java-opencv
206 Summary: OpenCV Java bindings
207 Summary(pl.UTF-8): Wiązania Javy do OpenCV
208 Group: Libraries/Java
209 Requires: %{name} = %{epoch}:%{version}-%{release}
212 %description -n java-opencv
213 OpenCV Java bindings.
215 %description -n java-opencv -l pl.UTF-8
216 Wiązania Javy do OpenCV.
218 %package -n python-opencv
219 Summary: OpenCV Python bindings
220 Summary(pl.UTF-8): Wiązania Pythona do OpenCV
221 Group: Libraries/Python
222 Requires: %{name} = %{epoch}:%{version}-%{release}
223 Requires: python-libs
225 %description -n python-opencv
226 OpenCV Python bindings.
228 %description -n python-opencv -l pl.UTF-8
229 Wiązania Pythona do OpenCV.
234 %undos CMakeLists.txt
235 %undos modules/gpu/CMakeLists.txt
251 -DENABLE_AVX=%{?with_avx:ON}%{!?with_avx:OFF} \
252 -DENABLE_SSE=%{?with_sse:ON}%{!?with_sse:OFF} \
253 -DENABLE_SSE2=%{?with_sse2:ON}%{!?with_sse2:OFF} \
254 -DENABLE_SSE3=%{?with_sse3:ON}%{!?with_sse3:OFF} \
255 -DENABLE_SSSE3=%{?with_ssse3:ON}%{!?with_ssse3:OFF} \
256 -DENABLE_SSE41=%{?with_sse41:ON}%{!?with_sse41:OFF} \
257 -DENABLE_SSE42=%{?with_sse42:ON}%{!?with_sse42:OFF} \
258 -DBUILD_NEW_PYTHON_SUPPORT=ON \
259 %{?with_ffmpeg:-DWITH_FFMPEG=ON} \
260 %{!?with_gstreamer:-DWITH_GSTREAMER=OFF} \
261 %{?with_opencl:-DWITH_OPENCL=ON} \
262 %{!?with_opencl_amdblas:-DWITH_OPENCLAMDBLAS=OFF} \
263 %{!?with_opencl_amdfft:-DWITH_OPENCLAMDFFT=OFF} \
264 %{?with_opengl:-DWITH_OPENGL=ON} \
265 %{?with_gomp:-DWITH_OPENMP=ON} \
266 %{?with_openni:-DWITH_OPENNI=ON} \
267 %{?with_pvapi:-DPVAPI_LIBRARY=%{_libdir}/libPvAPI.so}%{!?with_pvapi:-DWITH_PVAPI=OFF} \
268 %{?with_qt:-DWITH_QT=ON %{?with_opengl:-DWITH_QT_OPENGL=ON} -DQT_QMAKE_EXECUTABLE=/usr/bin/qmake-qt4} \
269 %{?with_tbb:-DWITH_TBB=ON} \
270 %{?with_unicap:-DWITH_UNICAP=ON} \
271 %{!?with_v4l:-DWITH_V4L=OFF} \
272 %{?with_ximea:-DWITH_XIMEA=ON} \
273 %{?with_xine:-DWITH_XINE=ON}
278 rm -rf $RPM_BUILD_ROOT
279 %{__make} -C build install \
280 DESTDIR=$RPM_BUILD_ROOT
283 %{__rm} -r $RPM_BUILD_ROOT%{_datadir}/OpenCV/doc
285 install -d $RPM_BUILD_ROOT%{_pkgconfigdir}
286 cp -p build/unix-install/opencv.pc $RPM_BUILD_ROOT%{_pkgconfigdir}
288 %py_comp $RPM_BUILD_ROOT%{py_sitedir}
289 %py_ocomp $RPM_BUILD_ROOT%{py_sitedir}
293 # move to proper directories, create symlink
294 install -d $RPM_BUILD_ROOT%{_javadir}
295 %{__mv} $RPM_BUILD_ROOT%{_datadir}/OpenCV/java/libopencv_java*.so $RPM_BUILD_ROOT%{_libdir}
296 %{__mv} $RPM_BUILD_ROOT%{_datadir}/OpenCV/java/opencv-*.jar $RPM_BUILD_ROOT%{_javadir}
297 rmdir $RPM_BUILD_ROOT%{_datadir}/OpenCV/java
298 ln -sf $(basename $RPM_BUILD_ROOT%{_javadir}/opencv-*.jar) $RPM_BUILD_ROOT%{_javadir}/opencv.jar
302 rm -rf $RPM_BUILD_ROOT
304 %post -p /sbin/ldconfig
305 %postun -p /sbin/ldconfig
307 %post core -p /sbin/ldconfig
308 %postun core -p /sbin/ldconfig
310 %post -n java-opencv -p /sbin/ldconfig
311 %postun -n java-opencv -p /sbin/ldconfig
314 %defattr(644,root,root,755)
315 %attr(755,root,root) %{_bindir}/opencv_createsamples
316 %attr(755,root,root) %{_bindir}/opencv_haartraining
317 %attr(755,root,root) %{_bindir}/opencv_performance
318 %attr(755,root,root) %{_bindir}/opencv_traincascade
319 %attr(755,root,root) %{_libdir}/libopencv_calib3d.so.%{sover}
320 %attr(755,root,root) %ghost %{_libdir}/libopencv_calib3d.so.2.4
321 %attr(755,root,root) %{_libdir}/libopencv_contrib.so.%{sover}
322 %attr(755,root,root) %ghost %{_libdir}/libopencv_contrib.so.2.4
323 %attr(755,root,root) %{_libdir}/libopencv_features2d.so.%{sover}
324 %attr(755,root,root) %ghost %{_libdir}/libopencv_features2d.so.2.4
325 %attr(755,root,root) %{_libdir}/libopencv_highgui.so.%{sover}
326 %attr(755,root,root) %ghost %{_libdir}/libopencv_highgui.so.2.4
327 %attr(755,root,root) %{_libdir}/libopencv_legacy.so.%{sover}
328 %attr(755,root,root) %ghost %{_libdir}/libopencv_legacy.so.2.4
329 %attr(755,root,root) %{_libdir}/libopencv_objdetect.so.%{sover}
330 %attr(755,root,root) %ghost %{_libdir}/libopencv_objdetect.so.2.4
332 %attr(755,root,root) %{_libdir}/libopencv_ocl.so.%{sover}
333 %attr(755,root,root) %ghost %{_libdir}/libopencv_ocl.so.2.4
335 %attr(755,root,root) %{_libdir}/libopencv_stitching.so.%{sover}
336 %attr(755,root,root) %ghost %{_libdir}/libopencv_stitching.so.2.4
337 %attr(755,root,root) %{_libdir}/libopencv_ts.so.%{sover}
338 %attr(755,root,root) %ghost %{_libdir}/libopencv_ts.so.2.4
339 %attr(755,root,root) %{_libdir}/libopencv_superres.so.%{sover}
340 %attr(755,root,root) %ghost %{_libdir}/libopencv_superres.so.2.4
341 %attr(755,root,root) %{_libdir}/libopencv_videostab.so.%{sover}
342 %attr(755,root,root) %ghost %{_libdir}/libopencv_videostab.so.2.4
343 %attr(755,root,root) %{_libdir}/libopencv_gpu.so.%{sover}
344 %attr(755,root,root) %ghost %{_libdir}/libopencv_gpu.so.2.4
345 %attr(755,root,root) %{_libdir}/libopencv_nonfree.so.%{sover}
346 %attr(755,root,root) %ghost %{_libdir}/libopencv_nonfree.so.2.4
347 %dir %{_datadir}/OpenCV
348 %{_datadir}/OpenCV/haarcascades
349 %{_datadir}/OpenCV/lbpcascades
352 %defattr(644,root,root,755)
353 %attr(755,root,root) %{_libdir}/libopencv_core.so.%{sover}
354 %ghost %{_libdir}/libopencv_core.so.2.4
355 %attr(755,root,root) %{_libdir}/libopencv_flann.so.%{sover}
356 %ghost %{_libdir}/libopencv_flann.so.2.4
357 %attr(755,root,root) %{_libdir}/libopencv_imgproc.so.%{sover}
358 %ghost %{_libdir}/libopencv_imgproc.so.2.4
359 %attr(755,root,root) %{_libdir}/libopencv_ml.so.%{sover}
360 %ghost %{_libdir}/libopencv_ml.so.2.4
361 %attr(755,root,root) %{_libdir}/libopencv_photo.so.%{sover}
362 %ghost %{_libdir}/libopencv_photo.so.2.4
363 %attr(755,root,root) %{_libdir}/libopencv_video.so.%{sover}
364 %ghost %{_libdir}/libopencv_video.so.2.4
367 %defattr(644,root,root,755)
368 %attr(755,root,root) %{_libdir}/libopencv_*.so
370 %exclude %{_libdir}/libopencv_java248.so
372 %{_includedir}/opencv
373 %{_includedir}/opencv2
374 %{_datadir}/OpenCV/OpenCV*.cmake
375 %{_pkgconfigdir}/opencv.pc
378 %defattr(644,root,root,755)
379 # TODO: probably could rebuild them and package via make install
383 %files -n java-opencv
384 %defattr(644,root,root,755)
385 %attr(755,root,root) %{_libdir}/libopencv_java248.so
386 %{_javadir}/opencv-248.jar
387 %{_javadir}/opencv.jar
390 %files -n python-opencv
391 %defattr(644,root,root,755)
392 %attr(755,root,root) %{py_sitedir}/cv2.so
393 %{py_sitedir}/cv.py[co]