%bcond_with xine
-%define snap pre1
Summary: A library of programming functions mainly aimed at real time computer vision
Name: opencv
-Version: 1.1
-Release: 0.%{snap}.5
+Version: 2.1.0
+Release: 1
Epoch: 1
License: BSD
Group: Libraries
-Source0: http://dl.sourceforge.net/opencvlibrary/%{name}-%{version}%{snap}.tar.gz
-# Source0-md5: b147b7cd3c059831c415c5a2bcecdf95
-Patch0: %{name}-ffmpeg.patch
-Patch1: %{name}-am.patch
-Patch2: %{name}-build.patch
+Source0: http://downloads.sourceforge.net/opencvlibrary/OpenCV-%{version}.tar.bz2
+# Source0-md5: 1d71584fb4e04214c0085108f95e24c8
+Patch0: %{name}-2.0.0-libpng14.patch
+Patch1: %{name}-2.1.0-mmap.patch
+Patch2: %{name}-2.1.0-multilib.patch
+Patch3: %{name}-cflags.patch
URL: http://opencv.willowgarage.com
-BuildRequires: autoconf >= 2.53
-BuildRequires: automake
+BuildRequires: cmake
BuildRequires: ffmpeg-devel
BuildRequires: jasper-devel
BuildRequires: libdc1394-devel
BuildRequires: libraw1394-devel
BuildRequires: libtiff-devel
BuildRequires: libtool
+BuildRequires: pkgconfig
BuildRequires: python-devel
BuildRequires: rpm-pythonprov
BuildRequires: swig-python
OpenCV Python bindings.
%prep
-%setup -q -n %{name}-%{version}.0
+%setup -q -n OpenCV-%{version}
+
+%undos src/ml/CMakeLists.txt
+%undos CMakeLists.txt
+%undos src/cv/CMakeLists.txt
+%undos src/cxcore/CMakeLists.txt
+
%patch0 -p0
-%patch1 -p1
+%patch1 -p0
%patch2 -p1
-
-sed -i -e 's#ACLOCAL_AMFLAGS.*##g' Makefile.am
-sed -i -e 's#pkgpython#pkgpyexec#g' interfaces/swig/python/Makefile.am
-sed -i -e 's#-L$(SWIG_PYTHON_LIBS)#$(NOTING_NOT_EMPTY_LINE)#g' interfaces/swig/python/Makefile.am
+%patch3 -p1
%build
-%{__libtoolize}
-%{__aclocal} -I autotools/aclocal
-%{__autoconf}
-%{__automake}
-%configure \
+install -d build
+cd build
+%cmake \
+ -DCMAKE_INSTALL_PREFIX=%{_prefix} \
%ifarch i686 pentium4 athlon %{x8664}
- --enable-sse2 \
-%else
- --disable-sse2 \
+ -DENABLE_SSE2=ON \
+%endif
+ -DBUILD_NEW_PYTHON_SUPPORT=ON \
+%if %{with xine}
+ -DWITH_XINE=ON \
%endif
- --with-python \
- --with%{!?with_xine:out}-xine \
- --with-ffmpeg \
- --with-1394libs \
- --with-v4l \
- --with-gtk \
- --without-gstreamer \
- --without-quicktime
-%{__make}
+ -DWITH_GSTREAMER=OFF \
+ -DWITH_1394=ON \
+ -DWITH_FFMPEG=ON \
+ -DWITH_GTK=ON \
+ -DWITH_V4L=ON \
+%if "%{_lib}" == "lib64"
+ -DLIB_SUFFIX=64 \
+%endif
+ ../
+
+%{__make} \
+ VERBOSE=1
%install
rm -rf $RPM_BUILD_ROOT
-%{__make} install \
+%{__make} -C build install \
DESTDIR=$RPM_BUILD_ROOT
+install -d $RPM_BUILD_ROOT%{_pkgconfigdir}
+install build/unix-install/opencv.pc $RPM_BUILD_ROOT%{_pkgconfigdir}
+
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(644,root,root,755)
-%doc AUTHORS COPYING ChangeLog THANKS TODO
-%doc docs/*.{htm,rtf,png,txt} docs/papers docs/ref
%attr(755,root,root) %{_bindir}/*
%attr(755,root,root) %{_libdir}/lib*so.*.*
-%attr(755,root,root) %ghost %{_libdir}/lib*.so.2
+%attr(755,root,root) %ghost %{_libdir}/lib*.so.2.1
+%dir %{_datadir}/opencv
+%{_datadir}/opencv/doc
+%{_datadir}/opencv/haarcascades
+%{_datadir}/opencv/lbpcascades
%files devel
%defattr(644,root,root,755)
%attr(755,root,root) %{_libdir}/lib*.so
-%{_libdir}/lib*.la
%{_includedir}/opencv
+%{_datadir}/opencv/OpenCVConfig.cmake
%{_pkgconfigdir}/*.pc
-%files static
-%defattr(644,root,root,755)
-%{_libdir}/lib*.a
+#%files static
+#%defattr(644,root,root,755)
+#%{_libdir}/lib*.a
%files -n python-opencv
%defattr(644,root,root,755)
-%dir %{py_sitedir}/opencv
-%attr(755,root,root) %{py_sitedir}/opencv/*.so
-%{py_sitedir}/opencv/*.py[co]
+%attr(755,root,root) %{py_sitedir}/cv.so