opencv/opencv.spec
Stephan Kulow b7f02a04a1 Accepting request 99574 from KDE:Distro:Factory
- Use Explicit Buildrequires on several needed libraries
  future dependency cleanups may/will cause build to fail otherwise. (forwarded request 99538 from elvigia)

OBS-URL: https://build.opensuse.org/request/show/99574
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/opencv?expand=0&rev=29
2012-01-10 13:51:10 +00:00

194 lines
6.3 KiB
RPMSpec

#
# spec file for package opencv
#
# Copyright (c) 2012 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_3
Version: 2.3.1a
Release: 0
%define dirver 2.3.1
Summary: Collection of algorithms for computer vision
License: BSD-3-Clause
Group: Development/Libraries/C and C++
Url: http://%{name}.willowgarage.com/wiki/
Source0: http://downloads.sourceforge.net/project/%{name}library/%{name}-unix/%{dirver}/OpenCV-%{version}.tar.bz2
# PATCH-FIX-UPSTREAM opencv-libdir.patch koprok@nand.bg -- Add an option to install libraries and python packages in lib64.
Patch0: %{name}-libdir.patch
# PATCH-FIX-UPSTREAM opencv-samples.patch koprok@nand.bg -- Improve samples installation.
Patch1: %{name}-samples.patch
# 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
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: OpenEXR-devel
BuildRequires: cmake
BuildRequires: dos2unix
BuildRequires: fdupes
BuildRequires: gstreamer-0_10-plugins-base-devel
BuildRequires: libdc1394-devel
BuildRequires: libeigen2-devel
BuildRequires: libjasper-devel
BuildRequires: libqt4-devel
#BuildRequires: libucil-devel
#BuildRequires: libunicap-devel
BuildRequires: libxine-devel
BuildRequires: python-numpy-devel
BuildRequires: libtiff-devel
BuildRequires: zlib-devel
BuildRequires: libjpeg-devel
BuildRequires: libilmbase-devel
%if %{with ffmpeg}
BuildRequires: libffmpeg-devel
%endif
%if 0%{?suse_version} < 1210
BuildRequires: libv4l-devel
%else
BuildRequires: libv4l-devel >= 0.8.4
%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/C and C++
%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
Summary: Development files for using the OpenCV library
Group: Development/Libraries/C and C++
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/Python
Requires: python-base = %{py_ver}
%py_requires
%description -n python-%{name}
This package contains Python bindings for the OpenCV library.
%package -n %{name}-doc
Summary: Documentation and examples for OpenCV
Group: Development/Libraries/C and C++
Recommends: python
# 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-%{dirver}
%patch0 -p1
%patch1 -p1
%patch2
%patch3 -p1
%patch4 -p1
# 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/latentsvmdetect.cpp \
samples/gpu/hog.cpp \
samples/python/camshift.py
%build
export CFLAGS="%{optflags}"
export CXXFLAGS="%{optflags}"
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX='%{_prefix}' \
-DCMAKE_SKIP_RPATH=ON \
-DBUILD_TESTS=OFF \
-DINSTALL_C_EXAMPLES=ON \
-DINSTALL_PYTHON_EXAMPLES=ON \
-DLIB_SUFFIX=$(echo %{_lib} | cut -b4-) \
-DUSE_OMIT_FRAME_POINTER=OFF \
-DWITH_QT=ON \
-DWITH_QT_OPENGL=ON \
-DWITH_UNICAP=ON \
-DWITH_XINE=ON \
..
make %{?_smp_mflags} 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
dos2unix %{buildroot}%{_docdir}/%{name}-doc/examples/python*/*.py
dos2unix %{buildroot}%{_docdir}/%{name}-doc/examples/gpu/*.cpp
%fdupes -s %{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}/opencv
%{_includedir}/opencv2
%{_libdir}/lib*.so
%{_libdir}/pkgconfig/%{name}.pc
%{_datadir}/%{name}/OpenCVConfig*.cmake
%files -n python-%{name}
%defattr(0644, root, root, 0755)
%{python_sitearch}/cv.py
%{python_sitearch}/cv2.so
%files -n %{name}-doc
%defattr(-, root, root, 0755)
%{_docdir}/%{name}-doc
%changelog