# Macro definitions
%define ver	1.10.0
%define rel	3
%define epsane_ver 1.0.6
%define epsane_maj 1

Summary:	Image Scan! for Linux is the frontend for epson scanners
Summary(ja):	Image Scan! for Linux - EPSON 製スキャナ用のフロントエンド
Name:		iscan
Version:	%{ver}	
Release:	%{rel}vl1
License:	GPL (with exception clause)/EKPL
URL:		http://www.epkowa.co.jp/
Source:		iscan-%{ver}-%{rel}.tar.gz
Group:		Applications/Multimedia
Requires:	sane >= 1.0.3
BuildRoot:	/var/tmp/%{name}-%{version}-root

Vendor: Project Vine
Distribution: Vine Linux
Packager: Daisuke SUZUKI <daisuke@linux.or.jp>

%description
Image Scan! for Linux is the frontend for epson scanners

%description -l ja
iscan (Image Scan! for Linux) は EPSON 製スキャナ用のフロントエンド
です。

%prep
%setup -q

%build
%configure
make %{?_smp_mflags}

%install
rm -rf ${RPM_BUILD_ROOT}
%makeinstall

%clean
rm -rf ${RPM_BUILD_ROOT}

%post
config=%{_sysconfdir}/sane.d/dll.conf
if test -z "$(grep epkowa $config)"; then
    echo Adding the SANE epkowa backend for EPSON scanners to $config
    echo Your old configuration is saved in $config.orig
    cp $config $config.orig
    echo epkowa >> $config
fi
if test -n "$(grep '#[[:space:]]*epkowa' $config)"; then
    echo Enabling SANE epkowa backend for EPSON scanners in $config
    echo Your old configuration is saved in $config.orig
    mv $config $config.orig
    sed 's,#[[:space:]]*\(epkowa\),\1,' $config.orig > $config
fi
if test -z "$(grep 6566/tcp %{_sysconfdir}/services)"; then
    echo Adding the sane service to %{_sysconfdir}/services
    echo The original file is saved in %{_sysconfdir}/services.orig
    cp %{_sysconfdir}/services %{_sysconfdir}/services.orig
    echo "sane 6566/tcp saned # SANE network scanner daemon" >> %{_sysconfdir}/services
fi

%preun
if [ $1 = 0 ]
then
	rm -f %{_libdir}/sane/libsane-epson.so
	rm -f %{_libdir}/sane/libsane-epson.so.%{epsane_maj}
fi

%files
%defattr(-,root,root)
%doc README README.ja
%doc COPYING COPYING.LIB COPYING.KOWA COPYING.KOWA.ja
%doc doc/xinetd.sane
%{_sysconfdir}/sane.d/epkowa.conf
%{_bindir}/iscan
%{_libdir}/libesmod.so*
%{_libdir}/libesint*.so*
%{_libdir}/sane/libsane-epkowa.so*
%{_datadir}/iscan/esf*.bin
%{_datadir}/locale/*/LC_MESSAGES/iscan.mo
%{_mandir}/man1/*


%changelog
* Fri Oct 29 2004 Daisuke SUZUKI <daisuke@linux.or.jp> 1.10.0-3vl1
- new upstream release

* Tue Dec 09 2003 Daisuke SUZUKI <daisuke@linux.or.jp> 1.5.2-0vl1
- initial build for Vine Linux based on epkowa package.
- use rpmmacros

