Summary: Utility tools for ivtv driver.
Name: ivtv-utils
Version: 1.3.0
Release: 1%{?_dist_release}
License: distributable
Group: Applications/Multimedia
URL: http://www.paken.org/linuxwiki/index.php?CX23416GYC-STVLP%A4%CE%B2%F2%C0%CF
Source0: http://dl.ivtvdriver.org/ivtv/archive/1.3.x/%{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot
Requires: perl-Config-IniFiles, perl-Tk, perl-Video-Capture-V4l
Requires: perl-Video-Frequencies
Requires: perl-Video-ivtv = 0.13
Requires: ivtv-firmware

%description
This package contains utilities for hardware ivtv based driver.

%prep
%setup -q
perl -pi -e's,/sbin/depmod,:,g' driver/Makefile
grep -rl '#include <linux/config.h>' . | xargs perl -pi -e's,#include <linux/config.h>,/* #include <linux/config.h> */,'
perl -pi -e's@CFLAGS = -D_GNU_SOURCE .*@CFLAGS = -D_GNU_SOURCE -D__user= %{optflags}@' utils/Makefile
perl -pi -e's,#include "videodev2.h",#include <linux/videodev2.h>,' ./utils/v4l2-dbg.cpp
grep -l '#include <linux/ivtv.h>' utils/*.c utils/*.cc |\
  xargs -r perl -pi -e's,#include <linux/ivtv.h>,#include "linux/ivtv.h",'

%build
make -C utils

%install
rm -rf %{buildroot}

mkdir -p %{buildroot}%{_bindir}
mkdir -p %{buildroot}%{_datadir}/ivtv/
make -C utils \
   DESTDIR=%{buildroot} BINDIR=%{_bindir} install
install -p utils/*.pl %{buildroot}%{_datadir}/ivtv/
ln -s ivtv-radio %{buildroot}%{_bindir}/radio-ivtv

rm -f %{buildroot}%{_includedir}/linux/ivtv.h
rm -f %{buildroot}%{_includedir}/linux/ivtvfb.h

%clean
rm -rf %{buildroot}

%files
%defattr(-,root,root,-)
%doc doc/*
#doc utils/README*
%{_bindir}/*
%{_datadir}/ivtv

%changelog
* Tue Jan 06 2009 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 1.3.0-1
- update source to 1.3.0
- apply new versioning policy
- added Requires: ivtv-firmware

* Wed May 16 2007 Daisuke SUZUKI <daisuke@linux.or.jp> 0.6_svn3288-paken060508-0vl2
- rebuild with new environment/toolchain

* Tue  May 16 2006 Takahiro Adachi <tadachi@tadachi-net.com> 0.6_svn3288-paken060508-0vl1
- change source (0.6 SVN3288)

* Fri Mar 19 2004 Daisuke SUZUKI <daisuke@linux.or.jp> 0.1.9.GPIO.k26.20040820.1-0vl1
- initial build for Vine Linux.
