%define perlversion %(rpm -q perl --qf "%%{epoch}:%%{version}")
%define pkgname Video-ivtv
%define installdirs site

Summary:        A perl module for ivtv support.
Name:           perl-%{pkgname}
Version:        0.13
Release:        1%{?_dist_release}
Group:          Development/Libraries
License:        distributable
URL:            http://ivtv.sf.net/
Source0:        %{pkgname}-%{version}.tar.gz
BuildRoot:      %{_tmppath}/%{name}-%{version}-root
BuildArch:      noarch
Requires:	perl = %{perlversion}

%description
Video::ivtv is designed to be a quick hack at making the record_ivtv.pl
script not have to depend on the test_ioctl program included with the ivtv
utils.  By moving to have the things that have proven difficult to do purely
in perl to C where they currently are being done, I can concentrate on
improving the code rather than hitting my head against the wall trying to
do code cleanups.  ;)

%prep
%setup -q -n %{pkgname}-%{version}

%build
CFLAGS="$RPM_OPT_FLAGS" perl Makefile.PL PREFIX=$RPM_BUILD_ROOT%{_prefix} INSTALLDIRS=vendor
make

%install
rm -rf $RPM_BUILD_ROOT
make install

[ -x /usr/lib/rpm/brp-compress ] && /usr/lib/rpm/brp-compress

find $RPM_BUILD_ROOT%{_prefix} -type f -print | \
        sed "s@^$RPM_BUILD_ROOT@@g" | \
        grep -v perllocal.pod | \
        grep -v "\.packlist" > %{pkgname}-%{version}-filelist
if [ "$(cat %{pkgname}-%{version}-filelist)X" = "X" ] ; then
    echo "ERROR: EMPTY FILE LIST"
    exit -1
fi

%clean
rm -rf $RPM_BUILD_ROOT

%files -f %{pkgname}-%{version}-filelist
%defattr(-,root,root)
%doc README MANIFEST

%changelog
* Tue Jan 06 2009 Munehiro Yamamoto <munepi@cg8.so-net.ne.jp> 0.13-1
- apply new versioning policy 
- rebuild with perl v5.10.0

* Thu Nov 29 2007 Daisuke SUZUKI <daisuke@linux.or.jp> 0.13-0vl2
- add Requires: perl = %%{perlversion}

* Tue  May 16 2006 Takahiro Adachi <tadachi@tadachi-net.com> 0.13-0vl1
- change source (0.13) for ivtv-0.2 or later version

* Sun Oct 03 2004 Daisuke SUZUKI <daisuke@linux.or.jp> 0.12-0vl1
- initial build for Vine Linux
