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