]> git.pld-linux.org Git - packages/opencv.git/blob - opencv.spec
macro for java versioning
[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 # - GUI: VTK support
6 # - Use GCD NO
7 # - Use Concurrency NO
8 # - Use C= (CSTRIPES): NO
9 #   C/C++ Examples: NO
10 #
11 # Conditional build:
12 # - general options:
13 %bcond_with     tbb             # Threading Building Blocks support (everywhere)
14 %bcond_with     sse             # use SSE instructions
15 %bcond_with     sse2            # use SSE2 instructions
16 %bcond_with     sse3            # use SSE3 instructions
17 %bcond_with     ssse3           # use SSSE3 instructions
18 %bcond_with     sse41           # use SSE4.1 instructions
19 %bcond_with     sse42           # use SSE4.2 instructions
20 %bcond_with     avx             # use AVX instructions
21 %bcond_without  opencl          # OpenCL support
22 %bcond_with     opencl_amdblas  # AMD OpenCL BLAS routines
23 %bcond_with     opencl_amdfft   # AMD OpenCL FFT routines
24 %bcond_without  opengl          # OpenGL support
25 %bcond_without  gomp            # OpenMP support
26 %bcond_without  examples        # Install examples
27 # - bindings
28 %bcond_without  java            # Java binding
29 # - highgui options:
30 %bcond_without  ffmpeg          # FFMpeg support in highgui
31 %bcond_without  gstreamer       # GStreamer support in highgui
32 %bcond_with     openni          # OpenNI (Natural Interaction) support in highgui
33 %bcond_with     pvapi           # PvAPI (AVT GigE cameras) support in highgui (proprietary)
34 %bcond_with     qt              # Qt backend instead of GTK+ in highgui
35 %bcond_with     unicap          # Unicap support in highgui (GPL)
36 %bcond_without  v4l             # Video4Linux in highgui
37 %bcond_with     ximea           # m3API (XIMEA cameras) support in highgui (proprietary)
38 %bcond_with     xine            # XINE support in highgui (GPL)
39
40 %ifarch pentium3 pentium4 %{x8664}
41 %define         with_sse        1
42 %endif
43 %ifarch pentium4 %{x8664}
44 %define         with_sse2       1
45 %endif
46 Summary:        A library of programming functions mainly aimed at real time computer vision
47 Summary(pl.UTF-8):      Biblioteka funkcji do grafiki komputerowej w czasie rzeczywistym
48 Name:           opencv
49 Version:        2.4.9
50 Release:        1
51 Epoch:          1
52 %if %{with unicap} || %{with xine}
53 License:        GPL (enforced by used libraries), BSD (opencv itself)
54 %else
55 License:        BSD
56 %endif
57 Group:          Libraries
58 Source0:        https://github.com/Itseez/opencv/archive/%{version}/%{name}-%{version}.tar.gz
59 # Source0-md5:  cc0a8307403ff471f554197401ec0eb9
60 Patch0:         %{name}-cflags.patch
61 Patch1:         %{name}-link.patch
62 Patch2:         %{name}-unicap-c++.patch
63 Patch3:         %{name}-c.patch
64 Patch4:         %{name}-gcc.patch
65 Patch5:         %{name}-ximea.patch
66 Patch6:         %{name}-ocl-fft.patch
67 Patch7:         java-ant-sourcelevel.patch
68 Patch8:         %{name}-shared.patch
69 URL:            http://www.opencv.org/
70 %{?with_pvapi:BuildRequires:    AVT_GigE_SDK-devel}
71 %{?with_opencl:BuildRequires:   OpenCL-devel}
72 BuildRequires:  OpenEXR-devel
73 %{?with_opengl:BuildRequires:   OpenGL-GLU-devel}
74 %{?with_opengl:BuildRequires:   OpenGL-devel}
75 # as of OpenCV 2.3.1-2.4.3 there is also check for OpenNI-sensor-PrimeSense, but the result is not used
76 %{?with_openni:BuildRequires:   OpenNI-devel}
77 %{?with_ximea:BuildRequires:    XIMEA-devel >= 4}
78 %{?with_java:BuildRequires:     ant}
79 %{?with_opencl_amdblas:BuildRequires:   clAmdBlas-devel}
80 %{?with_opencl_amdfft:BuildRequires:    clAmdFft-devel}
81 BuildRequires:  cmake >= 2.8
82 BuildRequires:  doxygen
83 BuildRequires:  eigen3 >= 3
84 %{?with_ffmpeg:BuildRequires:   ffmpeg-devel >= 0.7}
85 %{?with_gomp:BuildRequires:     gcc-c++ >= 6:4.2}
86 %if %{with gstreamer}
87 BuildRequires:  gstreamer-devel >= 0.10
88 BuildRequires:  gstreamer-plugins-base-devel >= 0.10
89 %endif
90 BuildRequires:  jasper-devel
91 %{?with_java:BuildRequires:     jdk}
92 BuildRequires:  libdc1394-devel
93 %{?with_gomp:BuildRequires:     libgomp-devel}
94 BuildRequires:  libjpeg-devel
95 BuildRequires:  libpng-devel
96 BuildRequires:  libraw1394-devel
97 BuildRequires:  libstdc++-devel
98 BuildRequires:  libtiff-devel
99 BuildRequires:  libtool
100 %if %{with unicap}
101 BuildRequires:  libucil-devel
102 BuildRequires:  libunicap-devel
103 %endif
104 BuildRequires:  libv4l-devel
105 BuildRequires:  pkgconfig
106 BuildRequires:  python
107 BuildRequires:  python-devel
108 BuildRequires:  python-numpy-devel
109 BuildRequires:  rpm-pythonprov
110 BuildRequires:  rpmbuild(macros) >= 1.606
111 BuildRequires:  sed >= 4.0
112 BuildRequires:  swig-python
113 %{?with_tbb:BuildRequires:      tbb-devel}
114 %{?with_xine:BuildRequires:     xine-lib-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         sover   %(v=%{version}; k=${v#?.?.?}; echo ${v%$k})
129 %define         jver    %(echo %{version} | tr -d .)
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 devel
174 Summary:        Header files for OpenCV library
175 Summary(pl.UTF-8):      Pliki nagłówkowe biblioteki OpenCV
176 Group:          Development/Libraries
177 Requires:       %{name} = %{epoch}:%{version}-%{release}
178 Obsoletes:      opencv-static
179
180 %description devel
181 Header files for OpenCV library.
182
183 %description devel -l pl.UTF-8
184 Pliki nagłówkowe biblioteki OpenCV.
185
186 %package doc
187 Summary:        Manual for OpenCV
188 Summary(fr.UTF-8):      Documentation pour OpenCV
189 Summary(it.UTF-8):      Documentazione di OpenCV
190 Summary(pl.UTF-8):      Podręcznik dla OpenCV
191 Group:          Documentation
192 # noarch subpackages only when building with rpm5
193 %if "%{_rpmversion}" >= "5"
194 BuildArch:      noarch
195 %endif
196
197 %description doc
198 Documentation for OpenCV.
199
200 %description doc -l fr.UTF-8
201 Documentation pour OpenCV.
202
203 %description doc -l it.UTF-8
204 Documentazione di OpenCV.
205
206 %description doc -l pl.UTF-8
207 Dokumentacja do OpenCV.
208
209 %package examples
210 Summary:        OpenCV code examples
211 Group:          Documentation
212 %if "%{_rpmversion}" >= "5"
213 BuildArch:      noarch
214 %endif
215
216 %description examples
217 OpenCV code examples.
218
219 %package -n java-opencv
220 Summary:        OpenCV Java bindings
221 Summary(pl.UTF-8):      Wiązania Javy do OpenCV
222 Group:          Libraries/Java
223 Requires:       %{name} = %{epoch}:%{version}-%{release}
224 Requires:       jre
225
226 %description -n java-opencv
227 OpenCV Java bindings.
228
229 %description -n java-opencv -l pl.UTF-8
230 Wiązania Javy do OpenCV.
231
232 %package -n python-opencv
233 Summary:        OpenCV Python bindings
234 Summary(pl.UTF-8):      Wiązania Pythona do OpenCV
235 Group:          Libraries/Python
236 Requires:       %{name} = %{epoch}:%{version}-%{release}
237 Requires:       python-libs
238
239 %description -n python-opencv
240 OpenCV Python bindings.
241
242 %description -n python-opencv -l pl.UTF-8
243 Wiązania Pythona do OpenCV.
244
245 %prep
246 %setup -q
247
248 %undos CMakeLists.txt
249 %undos modules/gpu/CMakeLists.txt
250
251 %patch0 -p1
252 %patch1 -p1
253 %patch2 -p1
254 %patch3 -p1
255 %patch4 -p1
256 %patch5 -p1
257 %patch6 -p1
258 %patch7 -p1
259 %patch8 -p1
260
261 %build
262 install -d build
263 cd build
264
265 # handle cmake & ccache
266 # http://stackoverflow.com/questions/1815688/how-to-use-ccache-with-cmakec
267 if [[ "%{__cc}" = *ccache* ]]; then
268         cc="%{__cc}"
269         cxx="%{__cxx}"
270         ccache="
271         -DCMAKE_C_COMPILER="ccache" -DCMAKE_C_COMPILER_ARG1="${cc#ccache }" \
272         -DCMAKE_CXX_COMPILER="ccache" -DCMAKE_CXX_COMPILER_ARG1="${cxx#ccache }" \
273         "
274 fi
275
276 %cmake .. \
277         $ccache \
278         -DENABLE_AVX=%{?with_avx:ON}%{!?with_avx:OFF} \
279         -DENABLE_SSE=%{?with_sse:ON}%{!?with_sse:OFF} \
280         -DENABLE_SSE2=%{?with_sse2:ON}%{!?with_sse2:OFF} \
281         -DENABLE_SSE3=%{?with_sse3:ON}%{!?with_sse3:OFF} \
282         -DENABLE_SSSE3=%{?with_ssse3:ON}%{!?with_ssse3:OFF} \
283         -DENABLE_SSE41=%{?with_sse41:ON}%{!?with_sse41:OFF} \
284         -DENABLE_SSE42=%{?with_sse42:ON}%{!?with_sse42:OFF} \
285         -DBUILD_NEW_PYTHON_SUPPORT=ON \
286 %if %{with examples}
287         -DINSTALL_C_EXAMPLES=ON \
288         -DINSTALL_PYTHON_EXAMPLES=ON \
289 %endif
290         %{?with_ffmpeg:-DWITH_FFMPEG=ON} \
291         %{!?with_gstreamer:-DWITH_GSTREAMER=OFF} \
292         %{?with_opencl:-DWITH_OPENCL=ON} \
293         %{!?with_opencl_amdblas:-DWITH_OPENCLAMDBLAS=OFF} \
294         %{!?with_opencl_amdfft:-DWITH_OPENCLAMDFFT=OFF} \
295         %{?with_opengl:-DWITH_OPENGL=ON} \
296         %{?with_gomp:-DWITH_OPENMP=ON} \
297         %{?with_openni:-DWITH_OPENNI=ON} \
298         %{?with_pvapi:-DPVAPI_LIBRARY=%{_libdir}/libPvAPI.so}%{!?with_pvapi:-DWITH_PVAPI=OFF} \
299         %{?with_qt:-DWITH_QT=ON %{?with_opengl:-DWITH_QT_OPENGL=ON} -DQT_QMAKE_EXECUTABLE=/usr/bin/qmake-qt4} \
300         %{?with_tbb:-DWITH_TBB=ON} \
301         %{?with_unicap:-DWITH_UNICAP=ON} \
302         %{!?with_v4l:-DWITH_V4L=OFF} \
303         %{?with_ximea:-DWITH_XIMEA=ON} \
304         %{?with_xine:-DWITH_XINE=ON}
305
306 %{__make}
307
308 %install
309 rm -rf $RPM_BUILD_ROOT
310 %{__make} -C build install \
311         DESTDIR=$RPM_BUILD_ROOT
312
313 # see -doc package
314 %{__rm} -r $RPM_BUILD_ROOT%{_datadir}/OpenCV/doc
315 %if %{with examples}
316 install -d $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
317 mv $RPM_BUILD_ROOT%{_datadir}/OpenCV/samples/* $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
318 %endif
319
320 install -d $RPM_BUILD_ROOT%{_pkgconfigdir}
321 cp -p build/unix-install/opencv.pc $RPM_BUILD_ROOT%{_pkgconfigdir}
322
323 %py_comp $RPM_BUILD_ROOT%{py_sitedir}
324 %py_ocomp $RPM_BUILD_ROOT%{py_sitedir}
325 %py_postclean
326
327 %if %{with java}
328 # move to proper directories, create symlink
329 install -d $RPM_BUILD_ROOT%{_javadir}
330 %{__mv} $RPM_BUILD_ROOT%{_datadir}/OpenCV/java/libopencv_java*.so $RPM_BUILD_ROOT%{_libdir}
331 %{__mv} $RPM_BUILD_ROOT%{_datadir}/OpenCV/java/opencv-*.jar $RPM_BUILD_ROOT%{_javadir}
332 rmdir $RPM_BUILD_ROOT%{_datadir}/OpenCV/java
333 ln -sf $(basename $RPM_BUILD_ROOT%{_javadir}/opencv-*.jar) $RPM_BUILD_ROOT%{_javadir}/opencv.jar
334 %endif
335
336 %clean
337 rm -rf $RPM_BUILD_ROOT
338
339 %post   -p /sbin/ldconfig
340 %postun -p /sbin/ldconfig
341
342 %post   core -p /sbin/ldconfig
343 %postun core -p /sbin/ldconfig
344
345 %post   -n java-opencv -p /sbin/ldconfig
346 %postun -n java-opencv -p /sbin/ldconfig
347
348 %files
349 %defattr(644,root,root,755)
350 %attr(755,root,root) %{_bindir}/opencv_createsamples
351 %attr(755,root,root) %{_bindir}/opencv_haartraining
352 %attr(755,root,root) %{_bindir}/opencv_performance
353 %attr(755,root,root) %{_bindir}/opencv_traincascade
354 %attr(755,root,root) %{_libdir}/libopencv_calib3d.so.%{sover}
355 %attr(755,root,root) %ghost %{_libdir}/libopencv_calib3d.so.2.4
356 %attr(755,root,root) %{_libdir}/libopencv_contrib.so.%{sover}
357 %attr(755,root,root) %ghost %{_libdir}/libopencv_contrib.so.2.4
358 %attr(755,root,root) %{_libdir}/libopencv_features2d.so.%{sover}
359 %attr(755,root,root) %ghost %{_libdir}/libopencv_features2d.so.2.4
360 %attr(755,root,root) %{_libdir}/libopencv_highgui.so.%{sover}
361 %attr(755,root,root) %ghost %{_libdir}/libopencv_highgui.so.2.4
362 %attr(755,root,root) %{_libdir}/libopencv_legacy.so.%{sover}
363 %attr(755,root,root) %ghost %{_libdir}/libopencv_legacy.so.2.4
364 %attr(755,root,root) %{_libdir}/libopencv_objdetect.so.%{sover}
365 %attr(755,root,root) %ghost %{_libdir}/libopencv_objdetect.so.2.4
366 %if %{with opencl}
367 %attr(755,root,root) %{_libdir}/libopencv_ocl.so.%{sover}
368 %attr(755,root,root) %ghost %{_libdir}/libopencv_ocl.so.2.4
369 %endif
370 %attr(755,root,root) %{_libdir}/libopencv_stitching.so.%{sover}
371 %attr(755,root,root) %ghost %{_libdir}/libopencv_stitching.so.2.4
372 %attr(755,root,root) %{_libdir}/libopencv_ts.so.%{sover}
373 %attr(755,root,root) %ghost %{_libdir}/libopencv_ts.so.2.4
374 %attr(755,root,root) %{_libdir}/libopencv_superres.so.%{sover}
375 %attr(755,root,root) %ghost %{_libdir}/libopencv_superres.so.2.4
376 %attr(755,root,root) %{_libdir}/libopencv_videostab.so.%{sover}
377 %attr(755,root,root) %ghost %{_libdir}/libopencv_videostab.so.2.4
378 %attr(755,root,root) %{_libdir}/libopencv_gpu.so.%{sover}
379 %attr(755,root,root) %ghost %{_libdir}/libopencv_gpu.so.2.4
380 %attr(755,root,root) %{_libdir}/libopencv_nonfree.so.%{sover}
381 %attr(755,root,root) %ghost %{_libdir}/libopencv_nonfree.so.2.4
382 %dir %{_datadir}/OpenCV
383 %{_datadir}/OpenCV/haarcascades
384 %{_datadir}/OpenCV/lbpcascades
385
386 %files core
387 %defattr(644,root,root,755)
388 %attr(755,root,root) %{_libdir}/libopencv_core.so.%{sover}
389 %ghost %{_libdir}/libopencv_core.so.2.4
390 %attr(755,root,root) %{_libdir}/libopencv_flann.so.%{sover}
391 %ghost %{_libdir}/libopencv_flann.so.2.4
392 %attr(755,root,root) %{_libdir}/libopencv_imgproc.so.%{sover}
393 %ghost %{_libdir}/libopencv_imgproc.so.2.4
394 %attr(755,root,root) %{_libdir}/libopencv_ml.so.%{sover}
395 %ghost %{_libdir}/libopencv_ml.so.2.4
396 %attr(755,root,root) %{_libdir}/libopencv_photo.so.%{sover}
397 %ghost %{_libdir}/libopencv_photo.so.2.4
398 %attr(755,root,root) %{_libdir}/libopencv_video.so.%{sover}
399 %ghost %{_libdir}/libopencv_video.so.2.4
400
401 %files devel
402 %defattr(644,root,root,755)
403 %attr(755,root,root) %{_libdir}/libopencv_*.so
404 %if %{with java}
405 %exclude %{_libdir}/libopencv_java%{jver}.so
406 %endif
407 %{_includedir}/opencv
408 %{_includedir}/opencv2
409 %{_datadir}/OpenCV/OpenCV*.cmake
410 %{_pkgconfigdir}/opencv.pc
411
412 %files doc
413 %defattr(644,root,root,755)
414 # TODO: probably could rebuild them and package via make install
415 %doc doc/*
416
417 %if %{with examples}
418 %files examples
419 %defattr(644,root,root,755)
420 %{_examplesdir}/%{name}-%{version}
421 %endif
422
423 %if %{with java}
424 %files -n java-opencv
425 %defattr(644,root,root,755)
426 %attr(755,root,root) %{_libdir}/libopencv_java%{jver}.so
427 %{_javadir}/opencv-%{jver}.jar
428 %{_javadir}/opencv.jar
429 %endif
430
431 %files -n python-opencv
432 %defattr(644,root,root,755)
433 %attr(755,root,root) %{py_sitedir}/cv2.so
434 %{py_sitedir}/cv.py[co]
This page took 0.087948 seconds and 4 git commands to generate.