File webcam-tools.spec of Package webcam-tools

#
# spec file for webcam-tools 
#
# Copyright (c) spec 2012 Bjørn Lie, Bryne, Norway.
#
# 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/
#


Name:           webcam-tools
%define _name libwebcam
Version:        0.2.2
Release:        1
License:        LGPL-3.0+ 
URL:            http://sourceforge.net/projects/libwebcam/
Summary:        V4L2 userspace webcam library / controller
Source:         %_name-src-%version.tar.gz
# PATCH-FIX-OPENSUSE libwebcam-silence-uvcdynctrl.patch zaitor@opensuse.org  -- Turn of debug output, taken from fedora
Patch0:         libwebcam-silence-uvcdynctrl.patch
Group:          Hardware/Camera
BuildRequires:  kernel-devel
BuildRequires:  cmake
BuildRequires:  gcc-c++
BuildRequires:  pkg-config
BuildRequires:  pkgconfig(libxml-2.0)
BuildRequires:  gengetopt
BuildRequires:  libv4l2-0
BuildRoot:      %{_tmppath}/%{_name}-src-%{version}

%description
libwebcam / uvcdynctrl - user space and udev support for UVC cameras

%package -n libwebcam0
Version:        0.2.2
Summary:        V4L2 / UVC userspace library
%description -n libwebcam0
Shared library to support configuration and control of cameras

%package -n libwebcam-devel
Version:        0.2.2
Requires:       libwebcam0 = %{version}
Group:          Development/Tools/Other
Summary:        V4L2 / UVC userspace development files
%description -n libwebcam-devel
V4L2 / UVC userspace webcam library development headers

%package -n uvcdynctrl
Version:        0.2.2
Summary:        Camera control utility
%description -n uvcdynctrl
For setup and manipulation of extended camera controls, with udev support

%prep
%setup -q -n %{_name}-src-%version
%patch0 -p1

%build
%__mkdir build
pushd build

%ifarch x86_64
cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_LIBDIR=lib64 ..
%else
cmake -DCMAKE_INSTALL_PREFIX=/usr ..
%endif

make
popd

%install
rm -rf $RPM_BUILD_ROOT
%__mkdir -p $RPM_BUILD_ROOT/usr/include
%__install -m 0644 common/include/webcam.h $RPM_BUILD_ROOT/usr/include/webcam.h
%__install -m 0644 common/include/dynctrl-logitech.h $RPM_BUILD_ROOT/usr/include/dynctrl-logitech.h
cd build
make install DESTDIR=$RPM_BUILD_ROOT
rm $RPM_BUILD_ROOT%{_libdir}/libwebcam.a

%post -n libwebcam0
/sbin/ldconfig

%postun -n libwebcam0
/sbin/ldconfig

%files -n libwebcam0
%defattr(0755, root, root)
%{_libdir}/libwebcam.so.0
%{_libdir}/libwebcam.so.0.2.2

%files -n libwebcam-devel
%defattr(0644, root, root)
%{_includedir}/webcam.h
%{_includedir}/dynctrl-logitech.h
%{_libdir}/libwebcam.so
%{_libdir}/pkgconfig/libwebcam.pc

%files -n uvcdynctrl
%defattr(0755, root, root)
%{_bindir}/uvcdynctrl
%{_bindir}/uvcdynctrl-0.2.2
%dir /lib/udev
/lib/udev/uvcdynctrl
%defattr(0644, root, root)
%dir /lib/udev/rules.d
/lib/udev/rules.d/80-uvcdynctrl.rules
%{_datadir}/uvcdynctrl
%doc %{_mandir}/man1/uvc*.1%{?ext_man}

%changelog