]> git.pld-linux.org Git - packages/opencv.git/blob - opencv.spec
compile java with lower jre requirement
[packages/opencv.git] / opencv.spec
1 #
2 # TODO:
3 # - Smartek GigEVisionSDK (http://www.smartekvision.com/ but I can't see SDK with Linux library?)
4 # - CUDA support (on bcond)
5 # - ipp (libippi): http://software.intel.com/en-us/articles/intel-ipp/ (proprietary)
6 #
7 # Conditional build:
8 # - general options:
9 %bcond_with     tbb             # Threading Building Blocks support (everywhere)
10 %bcond_with     sse             # use SSE instructions
11 %bcond_with     sse2            # use SSE2 instructions
12 %bcond_without  opencl          # OpenCL support
13 %bcond_with     opencl_amdblas  # AMD OpenCL BLAS routines
14 %bcond_with     opencl_amdfft   # AMD OpenCL FFT routines
15 %bcond_without  opengl          # OpenGL support
16 # - bindings
17 %bcond_without  java            # Java binding
18 # - highgui options:
19 %bcond_without  ffmpeg          # FFMpeg support in highgui
20 %bcond_without  gstreamer       # GStreamer support in highgui
21 %bcond_with     openni          # OpenNI (Natural Interaction) support in highgui
22 %bcond_with     pvapi           # PvAPI (AVT GigE cameras) support in highgui (proprietary)
23 %bcond_with     qt              # Qt backend instead of GTK+ in highgui
24 %bcond_with     unicap          # Unicap support in highgui (GPL)
25 %bcond_with     v4l             # Video4Linux in highgui (even V4L2 support currently relies on V4L1 API)
26 %bcond_with     ximea           # m3API (XIMEA cameras) support in highgui (proprietary)
27 %bcond_with     xine            # XINE support in highgui (GPL)
28
29 %ifarch pentium3 pentium4 %{x8664}
30 %define         with_sse        1
31 %endif
32 %ifarch pentium4 %{x8664}
33 %define         with_sse2       1
34 %endif
35 Summary:        A library of programming functions mainly aimed at real time computer vision
36 Summary(pl.UTF-8):      Biblioteka funkcji do grafiki komputerowej w czasie rzeczywistym
37 Name:           opencv
38 Version:        2.4.5
39 Release:        3
40 Epoch:          1
41 %if %{with unicap} || %{with xine}
42 License:        GPL (enforced by used libraries), BSD (opencv itself)
43 %else
44 License:        BSD
45 %endif
46 Group:          Libraries
47 Source0:        http://downloads.sourceforge.net/opencvlibrary/opencv-unix/%{version}/opencv-%{version}.tar.gz
48 # Source0-md5:  8eac87462c7bec8b89021b723207c623
49 Patch0:         %{name}-cflags.patch
50 Patch1:         %{name}-link.patch
51 Patch2:         %{name}-unicap-c++.patch
52 Patch3:         %{name}-c.patch
53 Patch4:         %{name}-gcc.patch
54 Patch5:         %{name}-ximea.patch
55 Patch6:         %{name}-ocl-fft.patch
56 Patch7:         java-ant-sourcelevel.patch
57 URL:            http://opencv.willowgarage.com/
58 %{?with_pvapi:BuildRequires:    AVT_GigE_SDK-devel}
59 %{?with_opencl:BuildRequires:   OpenCL-devel}
60 BuildRequires:  OpenEXR-devel
61 %{?with_opengl:BuildRequires:   OpenGL-devel}
62 %{?with_opengl:BuildRequires:   OpenGL-GLU-devel}
63 # as of OpenCV 2.3.1-2.4.3 there is also check for OpenNI-sensor-PrimeSense, but the result is not used
64 %{?with_openni:BuildRequires:   OpenNI-devel}
65 %{?with_ximea:BuildRequires:    XIMEA-devel}
66 %{?with_java:BuildRequires:     ant}
67 %{?with_opencl_amdblas:BuildRequires:   clAmdBlas-devel}
68 %{?with_opencl_amdfft:BuildRequires:    clAmdFft-devel}
69 BuildRequires:  cmake >= 2.8
70 BuildRequires:  doxygen
71 BuildRequires:  eigen3 >= 3
72 %{?with_ffmpeg:BuildRequires:   ffmpeg-devel >= 0.7}
73 %if %{with gstreamer}
74 BuildRequires:  gstreamer-devel >= 0.10
75 BuildRequires:  gstreamer-plugins-base-devel >= 0.10
76 %endif
77 BuildRequires:  jasper-devel
78 %{?with_java:BuildRequires:     jdk}
79 BuildRequires:  libdc1394-devel
80 BuildRequires:  libjpeg-devel
81 BuildRequires:  libpng-devel
82 BuildRequires:  libraw1394-devel
83 BuildRequires:  libstdc++-devel
84 BuildRequires:  libtiff-devel
85 BuildRequires:  libtool
86 %if %{with unicap}
87 BuildRequires:  libucil-devel
88 BuildRequires:  libunicap-devel
89 %endif
90 BuildRequires:  libv4l-devel
91 BuildRequires:  pkgconfig
92 BuildRequires:  python
93 BuildRequires:  python-devel
94 BuildRequires:  python-numpy-devel
95 BuildRequires:  rpm-pythonprov
96 BuildRequires:  rpmbuild(macros) >= 1.606
97 BuildRequires:  sed >= 4.0
98 BuildRequires:  swig-python
99 %{?with_tbb:BuildRequires:      tbb-devel}
100 %{?with_xine:BuildRequires:     xine-lib-devel}
101 BuildRequires:  zlib-devel
102 %if %{with qt}
103 BuildRequires:  QtCore-devel >= 4
104 BuildRequires:  QtGui-devel >= 4
105 %{?with_opengl:BuildRequires:   QtOpenGL-devel >= 4}
106 BuildRequires:  qt4-qmake >= 4
107 %else
108 BuildRequires:  gtk+2-devel >= 2.0
109 %{?with_opengl:BuildRequires:   gtkglext-devel >= 1.0}
110 %endif
111 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
112
113 %description
114 OpenCV (Open Source Computer Vision) is a library of programming
115 functions mainly aimed at real time computer vision.
116
117 Example applications of the OpenCV library are:
118 - Human-Computer Interaction (HCI)
119 - Object Identification, Segmentation and Recognition
120 - Face Recognition
121 - Gesture Recognition
122 - Motion Tracking
123 - Ego Motion, Motion Understanding
124 - Structure From Motion (SFM)
125 - Stereo and Multi-Camera Calibration and Depth Computation
126 - Mobile Robotics.
127
128 %description -l pl.UTF-8
129 OpenCV (Open Source Computer Vision) to biblioteka funkcji
130 przeznaczonych głównie do grafiki komputerowej w czasie rzeczywistym.
131
132 Przykładowe zastosowania biblioteki OpenCV to
133 - interakcje człowiek-komputer (HCI)
134 - identyfikacja, segmentacja i rozpoznawanie obiektów
135 - rozpoznawanie twarzy
136 - rozpoznawanie gestów
137 - śledzenie ruchu
138 - rozumienie ruchu
139 - SFM (Structure From Motion)
140 - kalibracja dwu- i wielokamerowa, obliczanie głębi
141 - robotyka ruchu.
142
143 %package devel
144 Summary:        Header files for OpenCV library
145 Summary(pl.UTF-8):      Pliki nagłówkowe biblioteki OpenCV
146 Group:          Development/Libraries
147 Requires:       %{name} = %{epoch}:%{version}-%{release}
148 Obsoletes:      opencv-static
149
150 %description devel
151 Header files for OpenCV library.
152
153 %description devel -l pl.UTF-8
154 Pliki nagłówkowe biblioteki OpenCV.
155
156 %package -n java-opencv
157 Summary:        OpenCV Java bindings
158 Summary(pl.UTF-8):      Wiązania Javy do OpenCV
159 Group:          Libraries/Java
160 Requires:       %{name} = %{epoch}:%{version}-%{release}
161 Requires:       jre
162
163 %description -n java-opencv
164 OpenCV Java bindings.
165
166 %description -n java-opencv -l pl.UTF-8
167 Wiązania Javy do OpenCV.
168
169 %package -n python-opencv
170 Summary:        OpenCV Python bindings
171 Summary(pl.UTF-8):      Wiązania Pythona do OpenCV
172 Group:          Libraries/Python
173 Requires:       %{name} = %{epoch}:%{version}-%{release}
174 %pyrequires_eq  python-libs
175
176 %description -n python-opencv
177 OpenCV Python bindings.
178
179 %description -n python-opencv -l pl.UTF-8
180 Wiązania Pythona do OpenCV.
181
182 %prep
183 %setup -q
184
185 %undos CMakeLists.txt
186 %undos modules/gpu/CMakeLists.txt
187
188 %patch0 -p1
189 %patch1 -p1
190 %patch2 -p1
191 %patch3 -p1
192 %patch4 -p1
193 %patch5 -p1
194 %patch6 -p1
195 %patch7 -p1
196
197 %build
198 install -d build
199 cd build
200 %cmake .. \
201         -DENABLE_SSE=%{?with_sse:ON}%{!?with_sse:OFF} \
202         -DENABLE_SSE2=%{?with_sse2:ON}%{!?with_sse2:OFF} \
203         -DBUILD_NEW_PYTHON_SUPPORT=ON \
204         -DUSE_O3=OFF \
205         %{?with_ffmpeg:-DWITH_FFMPEG=ON} \
206         %{!?with_gstreamer:-DWITH_GSTREAMER=OFF} \
207         %{?with_opencl:-DWITH_OPENCL=ON} \
208         %{?with_opencl_amdblas:-DWITH_OPENCLAMDBLAS=ON} \
209         %{?with_opencl_amdfft:-DWITH_OPENCLAMDFFT=ON} \
210         %{?with_opengl:-DWITH_OPENGL=ON} \
211         %{?with_openni:-DWITH_OPENNI=ON} \
212         %{?with_pvapi:-DPVAPI_LIBRARY=%{_libdir}/libPvAPI.so}%{!?with_pvapi:-DWITH_PVAPI=OFF} \
213         %{?with_qt:-DWITH_QT=ON %{?with_opengl:-DWITH_QT_OPENGL=ON} -DQT_QMAKE_EXECUTABLE=/usr/bin/qmake-qt4} \
214         %{?with_tbb:-DWITH_TBB=ON} \
215         %{?with_unicap:-DWITH_UNICAP=ON} \
216         %{!?with_v4l:-DWITH_V4L=OFF} \
217         %{?with_ximea:-DWITH_XIMEA=ON} \
218         %{?with_xine:-DWITH_XINE=ON}
219
220 %{__make}
221
222 %install
223 rm -rf $RPM_BUILD_ROOT
224 %{__make} -C build install \
225         DESTDIR=$RPM_BUILD_ROOT
226
227 install -d $RPM_BUILD_ROOT%{_pkgconfigdir}
228 cp -p build/unix-install/opencv.pc $RPM_BUILD_ROOT%{_pkgconfigdir}
229
230 %py_comp $RPM_BUILD_ROOT%{py_sitedir}
231 %py_ocomp $RPM_BUILD_ROOT%{py_sitedir}
232 %py_postclean
233
234 %if %{with java}
235 # move to proper directories, create symlink
236 install -d $RPM_BUILD_ROOT%{_javadir}
237 %{__mv} $RPM_BUILD_ROOT%{_datadir}/OpenCV/java/libopencv_java*.so $RPM_BUILD_ROOT%{_libdir}
238 %{__mv} $RPM_BUILD_ROOT%{_datadir}/OpenCV/java/opencv-*.jar $RPM_BUILD_ROOT%{_javadir}
239 rmdir $RPM_BUILD_ROOT%{_datadir}/OpenCV/java
240 ln -sf $(basename $RPM_BUILD_ROOT%{_javadir}/opencv-*.jar) $RPM_BUILD_ROOT%{_javadir}/opencv.jar
241 %endif
242
243 %clean
244 rm -rf $RPM_BUILD_ROOT
245
246 %post   -p /sbin/ldconfig
247 %postun -p /sbin/ldconfig
248
249 %post   -n java-opencv -p /sbin/ldconfig
250 %postun -n java-opencv -p /sbin/ldconfig
251
252 %files
253 %defattr(644,root,root,755)
254 %attr(755,root,root) %{_bindir}/opencv_*
255 %attr(755,root,root) %{_libdir}/libopencv_*.so.*.*.*
256 %attr(755,root,root) %ghost %{_libdir}/libopencv_*.so.2.4
257 %dir %{_datadir}/OpenCV
258 %doc %{_datadir}/OpenCV/doc
259 %{_datadir}/OpenCV/haarcascades
260 %{_datadir}/OpenCV/lbpcascades
261
262 %files devel
263 %defattr(644,root,root,755)
264 %attr(755,root,root) %{_libdir}/libopencv_*.so
265 %if %{with java}
266 %exclude %{_libdir}/libopencv_java245.so
267 %endif
268 %{_includedir}/opencv
269 %{_includedir}/opencv2
270 %{_datadir}/OpenCV/OpenCVConfig*.cmake
271 %{_pkgconfigdir}/opencv.pc
272
273 %if %{with java}
274 %files -n java-opencv
275 %defattr(644,root,root,755)
276 %attr(755,root,root) %{_libdir}/libopencv_java245.so
277 %{_javadir}/opencv-245.jar
278 %{_javadir}/opencv.jar
279 %endif
280
281 %files -n python-opencv
282 %defattr(644,root,root,755)
283 %attr(755,root,root) %{py_sitedir}/cv2.so
284 %{py_sitedir}/cv.py[co]
This page took 0.227875 seconds and 4 git commands to generate.