# How to build xawtv-fonts
# rpm -bb --target noarch  xawtv.spec
#
Name: xawtv
Summary: A TV application for video4linux compliant devices.
Summary(ja): video4linux 互換デバイス用の TV アプリケーション
Version: 3.95
Release: 0vl1
%define fontsver 1.1
%define fontsrel 0vl1
%define withalsa $([ -f /usr/include/linux/asound.h ] && echo enable || echo disable)
%define alsa %([ "%{withalsa}" = "enable" ] && echo 1 || echo 0)
%define applnkdir %([ -d %{_datadir}/applications ] && echo %{_datadir}/applications || echo /etc/X11/applnk/Multimedia )
# for RedHat-6.x/Vine-2.x
%define _sysconfdir /etc
%define fontsdir /usr/X11R6/lib/X11/fonts/misc
%define pixmapsdir %{_datadir}/pixmaps

Source:	http://bytesex.org/xawtv/%{name}-%{version}.tar.gz
Source1: http://bytesex.org/xawtv/tv-fonts-%{fontsver}.tar.bz2
Source2: v4l-conf.pam
Source10: xawtvrc.JP
Source11: bttv-tuneUp.sh
#Patch: http://telia.dl.sourceforge.net/sourceforge/xaw-deinterlace/xaw-deinterlace-%{subver}.diff.bz2
Group: Applications/Multimedia
License: GPL
URL: http://bytesex.org/xawtv/
BuildPrereq: XFree86-devel, ncurses-devel libjpeg-devel
BuildPrereq: make >= 3.80
BuildPrereq: openMotif-devel >= 2.2.2
PreReq: XFree86 , XFree86-xfs
Requires: usermode
Requires: %{name}-fonts

%if %alsa
Requires: alsa-driver
%endif
BuildRoot: %{_tmppath}/%{name}-root
Excludearch: sparc s390 s390x
%{?nosrc:NoSource:     0}
%{?nosrc:NoSource:     1}

Vendor: Project Vine
Distribution: Vine Linux

%description
Xawtv is a simple xaw-based TV program which uses the bttv driver or
video4linux. Xawtv contains various command-line utilities for
grabbing images and .avi movies, for tuning in to TV stations, etc.
Xawtv also includes a grabber driver for vic.

%package motv
Summary: Motif TV application
Summary(ja): MOTIF 版の TV アプリケーション
Requires: openMotif >= 2.2.2
Requires: xawtv = %{version}-%{release}
Group: Applications/Multimedia

%description motv
motv is a TV application which is build on Motif library.

%package fonts
Summary: Fonts for Xawtv
Summary(ja): Xawtv 用フォント
Group: Applications/Multimedia
Version: %{fontsver}
Release: %{fontsrel}
PreReq: /usr/X11R6/bin/xset

%description fonts
Fonts collection for Xawtv


%prep
%setup -q -a 1 
#patch -p1
%__cp %{SOURCE10} ./
%__cp %{SOURCE11} ./tuneUp.sh

%build

%ifarch noarch

# make fonts
cd tv-fonts-%{fontsver}
PATH=$PATH:/usr/X11R6/bin ; export PATH
DISPLAY=   make

%else

PATH=$PATH:/usr/X11R6/bin ; export PATH
#configure --%{withalsa}-alsa --enable-motif --enable-xfree-ext --enable-xvideo --enable-xft
%configure --enable-motif --enable-xfree-ext --enable-xvideo --enable-xft
%__make

%endif

%install

%ifarch noarch

# install fonts
%__mkdir -p %{buildroot}%{fontsdir}
%__install tv-fonts-%{fontsver}/*.gz  %{buildroot}%{fontsdir}

%else

%__rm -rf %{buildroot}
#PATH=$PATH:/usr/X11R6/bin ; export PATH
#makeinstall DESTDIR="%{buildroot}" SUID_ROOT="" install
make DESTDIR="%{buildroot}" SUID_ROOT="" install

%__install -d %{buildroot}%{_sbindir} \
         %{buildroot}%{_libdir}/%{name} \
         %{buildroot}%{_sysconfdir}/pam.d \
         %{buildroot}%{_sysconfdir}/security/console.apps \
	 %{buildroot}%{pixmapsdir}
 
%__install -m 0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/pam.d/v4l-conf
echo "SESSION=true" > %{buildroot}%{_sysconfdir}/security/console.apps/v4l-conf
echo "USER=root"   >> %{buildroot}%{_sysconfdir}/security/console.apps/v4l-conf
echo "PROGRAM=%{_sbindir}/v4l-conf" >> %{buildroot}%{_sysconfdir}/security/console.apps/v4l-conf
%__mv %{buildroot}%{_bindir}/v4l-conf %{buildroot}%{_sbindir}/
ln -s consolehelper %{buildroot}%{_bindir}/v4l-conf
%__install -d %{buildroot}%{_bindir}/X11
ln -s %{_bindir}/xawtv %{buildroot}%{_bindir}/X11/xawtv
%__install contrib/xawtv32x32.xpm %{buildroot}%{pixmapsdir}/%{name}.xpm
#__mv %{buildroot}%{_libdir}/*.so %{buildroot}%{_libdir}/%{name}
%__install -d %{buildroot}/etc/X11
%__install xawtvrc.JP %{buildroot}/etc/X11/xawtvrc

# prepare applnk
%__install -d %{buildroot}%{applnkdir}
cat > $RPM_BUILD_ROOT%{applnkdir}/%{name}.desktop <<EOF
[Desktop Entry]
Name=TV
Comment=television
Exec=xawtv 
Icon=%{pixmapsdir}/%{name}.xpm
Terminal=false
MultipleArgs=false
Type=Application
Categories=GNOME;Application;AudioVideo;Video
EOF

%endif

%post
%{_sbindir}/v4l-conf -q || :

%post fonts
{
  cd %{fontsdir}
  mkfontdir > /dev/null 2>&1
  cd -
}
if [ ".$DISPLAY" != "." ]; then
  xset fp rehash > /dev/null 2>&1
  true
fi

%postun fonts
if [ $1 = 0 ]; then
  {
    cd  %{fontsdir}
    /usr/X11R6/bin/mkfontdir > /dev/null 2>&1
    cd -
  }
  if [ ".$DISPLAY" != "." ]; then
    /usr/X11R6/bin/xset fp rehash > /dev/null 2>&1
    true
  fi
fi

%clean
rm -fr $RPM_BUILD_ROOT


%ifarch noarch

%files fonts
%defattr(-,root,root)
%{fontsdir}

%else

%files
%defattr(-,root,root)
%config /usr/X11R6/lib/X11/app-defaults/Xawtv
%config(noreplace) %{_sysconfdir}/pam.d/v4l-conf
%config(noreplace) %{_sysconfdir}/security/console.apps/v4l-conf
%{_bindir}/[^Xm]*
%attr(0711,root,root) %{_sbindir}/v4l-conf
%{_bindir}/X11/xawtv
/usr/X11R6/lib/X11/app-defaults/mtt
%{_libdir}/%{name}
%{_datadir}/%{name}
%{_mandir}/man?/[^m]*
%{_mandir}/*/man?/[^m]*
%{_mandir}/man1/mtt.1*
%config(missingok) %{applnkdir}/*
%config(noreplace) /etc/X11/xawtvrc
%doc COPYING README* TODO Changes MAKEDEV.v4l
%doc contrib
%doc xawtvrc* tuneUp.sh
%{pixmapsdir}/*

%files motv
%defattr(-,root,root)
%{_bindir}/motv
/usr/X11R6/lib/X11/app-defaults/MoTV
/usr/X11R6/lib/X11/*/app-defaults/MoTV

%{_mandir}/man1/motv.1*

%endif


%changelog
* Wed Nov 22 2006 Masaki Shinomiya <shino@pos.to> 3.95-0vl1
- new upstream release, desktop launcher, buildprereq libjpeg-devel
- files (motv was both in xawtv and in xawtv-motv package before) 

* Wed Aug 11 2004 Daisuke SUZUKI <daisuke@linux.or.jp> 3.93-0vl1
- new upstream release

* Thu Apr 15 2004 Daisuke SUZUKI <daisuke@linux.or.jp> 3.91-0vl2
- rebuild with libdv-0.102

* Sun Feb 15 2004 Daisuke SUZUKI <daisuke@linux.or.jp> 3.91-0vl1
- new upstream release
- add motv subpackage, requires openMotif
- build with openMotif for motv

* Thu Dec 18 2003 Masaki Shinomiya <shino@pos.to> -3.90-0vl1
- source update, xawtv-fonts, remove deinterlace.patch
- 'rpm -bb --target noarch xawtv.spec'
- will make xawtv-fonts package.
- buildrequire make version 3.80 or later
- use %%{buildroot} and some rewrite

* Fri Dec 12 2003 Masaki Shinomiya <shino@pos.to> -3.74-0vl3
- some mannual pages missing even in 0vl2, alsa detecting

* Wed Dec 10 2003 Masaki Shinomiya <shino@pos.to> -3.74-0vl2
- xawtvrc, tuneUp.sh,  MAKEDEV.v4l in doc
- some mannual pages used to be missing
- v4l-conf in post install script
- bugfix in rebuild with alsa

* Sun Jan 19 2003 Masaki Shinomiya <shino@pos.to>
-3.74-0vl1: update source, doc, deinterlace patch, Japan.xawtv, URL
- auto detect alsa 0.5x/0.9x, prereq

* Fri Apr 5 2002 Masaki Shinomiya <shino@pos.to>
- 3.73-0vl1: for Vine Linux-2.5
* Sun Mar 31 2002 <shino@pos.to>
- 3.73-0: install libraries in %{_libdir}/xawtv

* Sat Mar 23 2002 <shino@pos.to>
- 3.60-0.1: make symlink, .destop, correct file list

* Fri Aug 17 2001 <sagami@vinelinux.org>
- 3.60-0vl1: initial release for VineSeedPlus

* Sun Aug  5 2001 Nalin Dahyabhai <nalin@redhat.com> 3.54-3
- tweak PAM setup so that v4l-conf can access the display properly

* Tue Jul 10 2001 Elliot Lee <sopwith@redhat.com> 3.54-2
- Rebuild to remove libXv/libXxf86dga deps

* Mon Jul 02 2001 Than Ngo <than@redhat.com>
- update to 3.54

* Fri Jun 22 2001 Than Ngo <than@redhat.com>
- update to 3.53
- add buildprereq
- remove some uneeeded patches

* Tue Jun 19 2001 Karsten Hopp <karsten@redhat.de>
- excludearch s390 s390x

* Wed Jun 13 2001 Than Ngo <than@redhat.com>
- update to 3.51

* Thu Jun 07 2001 Than Ngo <than@redhat.com>
- update to 3.50

* Thu May 31 2001 Than Ngo <than@redhat.com>
- udate to 3.49

* Tue May 22 2001 Than Ngo <than@redhat.com>
- update to 3.48

* Mon May 21 2001 Tim Powers <timp@redhat.com>
- built for the distro

* Wed May 18 2001 Karsten Hopp <karsten@redhat.de>
- make xawtv work with kernel-2.4

* Wed May 16 2001 Than Ngo <than@redhat.com>
- update to 3.47

* Mon May 07 2001 Than Ngo <than@redhat.com>
- update to 3.45
- add missing fonts

* Tue Feb 13 2001 Than Ngo <than@redhat.com>
- update to 3.34
- use consolehelper for v4l-conf
- add excludearch sparc, bdftopcf is broken on sparc

* Wed Jan 24 2001 Than Ngo <than@redhat.com>
- updated to 3.30
- use /dev/video0 instead /dev/video (bug #24871)
- fixed dependencies (Bug #24881)
 
* Sun Nov 19 2000 Than Ngo <than@redhat.com>
- update to 3.24
- add missing tools (rootv,scantv)
- add missing prereq on xset and mkfontdir

* Fri Nov 3 2000 Than Ngo <than@redhat.com>
- update to 3.23

* Wed Aug 23 2000 Tim Powers <timp@redhat.com>
- rebuilt against new XFree86 to fix DGA problems

* Mon Aug 21 2000 Than Ngo <than@redhat.com>
- update to 3.18 (Bugfix release)
- option -nodga to disable DGA (Bug #16577, #15702)
- compress fonts with gzip

* Mon Aug 07 2000 Tim Powers <timp@redhat.com>
- fixed bug #15435

* Mon Aug 07 2000 Than Ngo <than@redhat.de>
- rebuilt against the new DGA
- fixed in post and postun, so that it does not
  emits to console (Bug #15436)


* Sat Jul 29 2000 Than Ngo <than@redhat.de>
- update to 3.17

* Mon Jul 24 2000 Prospector <prospector@redhat.com>
- rebuilt

* Wed Jul 12 2000 Than Ngo <than@redhat.de>
- FHS fixes

* Mon Jul 03 2000 Prospector <bugzilla@redhat.com>
- automatic rebuild

* Sun May 28 2000 Ngo Than <than@redhat.de>
- update to 3.14 for 7.0
- put man page in correct place
- add webcam
- bzip2 source
- cleanup specfile

* Wed Jan 19 2000 Preston Brown <pbrown@redhat.com>
- font fix (#8610) in post and postun
- add missing files in bin

* Sun Jan 16 2000 Preston Brown <pbrown@redhat.com>
- whoops! 3.07 already bugfix release

* Fri Jan 14 2000 Ngo Than <than@redhat.de>
- updated to 3.06

* Mon Jul 26 1999 Tim Powers <timp@redhat.com>
- updated to 2.46
- built for 6.1

* Wed Apr 28 1999 Preston Brown <pbrown@redhat.com>
- initial build for Powertools 6.0
