%define rev  20
%define date 20110812

# found in Makefile
%define luvc_version  0.2.6
%define luvc_pre_ver %{date}svn%{rev}
%define luvc_src_ver %{luvc_version}-%{luvc_pre_ver}
%define rel 0.%{luvc_pre_ver}%{?dist}.5sunshine


Summary: An SDL video USB Video Class (UVC) grabber
Name: luvcview
Version: %{luvc_version}
Release: %{rel}
# from http://svn.quickcamteam.net/svn/luvcview/trunk/luvcview :
Source0: %{name}-%{version}-%{luvc_pre_ver}.tar.xz
# required headers
Source1: http://svn.berlios.de/svnroot/repos/linux-uvc/linux-uvc/trunk/uvcvideo.h
Source2: http://svn.berlios.de/svnroot/repos/linux-uvc/linux-uvc/trunk/uvc_compat.h
Source3: http://svn.quickcamteam.net/svn/qct/Linux/Common/include/dynctrl-logitech.h

Patch0: luvcview-trunk-r14-open_X11_later.patch
Patch2: luvcview-trunk-r10-name_and_capabilities.02.patch
Patch3: luvcview-trunk-r14-optflags.patch
Patch4: linuxvideodev2.patch

URL: http://mxhaard.free.fr/spca50x/Investigation/uvc/
License: GPLv2+
BuildRequires: make
BuildRequires: gcc
BuildRequires: SDL-devel
Obsoletes: uvcview < %{?epoch:%{epoch}:}%{version}
Provides:  uvcview = %{?epoch:%{epoch}:}%{version}

%description
Luvcview is an SDL video USB Video Class (UVC) grabber. It is a reference
implementation for a V4L2 client to the UVC driver.

%prep
%setup -n %{name}-%{version}-%{luvc_pre_ver}
%{__cp -p} %{SOURCE1} %{SOURCE2} %{SOURCE3} .
%patch -P 0 -p1
#%patch -P 2 -p1
%patch -P 3 -p1
%patch -P 4 -p0 -b .linuxvideodev

%build
%{__make} %{_smp_mflags} CC=${CC:-gcc} CPP=${CXX:-g++} \
  OPTFLAGS="$RPM_OPT_FLAGS" BIN=%{_bindir}

%install
%{__mkdir} -p %{buildroot}%{_bindir}
%{__install} %{name} %{buildroot}%{_bindir}

%files
%doc README COPYING Changelog ToDo
%{_bindir}/%{name}

%changelog
* Sun Nov 10 2024 Moritz Barsnick <moritz+rpm@barsnick.net> 0.2.6-0.20110812svn20.5sunshine
- use non-deprecated %%patch macro syntax

* Thu Dec 16 2021 Moritz Barsnick <moritz+rpm@barsnick.net> 0.2.6-0.20110812svn20.4sunshine
- add BR: make

* Wed Dec 15 2021 Moritz Barsnick <moritz+rpm@barsnick.net> 0.2.6-0.20110812svn20.3sunshine
- use proper Obsoletes:

* Mon Jul 13 2015 Moritz Barsnick <moritz+rpm@barsnick.net> 0.2.6-0.20110812svn20.2sunshine
- add a patch for videodev headers in newer kernels

* Wed Oct 26 2011 Moritz Barsnick <moritz+rpm@barsnick.net> 0.2.6-0.20110812svn20.1sunshine
- update to newer SVN version
- use xz packed source

* Tue Sep 08 2009 Moritz Barsnick <moritz+rpm@barsnick.net> 0.2.6-0.20090827svn19.1sunshine
- update to newer SVN version, now identified as 0.2.6

* Sat Feb 21 2009 Moritz Barsnick <moritz+rpm@barsnick.net> 0.2.5-0.20081226svn17.2sunshine
- rebuild for F10 on sunshine

* Mon Dec 29 2008 Moritz Barsnick <moritz+rpm@barsnick.net> 0.2.5-0.20081226svn17.1sunshine
- update to newer SVN version
- also update the included sources (though they have moved, but these
  versions are still much newer than the previous ones)
- obsolete the better fps display patch, a solution is upstream

* Mon Oct 20 2008 Moritz Barsnick <moritz+rpm@barsnick.net> 0.2.4-0.20081014svn15.1sunshine
- update to newer SVN version, which only adds a COPYING file
- add new COPYING file to %%doc

* Wed May 14 2008 Moritz Barsnick <moritz+rpm@barsnick.net> 0.2.4-0.20080424svn14.1sunshine
- update to newer SVN version
- update patches
- disable my name and capabilites patch for the time being

* Mon Mar 24 2008 Moritz Barsnick <moritz+rpm@barsnick.net> 0.2.3-0.20080324svn10.1sunshine
- use current source from SVN
- adapt naming scheme using official version and SVN date and revision
- my whitespace and perror patches are upsteam
- adapt my other patches to the new source
- the optflags patch is now a makeflags patch which also makes proper use of
  SDLFLAGS
- add ToDo to %%doc

* Thu Mar 20 2008 Moritz Barsnick <moritz+rpm@barsnick.net> 20070512-0.6sunshine
- add a personal patch to initialize X11 later (to allow querying with -L
  without a display)

* Thu Mar 20 2008 Moritz Barsnick <moritz+rpm@barsnick.net> 20070512-0.5sunshine
- the name patch also displays the selected format now
- update the whitespace patch to conform

* Thu Mar 20 2008 Moritz Barsnick <moritz+rpm@barsnick.net> 20070512-0.4sunshine
- add a patch from the mailing list for more stable display of fps

* Tue Mar 18 2008 Moritz Barsnick <moritz+rpm@barsnick.net> 20070512-0.3sunshine
- remodel the personal patches:
  - the name patch now also lists all known capabilities, and removes
    duplicate code
  - the whitespace and perror patches are adapted to that

* Sun Mar 16 2008 Moritz Barsnick <moritz+rpm@barsnick.net> 20070512-0.2sunshine
- add a personal patch for consequent usage of perror()
- subsequently adapt the whitespace patch to not touch the perror()
  calls
- add a personal patch to display the card name (which may solve confusion
  as to why the queried device isn't responding as expected)

* Sun Feb 24 2008 Moritz Barsnick <moritz+rpm@barsnick.net> 20070512-0.1sunshine
- initial RPM
- add personal patches for
  - fixing whitespace and linebreaks in output and logging
  - displaying the correct version (according to the changelog)
  - using rpm's optflags