]> git.pld-linux.org Git - packages/opencv.git/blob - opencv.spec
- rel 3
[packages/opencv.git] / opencv.spec
1 # TODO:
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)
5 #
6 # Conditional build:
7 # - general options:
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 (available when not using tbb)
21 %bcond_without  examples        # Install examples
22 # - bindings
23 %bcond_without  java            # Java binding
24 # - highgui options:
25 %bcond_without  ffmpeg          # FFMpeg support in highgui
26 %bcond_without  gstreamer       # GStreamer support in highgui
27 %bcond_with     openni          # OpenNI (Natural Interaction) support in highgui
28 %bcond_with     pvapi           # PvAPI (AVT GigE cameras) support in highgui (proprietary)
29 %bcond_with     qt              # Qt backend instead of GTK+ in highgui
30 %bcond_with     unicap          # Unicap support in highgui (GPL)
31 %bcond_without  v4l             # Video4Linux in highgui
32 %bcond_with     ximea           # m3API (XIMEA cameras) support in highgui (proprietary)
33 %bcond_with     xine            # XINE support in highgui (GPL)
34 # - other modules
35 %bcond_without  vtk             # VTK library support (opencv_viz module)
36
37 %ifarch pentium3 pentium4 %{x8664}
38 %define         with_sse        1
39 %endif
40 %ifarch pentium4 %{x8664}
41 %define         with_sse2       1
42 %endif
43 Summary:        A library of programming functions mainly aimed at real time computer vision
44 Summary(pl.UTF-8):      Biblioteka funkcji do grafiki komputerowej w czasie rzeczywistym
45 Name:           opencv
46 Version:        2.4.9
47 Release:        3
48 Epoch:          1
49 %if %{with unicap} || %{with xine}
50 License:        GPL (enforced by used libraries), BSD (opencv itself)
51 %else
52 License:        BSD
53 %endif
54 Group:          Libraries
55 Source0:        https://github.com/Itseez/opencv/archive/%{version}/%{name}-%{version}.tar.gz
56 # Source0-md5:  cc0a8307403ff471f554197401ec0eb9
57 Patch0:         %{name}-cflags.patch
58 Patch1:         %{name}-link.patch
59 Patch2:         %{name}-unicap-c++.patch
60 Patch3:         %{name}-c.patch
61 Patch4:         %{name}-gcc.patch
62 Patch5:         %{name}-ximea.patch
63 Patch6:         %{name}-ocl-fft.patch
64 Patch7:         java-ant-sourcelevel.patch
65 Patch8:         %{name}-shared.patch
66 URL:            http://www.opencv.org/
67 %{?with_pvapi:BuildRequires:    AVT_GigE_SDK-devel}
68 %{?with_opencl:BuildRequires:   OpenCL-devel}
69 BuildRequires:  OpenEXR-devel
70 %{?with_opengl:BuildRequires:   OpenGL-GLU-devel}
71 %{?with_opengl:BuildRequires:   OpenGL-devel}
72 # as of OpenCV 2.3.1-2.4.3 there is also check for OpenNI-sensor-PrimeSense, but the result is not used
73 %{?with_openni:BuildRequires:   OpenNI-devel}
74 %{?with_ximea:BuildRequires:    XIMEA-devel >= 4}
75 %{?with_java:BuildRequires:     ant}
76 %{?with_opencl_amdblas:BuildRequires:   clAmdBlas-devel}
77 %{?with_opencl_amdfft:BuildRequires:    clAmdFft-devel}
78 BuildRequires:  cmake >= 2.8
79 BuildRequires:  doxygen
80 BuildRequires:  eigen3 >= 3
81 %{?with_ffmpeg:BuildRequires:   ffmpeg-devel >= 0.7}
82 %{?with_gomp:BuildRequires:     gcc-c++ >= 6:4.2}
83 %if %{with gstreamer}
84 BuildRequires:  gstreamer-devel >= 0.10
85 BuildRequires:  gstreamer-plugins-base-devel >= 0.10
86 %endif
87 BuildRequires:  jasper-devel
88 %{?with_java:BuildRequires:     jdk}
89 BuildRequires:  libdc1394-devel
90 %{?with_gomp:BuildRequires:     libgomp-devel}
91 BuildRequires:  libjpeg-devel
92 BuildRequires:  libpng-devel
93 BuildRequires:  libraw1394-devel
94 BuildRequires:  libstdc++-devel
95 BuildRequires:  libtiff-devel
96 BuildRequires:  libtool
97 %if %{with unicap}
98 BuildRequires:  libucil-devel
99 BuildRequires:  libunicap-devel
100 %endif
101 BuildRequires:  libv4l-devel
102 BuildRequires:  pkgconfig
103 BuildRequires:  python
104 BuildRequires:  python-devel
105 BuildRequires:  python-numpy-devel
106 BuildRequires:  rpm-pythonprov
107 BuildRequires:  rpmbuild(macros) >= 1.606
108 BuildRequires:  sed >= 4.0
109 BuildRequires:  swig-python
110 %{?with_tbb:BuildRequires:      tbb-devel}
111 %{?with_vtk:BuildRequires:      vtk-devel >= 5.8.0}
112 %{?with_xine:BuildRequires:     xine-lib-devel}
113 BuildRequires:  zlib-devel
114 %if %{with qt}
115 BuildRequires:  QtCore-devel >= 4
116 BuildRequires:  QtGui-devel >= 4
117 %{?with_opengl:BuildRequires:   QtOpenGL-devel >= 4}
118 BuildRequires:  qt4-qmake >= 4
119 %else
120 BuildRequires:  gtk+2-devel >= 2.0
121 %{?with_opengl:BuildRequires:   gtkglext-devel >= 1.0}
122 %endif
123 Requires:       %{name}-core = %{epoch}:%{version}-%{release}
124 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
125
126 %define         sover   %(v=%{version}; k=${v#?.?.?}; echo ${v%$k})
127 %define         jver    %(echo %{version} | tr -d .)
128
129 %description
130 OpenCV (Open Source Computer Vision) is a library of programming
131 functions mainly aimed at real time computer vision.
132
133 Example applications of the OpenCV library are:
134 - Human-Computer Interaction (HCI)
135 - Object Identification, Segmentation and Recognition
136 - Face Recognition
137 - Gesture Recognition
138 - Motion Tracking
139 - Ego Motion, Motion Understanding
140 - Structure From Motion (SFM)
141 - Stereo and Multi-Camera Calibration and Depth Computation
142 - Mobile Robotics.
143
144 %description -l pl.UTF-8
145 OpenCV (Open Source Computer Vision) to biblioteka funkcji
146 przeznaczonych głównie do grafiki komputerowej w czasie rzeczywistym.
147
148 Przykładowe zastosowania biblioteki OpenCV to
149 - interakcje człowiek-komputer (HCI)
150 - identyfikacja, segmentacja i rozpoznawanie obiektów
151 - rozpoznawanie twarzy
152 - rozpoznawanie gestów
153 - śledzenie ruchu
154 - rozumienie ruchu
155 - SFM (Structure From Motion)
156 - kalibracja dwu- i wielokamerowa, obliczanie głębi
157 - robotyka ruchu.
158
159 %package core
160 Summary:        OpenCV core libraries
161 Summary(pl.UTF-8):      Podstawowe biblioteki OpenCV
162 Group:          Libraries
163 Conflicts:      opencv < 2.4.6.2-1
164
165 %description core
166 This package contains the OpenCV C/C++ core libraries.
167
168 %description core -l pl.UTF-8
169 Ten pakiet zawiera podstawowe biblioteki C/C++ OpenCV.
170
171 %package viz
172 Summary:        OpenCV viz library (VTK support)
173 Summary(pl.UTF-8):      Biblioteka OpenCV viz (obsługa VTK)
174 Group:          Libraries
175 Requires:       %{name} = %{epoch}:%{version}-%{release}
176
177 %description viz
178 OpenCV viz library (VTK support).
179
180 %description viz -l pl.UTF-8
181 Biblioteka OpenCV viz (obsługa VTK).
182
183 %package devel
184 Summary:        Header files for OpenCV library
185 Summary(pl.UTF-8):      Pliki nagłówkowe biblioteki OpenCV
186 Group:          Development/Libraries
187 Requires:       %{name} = %{epoch}:%{version}-%{release}
188 %if %{with vtk}
189 Requires:       %{name}-viz = %{epoch}:%{version}-%{release}
190 %endif
191 Obsoletes:      opencv-static
192
193 %description devel
194 Header files for OpenCV library.
195
196 %description devel -l pl.UTF-8
197 Pliki nagłówkowe biblioteki OpenCV.
198
199 %package doc
200 Summary:        Manual for OpenCV
201 Summary(fr.UTF-8):      Documentation pour OpenCV
202 Summary(it.UTF-8):      Documentazione di OpenCV
203 Summary(pl.UTF-8):      Podręcznik dla OpenCV
204 Group:          Documentation
205 # noarch subpackages only when building with rpm5
206 %if "%{_rpmversion}" >= "5"
207 BuildArch:      noarch
208 %endif
209
210 %description doc
211 Documentation for OpenCV.
212
213 %description doc -l fr.UTF-8
214 Documentation pour OpenCV.
215
216 %description doc -l it.UTF-8
217 Documentazione di OpenCV.
218
219 %description doc -l pl.UTF-8
220 Dokumentacja do OpenCV.
221
222 %package examples
223 Summary:        OpenCV code examples
224 Group:          Documentation
225 %if "%{_rpmversion}" >= "5"
226 BuildArch:      noarch
227 %endif
228
229 %description examples
230 OpenCV code examples.
231
232 %package -n java-opencv
233 Summary:        OpenCV Java bindings
234 Summary(pl.UTF-8):      Wiązania Javy do OpenCV
235 Group:          Libraries/Java
236 Requires:       %{name} = %{epoch}:%{version}-%{release}
237 Requires:       jre
238
239 %description -n java-opencv
240 OpenCV Java bindings.
241
242 %description -n java-opencv -l pl.UTF-8
243 Wiązania Javy do OpenCV.
244
245 %package -n python-opencv
246 Summary:        OpenCV Python bindings
247 Summary(pl.UTF-8):      Wiązania Pythona do OpenCV
248 Group:          Libraries/Python
249 Requires:       %{name} = %{epoch}:%{version}-%{release}
250 Requires:       python-libs
251
252 %description -n python-opencv
253 OpenCV Python bindings.
254
255 %description -n python-opencv -l pl.UTF-8
256 Wiązania Pythona do OpenCV.
257
258 %prep
259 %setup -q
260
261 %undos CMakeLists.txt
262 %undos modules/gpu/CMakeLists.txt
263
264 %patch0 -p1
265 %patch1 -p1
266 %patch2 -p1
267 %patch3 -p1
268 %patch4 -p1
269 %patch5 -p1
270 %patch6 -p1
271 %patch7 -p1
272 %patch8 -p1
273
274 %build
275 install -d build
276 cd build
277
278 # handle cmake & ccache
279 # http://stackoverflow.com/questions/1815688/how-to-use-ccache-with-cmakec
280 if [[ "%{__cc}" = *ccache* ]]; then
281         cc="%{__cc}"
282         cxx="%{__cxx}"
283         ccache="
284         -DCMAKE_C_COMPILER="ccache" -DCMAKE_C_COMPILER_ARG1="${cc#ccache }" \
285         -DCMAKE_CXX_COMPILER="ccache" -DCMAKE_CXX_COMPILER_ARG1="${cxx#ccache }" \
286         "
287 fi
288
289 %cmake .. \
290         $ccache \
291         -DENABLE_AVX=%{?with_avx:ON}%{!?with_avx:OFF} \
292         -DENABLE_SSE=%{?with_sse:ON}%{!?with_sse:OFF} \
293         -DENABLE_SSE2=%{?with_sse2:ON}%{!?with_sse2:OFF} \
294         -DENABLE_SSE3=%{?with_sse3:ON}%{!?with_sse3:OFF} \
295         -DENABLE_SSSE3=%{?with_ssse3:ON}%{!?with_ssse3:OFF} \
296         -DENABLE_SSE41=%{?with_sse41:ON}%{!?with_sse41:OFF} \
297         -DENABLE_SSE42=%{?with_sse42:ON}%{!?with_sse42:OFF} \
298         -DBUILD_NEW_PYTHON_SUPPORT=ON \
299 %if %{with examples}
300         -DINSTALL_C_EXAMPLES=ON \
301         -DINSTALL_PYTHON_EXAMPLES=ON \
302 %endif
303         %{?with_ffmpeg:-DWITH_FFMPEG=ON} \
304         %{!?with_gstreamer:-DWITH_GSTREAMER=OFF} \
305         %{?with_opencl:-DWITH_OPENCL=ON} \
306         %{!?with_opencl_amdblas:-DWITH_OPENCLAMDBLAS=OFF} \
307         %{!?with_opencl_amdfft:-DWITH_OPENCLAMDFFT=OFF} \
308         %{?with_opengl:-DWITH_OPENGL=ON} \
309         %{?with_gomp:-DWITH_OPENMP=ON} \
310         %{?with_openni:-DWITH_OPENNI=ON} \
311         %{?with_pvapi:-DPVAPI_LIBRARY=%{_libdir}/libPvAPI.so}%{!?with_pvapi:-DWITH_PVAPI=OFF} \
312         %{?with_qt:-DWITH_QT=ON %{?with_opengl:-DWITH_QT_OPENGL=ON} -DQT_QMAKE_EXECUTABLE=/usr/bin/qmake-qt4} \
313         %{?with_tbb:-DWITH_TBB=ON} \
314         %{?with_unicap:-DWITH_UNICAP=ON} \
315         %{!?with_v4l:-DWITH_V4L=OFF} \
316         %{?with_vtk:-DWITH_VTK=ON} \
317         %{?with_ximea:-DWITH_XIMEA=ON} \
318         %{?with_xine:-DWITH_XINE=ON}
319
320 %{__make}
321
322 %install
323 rm -rf $RPM_BUILD_ROOT
324 %{__make} -C build install \
325         DESTDIR=$RPM_BUILD_ROOT
326
327 # see -doc package
328 %{__rm} -r $RPM_BUILD_ROOT%{_datadir}/OpenCV/doc
329 %if %{with examples}
330 install -d $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
331 mv $RPM_BUILD_ROOT%{_datadir}/OpenCV/samples/* $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
332 %endif
333
334 install -d $RPM_BUILD_ROOT%{_pkgconfigdir}
335 cp -p build/unix-install/opencv.pc $RPM_BUILD_ROOT%{_pkgconfigdir}
336
337 %py_comp $RPM_BUILD_ROOT%{py_sitedir}
338 %py_ocomp $RPM_BUILD_ROOT%{py_sitedir}
339 %py_postclean
340
341 %if %{with java}
342 # move to proper directories, create symlink
343 install -d $RPM_BUILD_ROOT%{_javadir}
344 %{__mv} $RPM_BUILD_ROOT%{_datadir}/OpenCV/java/libopencv_java*.so $RPM_BUILD_ROOT%{_libdir}
345 sed -i -e 's#/share/OpenCV/java/libopencv_java%{jver}\.so#/%{_lib}/libopencv_java%{jver}.so#g' \
346         $RPM_BUILD_ROOT%{_datadir}/OpenCV/OpenCVModules-pld.cmake
347 %{__mv} $RPM_BUILD_ROOT%{_datadir}/OpenCV/java/opencv-*.jar $RPM_BUILD_ROOT%{_javadir}
348 rmdir $RPM_BUILD_ROOT%{_datadir}/OpenCV/java
349 ln -sf $(basename $RPM_BUILD_ROOT%{_javadir}/opencv-*.jar) $RPM_BUILD_ROOT%{_javadir}/opencv.jar
350 %endif
351
352 %clean
353 rm -rf $RPM_BUILD_ROOT
354
355 %post   -p /sbin/ldconfig
356 %postun -p /sbin/ldconfig
357
358 %post   core -p /sbin/ldconfig
359 %postun core -p /sbin/ldconfig
360
361 %post   viz -p /sbin/ldconfig
362 %postun viz -p /sbin/ldconfig
363
364 %post   -n java-opencv -p /sbin/ldconfig
365 %postun -n java-opencv -p /sbin/ldconfig
366
367 %files
368 %defattr(644,root,root,755)
369 %attr(755,root,root) %{_bindir}/opencv_createsamples
370 %attr(755,root,root) %{_bindir}/opencv_haartraining
371 %attr(755,root,root) %{_bindir}/opencv_performance
372 %attr(755,root,root) %{_bindir}/opencv_traincascade
373 %attr(755,root,root) %{_libdir}/libopencv_calib3d.so.%{sover}
374 %attr(755,root,root) %ghost %{_libdir}/libopencv_calib3d.so.2.4
375 %attr(755,root,root) %{_libdir}/libopencv_contrib.so.%{sover}
376 %attr(755,root,root) %ghost %{_libdir}/libopencv_contrib.so.2.4
377 %attr(755,root,root) %{_libdir}/libopencv_features2d.so.%{sover}
378 %attr(755,root,root) %ghost %{_libdir}/libopencv_features2d.so.2.4
379 %attr(755,root,root) %{_libdir}/libopencv_gpu.so.%{sover}
380 %attr(755,root,root) %ghost %{_libdir}/libopencv_gpu.so.2.4
381 %attr(755,root,root) %{_libdir}/libopencv_highgui.so.%{sover}
382 %attr(755,root,root) %ghost %{_libdir}/libopencv_highgui.so.2.4
383 %attr(755,root,root) %{_libdir}/libopencv_legacy.so.%{sover}
384 %attr(755,root,root) %ghost %{_libdir}/libopencv_legacy.so.2.4
385 %attr(755,root,root) %{_libdir}/libopencv_nonfree.so.%{sover}
386 %attr(755,root,root) %ghost %{_libdir}/libopencv_nonfree.so.2.4
387 %attr(755,root,root) %{_libdir}/libopencv_objdetect.so.%{sover}
388 %attr(755,root,root) %ghost %{_libdir}/libopencv_objdetect.so.2.4
389 %if %{with opencl}
390 %attr(755,root,root) %{_libdir}/libopencv_ocl.so.%{sover}
391 %attr(755,root,root) %ghost %{_libdir}/libopencv_ocl.so.2.4
392 %endif
393 %attr(755,root,root) %{_libdir}/libopencv_stitching.so.%{sover}
394 %attr(755,root,root) %ghost %{_libdir}/libopencv_stitching.so.2.4
395 %attr(755,root,root) %{_libdir}/libopencv_superres.so.%{sover}
396 %attr(755,root,root) %ghost %{_libdir}/libopencv_superres.so.2.4
397 %attr(755,root,root) %{_libdir}/libopencv_ts.so.%{sover}
398 %attr(755,root,root) %ghost %{_libdir}/libopencv_ts.so.2.4
399 %attr(755,root,root) %{_libdir}/libopencv_videostab.so.%{sover}
400 %attr(755,root,root) %ghost %{_libdir}/libopencv_videostab.so.2.4
401 %dir %{_datadir}/OpenCV
402 %{_datadir}/OpenCV/haarcascades
403 %{_datadir}/OpenCV/lbpcascades
404
405 %files core
406 %defattr(644,root,root,755)
407 %attr(755,root,root) %{_libdir}/libopencv_core.so.%{sover}
408 %attr(755,root,root) %ghost %{_libdir}/libopencv_core.so.2.4
409 %attr(755,root,root) %{_libdir}/libopencv_flann.so.%{sover}
410 %attr(755,root,root) %ghost %{_libdir}/libopencv_flann.so.2.4
411 %attr(755,root,root) %{_libdir}/libopencv_imgproc.so.%{sover}
412 %attr(755,root,root) %ghost %{_libdir}/libopencv_imgproc.so.2.4
413 %attr(755,root,root) %{_libdir}/libopencv_ml.so.%{sover}
414 %attr(755,root,root) %ghost %{_libdir}/libopencv_ml.so.2.4
415 %attr(755,root,root) %{_libdir}/libopencv_photo.so.%{sover}
416 %attr(755,root,root) %ghost %{_libdir}/libopencv_photo.so.2.4
417 %attr(755,root,root) %{_libdir}/libopencv_video.so.%{sover}
418 %attr(755,root,root) %ghost %{_libdir}/libopencv_video.so.2.4
419
420 %if %{with vtk}
421 %files viz
422 %defattr(644,root,root,755)
423 %attr(755,root,root) %{_libdir}/libopencv_viz.so.%{sover}
424 %attr(755,root,root) %ghost %{_libdir}/libopencv_viz.so.2.4
425 %endif
426
427 %files devel
428 %defattr(644,root,root,755)
429 # core
430 %attr(755,root,root) %{_libdir}/libopencv_core.so
431 %attr(755,root,root) %{_libdir}/libopencv_flann.so
432 %attr(755,root,root) %{_libdir}/libopencv_imgproc.so
433 %attr(755,root,root) %{_libdir}/libopencv_ml.so
434 %attr(755,root,root) %{_libdir}/libopencv_photo.so
435 %attr(755,root,root) %{_libdir}/libopencv_video.so
436 # GUI/extensions (base package)
437 %attr(755,root,root) %{_libdir}/libopencv_calib3d.so
438 %attr(755,root,root) %{_libdir}/libopencv_contrib.so
439 %attr(755,root,root) %{_libdir}/libopencv_features2d.so
440 %attr(755,root,root) %{_libdir}/libopencv_gpu.so
441 %attr(755,root,root) %{_libdir}/libopencv_highgui.so
442 %attr(755,root,root) %{_libdir}/libopencv_legacy.so
443 %attr(755,root,root) %{_libdir}/libopencv_nonfree.so
444 %attr(755,root,root) %{_libdir}/libopencv_objdetect.so
445 %if %{with opencl}
446 %attr(755,root,root) %{_libdir}/libopencv_ocl.so
447 %endif
448 %attr(755,root,root) %{_libdir}/libopencv_stitching.so
449 %attr(755,root,root) %{_libdir}/libopencv_superres.so
450 %attr(755,root,root) %{_libdir}/libopencv_ts.so
451 %attr(755,root,root) %{_libdir}/libopencv_videostab.so
452 # viz
453 %if %{with vtk}
454 %attr(755,root,root) %{_libdir}/libopencv_viz.so
455 %endif
456 %{_includedir}/opencv
457 %{_includedir}/opencv2
458 %{_datadir}/OpenCV/OpenCV*.cmake
459 %{_pkgconfigdir}/opencv.pc
460
461 %files doc
462 %defattr(644,root,root,755)
463 # TODO: probably could rebuild them and package via make install
464 %doc doc/*
465
466 %if %{with examples}
467 %files examples
468 %defattr(644,root,root,755)
469 %{_examplesdir}/%{name}-%{version}
470 %endif
471
472 %if %{with java}
473 %files -n java-opencv
474 %defattr(644,root,root,755)
475 %attr(755,root,root) %{_libdir}/libopencv_java%{jver}.so
476 %{_javadir}/opencv-%{jver}.jar
477 %{_javadir}/opencv.jar
478 %endif
479
480 %files -n python-opencv
481 %defattr(644,root,root,755)
482 %attr(755,root,root) %{py_sitedir}/cv2.so
483 %{py_sitedir}/cv.py[co]
This page took 0.113565 seconds and 4 git commands to generate.