2010-03-08 18:16:50 +01:00
#
2011-01-14 15:36:03 +01:00
# spec file for package opencv
2010-03-08 18:16:50 +01:00
#
2012-01-10 14:51:10 +01:00
# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
2010-03-08 18:16:50 +01:00
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
%bcond_with ffmpeg
Name : opencv
%define libname lib%{name}
2011-10-18 14:24:16 +02:00
%define soname 2_3
Version : 2.3.1a
2012-01-04 07:25:38 +01:00
Release : 0
2011-10-18 14:24:16 +02:00
%define dirver 2.3.1
2011-07-07 14:28:27 +02:00
Summary : Collection of algorithms for computer vision
2012-01-04 07:25:38 +01:00
License : BSD-3-Clause
2011-10-18 14:24:16 +02:00
Group : Development/Libraries/C and C++
2012-01-04 07:25:38 +01:00
Url : http://%{name} .willowgarage.com/wiki/
2011-10-18 14:24:16 +02:00
Source0 : http://downloads.sourceforge.net/project/%{name} library/%{name} -unix/%{dirver} /OpenCV-%{version} .tar.bz2
2012-01-04 07:25:38 +01:00
# PATCH-FIX-UPSTREAM opencv-libdir.patch koprok@nand.bg -- Add an option to install libraries and python packages in lib64.
2011-08-24 14:04:40 +02:00
Patch0 : %{name} -libdir.patch
2012-01-04 07:25:38 +01:00
# PATCH-FIX-UPSTREAM opencv-samples.patch koprok@nand.bg -- Improve samples installation.
2011-08-24 14:04:40 +02:00
Patch1 : %{name} -samples.patch
2012-01-04 07:25:38 +01:00
# PATCH-FIX-UPSTREAM opencv-2.3-underlinking.patch reddwarf@opensuse.org -- Make libopencv_highgui.so link to libv4l2 since it's using symbols defined there.
Patch2 : %{name} -2.3-underlinking.patch
# PATCH-FIX-OPENSUSE opencv-datadir.patch koprok@nand.bg -- Install data files in share/opencv instead of share/OpenCV.
Patch3 : %{name} -datadir.patch
# PATCH-FIX-UPSTREAM opencv-clang.patch idoenmez@suse.de -- Upstream r6881 to fix clang compatibility
Patch4 : %{name} -clang.patch
2012-03-20 11:30:49 +01:00
# PATCH-FIX-UPSTREAM opencv-gcc47.patch dimstar@opensuse.org -- Fix build with gcc 4.7.
Patch5 : opencv-gcc47.patch
2010-03-08 18:16:50 +01:00
BuildRoot : %{_tmppath} /%{name} -%{version} -build
2011-07-07 14:28:27 +02:00
BuildRequires : OpenEXR-devel
BuildRequires : cmake
2011-10-18 14:24:16 +02:00
BuildRequires : dos2unix
BuildRequires : fdupes
BuildRequires : gstreamer-0_10-plugins-base-devel
BuildRequires : libdc1394-devel
BuildRequires : libeigen2-devel
2011-07-07 14:28:27 +02:00
BuildRequires : libjasper-devel
2011-08-18 09:52:40 +02:00
BuildRequires : libqt4-devel
2011-10-18 14:24:16 +02:00
#BuildRequires: libucil-devel
#BuildRequires: libunicap-devel
2012-03-20 11:30:49 +01:00
BuildRequires : libilmbase-devel
BuildRequires : libjpeg-devel
BuildRequires : libtiff-devel
2011-10-18 14:24:16 +02:00
BuildRequires : libxine-devel
BuildRequires : python-numpy-devel
2012-01-10 14:51:10 +01:00
BuildRequires : zlib-devel
2010-03-08 18:16:50 +01:00
%if %{with ffmpeg}
BuildRequires : libffmpeg-devel
%endif
2011-07-07 14:28:27 +02:00
%if 0%{?suse_version} < 1210
BuildRequires : libv4l-devel
%else
BuildRequires : libv4l-devel >= 0.8.4
%endif
2010-12-14 10:27:03 +01:00
2010-03-08 18:16:50 +01:00
%description
OpenCV means Intel® Open Source Computer Vision Library. It is a collection of C
functions and a few C++ classes that implement some popular Image Processing and
Computer Vision algorithms.
%package -n %{libname}%{soname}
Summary : Development files for using the OpenCV library
2011-10-18 14:24:16 +02:00
Group : Development/Libraries/C and C++
2010-03-08 18:16:50 +01:00
%description -n %{libname}%{soname}
The Open Computer Vision Library is a collection of algorithms and sample code
for various computer vision problems. The library is compatible with IPL and
utilizes Intel Integrated Performance Primitives for better performance.
2010-04-25 18:45:15 +02:00
%package devel
2010-03-08 18:16:50 +01:00
Summary : Development files for using the OpenCV library
2011-10-18 14:24:16 +02:00
Group : Development/Libraries/C and C++
2010-03-08 18:16:50 +01:00
Requires : %{libname} %{soname} = %{version}
Requires : %{name} = %{version}
2010-04-25 18:45:15 +02:00
%description devel
2010-03-08 18:16:50 +01:00
This package contains the OpenCV C/C++ library and header files, as well as
documentation. It should be installed if you want to develop programs that will
use the OpenCV library.
%package -n python-%{name}
Summary : Python bindings for apps which use OpenCV
2011-10-18 14:24:16 +02:00
Group : Development/Libraries/Python
Requires : python-base = %{py_ver}
%py_requires
2010-03-08 18:16:50 +01:00
%description -n python-%{name}
This package contains Python bindings for the OpenCV library.
%package -n %{name}-doc
Summary : Documentation and examples for OpenCV
2011-10-18 14:24:16 +02:00
Group : Development/Libraries/C and C++
Recommends: python
2010-03-08 18:16:50 +01:00
# Since this package also contains examples that need -devel to be compiled
2010-04-25 18:45:15 +02:00
Recommends: %{name} -devel
2010-03-08 18:16:50 +01:00
%description -n %{name}-doc
This package contains the documentation and examples for the OpenCV library.
%prep
2011-10-18 14:24:16 +02:00
%setup -qn OpenCV-%{dirver}
2010-04-16 01:10:55 +02:00
%patch0 -p1
%patch1 -p1
2012-01-04 07:25:38 +01:00
%patch2
%patch3 -p1
%patch4 -p1
2012-03-20 11:30:49 +01:00
%patch5 -p1
2011-07-07 14:28:27 +02:00
2010-03-08 18:16:50 +01:00
# Windows specific and with wrong end of line
2011-07-07 14:28:27 +02:00
rm -f doc/packaging.txt
chmod +x samples/c/build_all.sh
2010-04-25 18:45:15 +02:00
sed -i 's/\r$//' samples/c/adaptiveskindetector.cpp \
2011-01-14 15:35:53 +01:00
samples/c/latentsvmdetect.cpp \
samples/gpu/hog.cpp \
2010-04-25 18:45:15 +02:00
samples/python/camshift.py
2010-03-08 18:16:50 +01:00
%build
2011-07-07 14:28:27 +02:00
export CFLAGS=" %{optflags} "
export CXXFLAGS=" %{optflags} "
mkdir build
2010-03-08 18:16:50 +01:00
cd build
2011-10-18 14:24:16 +02:00
cmake -DCMAKE_BUILD_TYPE=Release \
2010-03-08 18:16:50 +01:00
-DCMAKE_INSTALL_PREFIX='%{_prefix}' \
2011-10-18 14:24:16 +02:00
-DCMAKE_SKIP_RPATH=ON \
-DBUILD_TESTS=OFF \
-DINSTALL_C_EXAMPLES=ON \
-DINSTALL_PYTHON_EXAMPLES=ON \
2011-07-07 14:28:27 +02:00
-DLIB_SUFFIX=$(echo %{_lib} | cut -b4-) \
2010-03-08 18:16:50 +01:00
-DUSE_OMIT_FRAME_POINTER=OFF \
2011-08-18 09:52:40 +02:00
-DWITH_QT=ON \
-DWITH_QT_OPENGL=ON \
2011-10-18 14:24:16 +02:00
-DWITH_UNICAP=ON \
-DWITH_XINE=ON \
2010-03-08 18:16:50 +01:00
..
2011-07-07 14:28:27 +02:00
make %{?_smp_mflags} VERBOSE=1
2010-03-08 18:16:50 +01:00
%install
cd build
2011-07-07 14:28:27 +02:00
make DESTDIR=%{?buildroot:%{buildroot} } install/fast
mkdir -p %{buildroot} %{_docdir}
mv %{buildroot} %{_datadir} /%{name} /doc %{buildroot} %{_docdir} /%{name} -doc
mv %{buildroot} %{_datadir} /%{name} /samples %{buildroot} %{_docdir} /%{name} -doc/examples
2011-10-18 14:24:16 +02:00
dos2unix %{buildroot} %{_docdir} /%{name} -doc/examples/python*/*.py
dos2unix %{buildroot} %{_docdir} /%{name} -doc/examples/gpu/*.cpp
%fdupes -s %{buildroot} %{_docdir} /%{name} -doc/examples
2010-03-08 18:16:50 +01:00
%clean
rm -rf %{buildroot}
2011-10-18 14:24:16 +02:00
%post -n %{libname}%{soname} -p /sbin/ldconfig
2010-03-08 18:16:50 +01:00
%postun -n %{libname}%{soname} -p /sbin/ldconfig
%files -n %{libname}%{soname}
2010-04-25 18:45:15 +02:00
%defattr (-, root, root, 0755)
2010-03-08 18:16:50 +01:00
%{_libdir} /lib*.so.*
%files -n %{name}
%defattr (0644, root, root, 0755)
%attr (0755, root, root) %{_bindir} /%{name} _*
%{_datadir} /%{name}
2011-08-24 14:04:40 +02:00
%exclude %{_datadir} /%{name} /OpenCVConfig*.cmake
2010-03-08 18:16:50 +01:00
2010-04-25 18:45:15 +02:00
%files devel
2010-03-08 18:16:50 +01:00
%defattr (0644, root, root, 0755)
2011-01-14 15:35:53 +01:00
%{_includedir} /opencv
%{_includedir} /opencv2
2010-03-08 18:16:50 +01:00
%{_libdir} /lib*.so
%{_libdir} /pkgconfig/%{name} .pc
2011-08-24 14:04:40 +02:00
%{_datadir} /%{name} /OpenCVConfig*.cmake
2010-03-08 18:16:50 +01:00
%files -n python-%{name}
%defattr (0644, root, root, 0755)
2011-08-24 14:04:40 +02:00
%{python_sitearch} /cv.py
2011-08-18 09:52:40 +02:00
%{python_sitearch} /cv2.so
2010-03-08 18:16:50 +01:00
%files -n %{name}-doc
%defattr (-, root, root, 0755)
%{_docdir} /%{name} -doc
%changelog