Accepting request 75617 from KDE:Distro:Factory

Fix compilation with kernel 2.6.38 headers which removed v4l interface. (forwarded request 75616 from namtrac)

OBS-URL: https://build.opensuse.org/request/show/75617
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/opencv?expand=0&rev=17
This commit is contained in:
Sascha Peilicke 2011-07-07 12:28:27 +00:00 committed by Git OBS Bridge
parent 8eba5ee96d
commit 390780546f
3 changed files with 77 additions and 21 deletions

33
opencv-v4l-2.6.38.patch Normal file
View File

@ -0,0 +1,33 @@
diff -up OpenCV-2.2.0/modules/highgui/src/cap_v4l.cpp.nov4l1 OpenCV-2.2.0/modules/highgui/src/cap_v4l.cpp
--- OpenCV-2.2.0/modules/highgui/src/cap_v4l.cpp.nov4l1 2010-12-05 11:35:25.000000000 +0800
+++ OpenCV-2.2.0/modules/highgui/src/cap_v4l.cpp 2011-04-18 10:40:01.984950054 +0800
@@ -214,7 +214,7 @@
#include <sys/types.h>
#include <sys/mman.h>
-#include <linux/videodev.h>
+#include <libv4l1-videodev.h>
#include <string.h>
#include <stdlib.h>
diff -up OpenCV-2.2.0/modules/highgui/src/cap_v4l.cpp.nov4l1 OpenCV-2.2.0/modules/highgui/src/cap_libv4l.cpp.cpp
--- OpenCV-2.2.0/modules/highgui/src/cap_libv4l.cpp.nov4l1 2010-12-05 11:35:25.000000000 +0800
+++ OpenCV-2.2.0/modules/highgui/src/cap_libv4l.cpp 2011-04-18 10:39:07.568578185 +0800
@@ -224,7 +224,7 @@
#include "highgui.h"
#include "precomp.hpp"
-#if !defined WIN32 && defined HAVE_CAMV4L && defined HAVE_CAMV4L2
+#if !defined WIN32 && defined HAVE_CAMV4L2
#define CLEAR(x) memset (&(x), 0, sizeof (x))
@@ -241,7 +241,7 @@
#include <sys/stat.h>
#include <sys/ioctl.h>
-#include <linux/videodev.h>
+#include <libv4l1-videodev.h>
#include <linux/videodev2.h>
#include <libv4l1.h>

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Wed Jul 6 08:23:04 UTC 2011 - idonmez@novell.com
- Add opencv-v4l-2.6.38.patch: use the new libv4l2 interface
-------------------------------------------------------------------
Mon Dec 27 16:56:15 EET 2010 - koprok@nand.bg

View File

@ -23,32 +23,48 @@ Name: opencv
%define soname 2_2
Version: 2.2.0
Release: 1
Summary: Collection of algorithms for computer vision
Group: Development/Libraries
License: BSD3c
Summary: Collection of algorithms for computer vision
Url: http://%{name}.willowgarage.com/wiki/
Group: Development/Libraries
Source0: http://downloads.sourceforge.net/project/%{name}library/%{name}-unix/2.2/OpenCV-%{version}.tar.bz2
Patch0: %{name}-2.2-libdir.patch
Patch1: %{name}-2.2-samples.patch
# PATCH-FIX-UPSTREAM %{name}-2.1-underlinking.patch sf#3083546 reddwarf@opensuse.org -- Link against libv4l2
Patch3: %{name}-2.1-underlinking.patch
Patch4: %{name}-2.2-gcc46.patch
Patch5: %{name}-2.2-zlib.patch
# PATCH-FIX-UPSTREAM opencv-v4l-2.6.38.patch idoenmez@suse.de -- Fix libv4l2 support
Patch6: opencv-v4l-2.6.38.patch
BuildRequires: gstreamer-0_10-plugins-base-devel
BuildRequires: pkgconfig(gstreamer-0.10)
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
BuildRequires: libdc1394-devel
BuildRequires: libxine-devel
%else
BuildRequires: xine-devel
%endif
BuildRequires: OpenEXR-devel gtk2-devel libjasper-devel libjpeg-devel libtiff-devel
BuildRequires: cmake gcc-c++ libpng-devel python-devel zlib-devel
BuildRequires: OpenEXR-devel
BuildRequires: cmake
BuildRequires: gcc-c++
BuildRequires: libjasper-devel
BuildRequires: libjpeg-devel
BuildRequires: libpng-devel
BuildRequires: libtiff-devel
BuildRequires: python-devel
BuildRequires: zlib-devel
BuildRequires: pkgconfig(gtk+-2.0)
%if %{with ffmpeg}
BuildRequires: libffmpeg-devel
%endif
%if 0%{?suse_version} >= 1130
BuildRequires: python-numpy-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
@ -57,7 +73,6 @@ Computer Vision algorithms.
%package -n %{libname}%{soname}
Summary: Development files for using the OpenCV library
Group: Development/Libraries
@ -81,7 +96,6 @@ use the OpenCV library.
%package -n python-%{name}
Summary: Python bindings for apps which use OpenCV
Group: Development/Libraries
Requires: python-base
@ -91,7 +105,6 @@ This package contains 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
@ -107,22 +120,27 @@ This package contains the documentation and examples for the OpenCV library.
%patch3
%patch4 -p1
%patch5 -p1
%if 0%{?suse_version} >= 1210
%patch6 -p1
%endif
# Windows specific and with wrong end of line
%{__rm} -f doc/packaging.txt
%{__chmod} +x samples/c/build_all.sh
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=$RPM_OPT_FLAGS
export CXXFLAGS=$RPM_OPT_FLAGS
%{__mkdir} build
export CFLAGS="%{optflags}"
export CXXFLAGS="%{optflags}"
mkdir build
cd build
cmake -DCMAKE_SKIP_RPATH=ON \
-DCMAKE_INSTALL_PREFIX='%{_prefix}' \
-DLIB_SUFFIX=$(echo %_lib | cut -b4-) \
-DLIB_SUFFIX=$(echo %{_lib} | cut -b4-) \
-DCMAKE_BUILD_TYPE=Release \
-DUSE_OMIT_FRAME_POINTER=OFF \
-DWITH_XINE=ON \
@ -130,14 +148,14 @@ cmake -DCMAKE_SKIP_RPATH=ON \
-DINSTALL_C_EXAMPLES=ON \
-DINSTALL_PYTHON_EXAMPLES=ON \
..
%{__make} %{?jobs:-j %jobs} VERBOSE=1
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
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}