%define sane_ver %(/usr/bin/sane-config --version 2> /dev/null)
%define gimpdirs %(/bin/ls -d %{_libdir}/gimp/*/plug-ins 2> /dev/null)

Summary:	SANE (Scanner Access Now Easy) clients 
Summary(ja):SANE (Scanner Access Now Easy) クライアント
Group:		Applications/Multimedia
Name:		sane-clients
Version:	1.0.14
Release:	2%{?_dist_release}
URL:		http://www.mostang.com/sane/
Source:		ftp://ftp.mostang.com/pub/sane/sane-frontends-%{version}.tar.gz
Patch0:		sane-frontends-1.0.14-array-out-of-bounds.patch
Patch1:		sane-frontends-1.0.14-sane-backends-1.0.20.patch
%{?nosrc:NoSource: 0}
License:	GPL (programs), relaxed LGPL (libraries), and public domain (docs)

BuildRequires: sane-devel = %{sane_ver}
BuildRequires: gtk2-devel
BuildRequires: gimp-devel
Requires: sane = %{sane_ver}
Buildroot: %{_tmppath}/%{name}-%{version}-root

Vendor: Project Vine
Distribution: Vine Linux


%description
The clients,'xscanimage' and 'xcam', those use the SANE modules.

%description -l ja
SANE モジュールを使うGUIクライアントxscanimageとxcamを収録しています。

%prep
%setup -q -n sane-frontends-%{version}
%patch0 -p1 -b .array
%patch1 -p1 -b .sane_backends

%build
%configure --datadir=%{_datadir}/sane
make %{?_smp_mflags}

%install
rm -rf $RPM_BUILD_ROOT
%makeinstall datadir=$RPM_BUILD_ROOT%{_datadir}

if (echo "%{gimpdirs}" | grep -q plug-ins) ;then
	for D in %{gimpdirs} ; do
		mkdir -p $RPM_BUILD_ROOT${D}
		%__ln_s -f %{_bindir}/xscanimage $RPM_BUILD_ROOT${D}/xscanimage
	done
fi

%clean
rm -rf $RPM_BUILD_ROOT


%files
%defattr(-,root,root)
%{_bindir}/*
%config %{_datadir}/sane/sane-style.rc
%{_mandir}/man1/*
%doc README* AUTHORS COPYING Changelog INSTALL NEWS PROBLEMS
%{_libdir}/gimp/*/plug-ins/*


%changelog
* Sun Jul 25 2010 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.0.14-2
- rebuild with sane-1.0.21
- change BuildRequires (from gtk+ to gtk2-devel)
- change BuildRequires (from gimp to gimp-devel)
- add Patch0(sane-frontends-1.0.14-array-out-of-bounds.patch)
- add Patch1(sane-frontends-1.0.14-sane-backends-1.0.20.patch)

* Sat Oct 11 2008 Shu KONNO <owa@bg.wakwak.com> 1.0.14-1vl5
- applied new versioning policy, spec in utf-8

* Mon Dec 24 2007 Shu KONNO <owa@bg.wakwak.com> 1.0.14-0vl1
- updated sane-frontends to 1.0.14
- defined macro 'sane_ver' by sane-config
- s/Copyright/License/

* Fri Oct 25 2002 Tomoya TAKA <taka@vinelinux.org> 1.0.8-0vl1
- new upstream release

* Wed Apr 4 2002 Masaki Shinomiya <shino@pos.to>
- 1.0.7-0vl1 for Vine Linux-2.x
- 1.0.7-0.1
- symlink for gimp listed in %file section
- set %_sysconfdir to /etc for RedHat6.x/Vine2.x

* Wed Mar 6 2002 Masaki SHINOMIYA <shino@pos.to>
- 1.0.7-0

* Sun Dec 23 2001 Masaki SHINOMIYA <shino@pos.to>
- 1.0.6-0.2: %config sane-style.rc

* Fri Dec 21 2001 Masaki SHINOMIYA <shino@pos.to>
- 1.0.6-0.1
- use macros as possible
- %{_datadir}/sane/sane-style.rc

* Wed Jul 4 2001 Masaki SHINOMIYA <shino@pos.to>
- 1.0.5

* Wed May 17 2001 Masaki SHINOMIYA <shino@pos.to>
- 1.0.4
- sane-clients seperated from sane package

* Wed May 17 2001 Masaki SHINOMIYA <shino@pos.to>
- 1.0.4 + epson backend ver.20010331
- 'scanimage' is included in the binary'sane-1.0.4-1.i386.rpm'package.
- refined script for gimp plug-in setup
- html documents shall be installed in the directory '/usr/share/sane'
- automatically make device the file /dev/usb/scanner0

* Wed Nov 15 2000 MATSUBAYASHI 'Shaolin' Kohji <shaolin@rhythmaning.org>
- 1.0.3-0vl8
- included missing "sane-config" script for sane

* Tue Oct 17 2000 Jun Nishii <jun@vinelinux.org>
- 1.0.3-0vl7
- merge xscanimage patch

* Mon Oct 16 2000 Jun Nishii <jun@vinelinux.org>
- 1.0.3-0vl6
- build with gimp-1.1.27

* Sun Oct  1 2000 Jun Nishii <jun@vinelinux.org>
- 1.0.3-0vl5
- fixed group

* Sat Sep 30 2000 Jun Nishii <jun@vinelinux.org>
- 1.0.3-0vl4
- added %defattr in clients

* Tue Sep 26 2000 Jun Nishii <jun@vinelinux.org>
- 1.0.3-0vl3
- build with gimp-1.1.26

* Mon Sep 25 2000 Jun Nishii <jun@vinelinux.org>
- 1.0.3-0vl2
- build with gimp-1.1.25

* Thu Sep 21 2000 Jun Nishii <jun@vinelinux.org>
- 1.0.3-0vl1

* Thu Jun  8 2000 Jun Nishii <jun@vinelinux.org>
- 1.0.2-0vl1

* Mon Jan 17 2000 Jun Nishii <jun@vinelinux.org>
- build for Vine Linux 2.0
- added find-scanner, xerox

* Fri Apr 23 1999 Hugo van der Kooij <hvdkooij@caiw.nl>
- Fixed packaging a bit.

* Wed Apr 21 1999 Hugo van der Kooij <hvdkooij@caiw.nl>
- Updated package to 1.01

* Fri Apr 09 1999 Hugo van der Kooij <hvdkooij@caiw.nl>
- Split off the clients
- Fixed a Alpha system anomaly by removing the specific backend.

* Mon Nov 23 1998 Jonathan Miller <jlm@mvhi.com>
 [1.00-1]
- upgraded to 1.00 (and made description less space-consuming)
- included the post 1.00 fixed "configure" script available 22 Nov 1998.

* Sat Aug 08 1998 Arne Coucheron <arneco@online.no>
  [0.74-3]
- added /etc/sane.d to %dir in file list

* Sat Aug 01 1998 Arne Coucheron <arneco@online.no>
  [0.74-2]
- devel Group: reverted back to Development/Libraries
- some changes to the %defattr and %attr usage in file list

* Tue Jul 28 1998 Binaire <binaire@binaire.ml.org>
  [0.74-1]

* Fri May 22 1998 Arne Coucheron <arneco@online.no>
  [0.73-3]
- added use of %%{name} and %%{version} macros
- added a %postun for running ldconfig after uninstall
- using BuildRoot properly now
- using %defattr and %attr macros in filelist, allows non-root build 
  this means that RPM 2.5 is required to build this spec file now!
- devel Group: changed to X11/Libraries
- added using RPM_OPT_FLAGS during make 
- added striping of programs and libraries
- added Requires: gtk+ >= 0.99.13 to main package
- added Requires: %%{name} = %%{version} to devel package
- added a %clean section for removing the buildroot dir
- simplified the filelist and added %config for sane-style.rc
- moved lib*.so to %files devel and dropped the *.la files
- added -q parameter to %setup
- removed some older changelog entries
- removed the "fix ldconfig brokenness..." stuff
- removed the Packager: line; use /etc/rpmrc if you want your name in
- if GIMP is installed, make symlink from xscanimage to plug-ins dir
- install the find-scanner program from the tools dir

* Mon May 18 1998 Hugo van der Kooij <hvdkooij@caiw.nl>
- Version 0.73 was created: May 13 1998
- gimp (original was build against 0.99.29)
- gtk+ (original was build against 1.0.1)
- dlh (original was build against 0.7d)
- X11 development tree including xpm libraries.

* Wed Apr 22 1998 Hugo van der Kooij <hvdkooij@caiw.nl>
- Binaries are now BuildRoot proof.

* Wed Apr 22 1998 Hugo van der Kooij <hvdkooij@caiw.nl>
- Binaries are not BuildRoot proof. release 3 is done without BuildRoot!

* Tue Apr 21 1998 Hugo van der Kooij <hvdkooij@caiw.nl>
- Temp. fix for some documentations problems with BuildRoot.

* Sat Apr 11 1998 Hugo van der Kooij <hvdkooij@caiw.nl>
- Formal 0.72 now made as RPM! (Build against GTK+ 0.99.10 and GIMP 0.99.24)
- Original package was released: Tue Apr 7 1998
