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