opencv/opencv.spec
2010-12-14 09:26:55 +00:00

194 lines
5.8 KiB
RPMSpec

#
# spec file for package opencv (Version 2.1.0)
#
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# 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}
%define soname 2
Version: 2.1.0
Release: 6
Summary: Collection of algorithms for computer vision
Group: Development/Libraries
License: BSD3c
Url: http://%{name}.willowgarage.com/wiki/
Source0: http://downloads.sourceforge.net/project/%{name}library/%{name}-unix/2.1/OpenCV-%{version}.tar.bz2
Patch0: %{name}-2.1-libdir.patch
Patch1: %{name}-2.1-samples.patch
Patch2: libpng14.patch
# PATCH-FIX-UPSTREAM %{name}-2.1-underlinking.patch sf#3083546 reddwarf@opensuse.org -- Link against libv4l2
Patch3: %{name}-2.1-underlinking.patch
Patch4: opencv-gcc-46.diff
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: gstreamer-0_10-devel gstreamer-0_10-plugins-base-devel
%if 0%{?suse_version} >= 1110
BuildRequires: libdc1394-devel libv4l-devel libxine-devel
%else
BuildRequires: xine-devel
%endif
BuildRequires: gtk2-devel libjasper-devel libjpeg-devel libtiff-devel
BuildRequires: cmake gcc-c++ libpng-devel python-devel swig zlib-devel
%if %{with ffmpeg}
BuildRequires: libffmpeg-devel
%endif
%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
Group: Development/Libraries
%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.
%package devel
License: BSD3c
Summary: Development files for using the OpenCV library
Group: Development/Libraries
Requires: %{libname}%{soname} = %{version}
Requires: %{name} = %{version}
%description devel
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
Group: Development/Libraries
Requires: python-base
%description -n python-%{name}
This package contains Python bindings for the OpenCV library.
%package -n python-%{name}-compat
Summary: Old Python bindings for apps which use OpenCV
Group: Development/Libraries
Requires: python-base
%description -n python-%{name}-compat
This package contains the old Python bindings for the OpenCV library.
%package -n %{name}-doc
Summary: Documentation and examples for OpenCV
Group: Documentation
# Since this package also contains examples that need -devel to be compiled
Recommends: %{name}-devel
%description -n %{name}-doc
This package contains the documentation and examples for the OpenCV library.
%prep
%setup -qn OpenCV-%{version}
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3
%patch4
# Windows specific and with wrong end of line
%{__rm} -f doc/packaging.txt
%{__chmod} +x samples/c/build_all.sh
sed -i 's/\r$//' samples/c/adaptiveskindetector.cpp \
samples/c/calibration_artificial.cpp \
samples/c/grabcut.cpp \
samples/python/camshift.py
%build
export CFLAGS=$RPM_OPT_FLAGS
export CXXFLAGS=$RPM_OPT_FLAGS
%{__mkdir} build
cd build
cmake -DCMAKE_SKIP_RPATH=ON \
-DCMAKE_INSTALL_PREFIX='%{_prefix}' \
-DLIB_SUFFIX=$(echo %_lib | cut -b4-) \
-DCMAKE_BUILD_TYPE=Release \
-DUSE_OMIT_FRAME_POINTER=OFF \
-DWITH_XINE=ON \
-DBUILD_TESTS=OFF \
-DBUILD_SWIG_PYTHON_SUPPORT=ON \
-DINSTALL_C_EXAMPLES=ON \
-DINSTALL_PYTHON_EXAMPLES=ON \
..
%{__make} %{?jobs:-j %jobs} VERBOSE=1
%install
cd build
%{__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
%clean
rm -rf %{buildroot}
%post -n %{libname}%{soname} -p /sbin/ldconfig
%postun -n %{libname}%{soname} -p /sbin/ldconfig
%files -n %{libname}%{soname}
%defattr(-, root, root, 0755)
%{_libdir}/lib*.so.*
%files -n %{name}
%defattr(0644, root, root, 0755)
%attr(0755, root, root) %{_bindir}/%{name}_*
%{_datadir}/%{name}
%exclude %{_datadir}/%{name}/OpenCVConfig.cmake
%files devel
%defattr(0644, root, root, 0755)
%{_includedir}/%{name}
%{_libdir}/lib*.so
%{_libdir}/pkgconfig/%{name}.pc
%{_datadir}/%{name}/OpenCVConfig.cmake
%files -n python-%{name}
%defattr(0644, root, root, 0755)
%if 0%{?suse_version} < 1120
%{py_sitedir}/cv.so
%else
%{python_sitearch}/cv.so
%endif
%files -n python-%{name}-compat
%defattr(-, root, root, 0755)
%if 0%{?suse_version} < 1120
%{py_sitedir}/%{name}
%else
%{python_sitearch}/%{name}
%endif
%files -n %{name}-doc
%defattr(-, root, root, 0755)
%{_docdir}/%{name}-doc
%changelog