#
# spec file for package scanbuttond
#
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#

# norootforbuild

Name:           scanbuttond
Version:        0.2.3
Release:        18.2.33
Summary:        Configure your scanner buttons
License:        GPL
Group:          Hardware/Scanner
Source:         %{name}-%{version}.tar.bz2
Source1:        scanbuttond.init
Source2:        %{name}-%{version}-rpmlintrc
Source3:        scanbuttond-README.SUSE
Source11:       scanbuttond-sbd-gimp.sh
Source12:       scanbuttond-sbd-mail.sh
Source13:       scanbuttond-sbd-print.sh
Source14:       scanbuttond-sbd-scan.sh
Patch0:         scanbuttond-buttonpressed.patch

# patches from debian
Patch10:        scanbuttond-perfection1250.patch
Patch11:        scanbuttond-quiet.patch
Patch12:        scanbuttond-path-segfault.patch
Patch13:        scanbuttond-hp4500+5550c.patch
Patch14:        scanbuttond-fujitsu.patch
Patch15:        scanbuttond-xerox-travelscanner100.patch
Patch16:        scanbuttond-snapscan-s1500.patch
Patch17:        scanbuttond-epson-max.patch
Patch18:        scanbuttond_gt68xxPlustekBackend.patch
Patch19:        scanbuttond_patch_bearpaw-cs.patch


Url:            http://scanbuttond.sourceforge.net/
# Requirements for the scripts in /etc/scanbuttond/*
Requires:       sane-backends netpbm tiff
Recommends:     gimp
BuildRequires:  libusb-compat-devel
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
Modern scanners usually have several front panel buttons which are intended to
trigger certain actions like copying, faxing or mailing the scanned document.

This daemon queries the scanner button status several times per second. If it
detects that a button is pressed, it runs a shell script which the button
number is passed to as a command line argument. Because scanbuttond is
accessing the scanner directly via libusb, there should be no conflicts with
SANE or other scanner drivers: scanbuttond simply won't touch the scanner
hardware while you are using SANE. This means that you can still scan even when
running scanbuttond.

Authors:
========
  Bernhard Stiftner
  Dirk Wriedt
  J. Javier Maestro
  Hans Verkuil
  James Gilliland
  Oliver Edelmann
  Christian Bucher
  David Froehlich
  Milan Zamazal


%package devel
Summary:        Files for developing applications with scanbuttond
License:        GPL
Group:          Development/Libraries/C and C++ 
Requires:       %name = %version
Requires:       libusb-compat-devel
Requires:       glibc-devel

%description devel
This package contains files for developing applications using scanbuttond.

Authors:
========
  Bernhard Stiftner
  Dirk Wriedt
  J. Javier Maestro
  Hans Verkuil
  James Gilliland
  Oliver Edelmann
  Christian Bucher
  David Froehlich
  Milan Zamazal



%prep
%setup -q
%{__cp} scripts/buttonpressed.sh scripts/buttonpressed.sh.org
%patch0 
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1
%patch16 -p1
%patch17 -p1
%patch18 -p1
%patch19 -p1

%build

autoreconf -fi

%configure --disable-static
%{__make} %{?jobs:-j%jobs}

%install
%makeinstall
# install init script
%{__install} -d -m755 %{buildroot}%{_sysconfdir}/init.d
%{__install} -d -m755 %{buildroot}%{_sbindir}
%{__install} -m755 %{SOURCE1} %{buildroot}%{_sysconfdir}/init.d/scanbuttond
%{__ln_s} %{_sysconfdir}/init.d/scanbuttond %{buildroot}%{_sbindir}/rcscanbuttond
# install sample scripts
%{__install} -m755 %{SOURCE11} %{buildroot}%{_sysconfdir}/scanbuttond/sbd-gimp.sh
%{__install} -m755 %{SOURCE12} %{buildroot}%{_sysconfdir}/scanbuttond/sbd-mail.sh
%{__install} -m755 %{SOURCE13} %{buildroot}%{_sysconfdir}/scanbuttond/sbd-print.sh
%{__install} -m755 %{SOURCE14} %{buildroot}%{_sysconfdir}/scanbuttond/sbd-scan.sh
%{__cp} %{_builddir}/%name-%version/scripts/buttonpressed.sh.org %{buildroot}%{_sysconfdir}/scanbuttond/
# devel-files
%{__install} -d -m755 %{buildroot}%{_includedir}
%{__cp} -a %{_builddir}/%name-%version/include/* %{buildroot}%{_includedir}/

%{__rm} -f %{buildroot}%{_libdir}/*.la

%clean
rm -rf %{buildroot}

%post -p /sbin/ldconfig

%preun
%stop_on_removal scanbuttond

%postun 
/sbin/ldconfig
%insserv_cleanup scanbuttond

%files 
%defattr(-,root,root)
%doc AUTHORS COPYING ChangeLog README
%dir %{_sysconfdir}/scanbuttond
%config(noreplace) %{_sysconfdir}/scanbuttond/buttonpressed.sh.org
%config(noreplace) %{_sysconfdir}/scanbuttond/initscanner.sh.example
%config(noreplace) %{_sysconfdir}/scanbuttond/meta.conf
%{_sysconfdir}/scanbuttond/buttonpressed.sh.example
%{_sysconfdir}/scanbuttond/buttonpressed.sh.org
%{_sysconfdir}/scanbuttond/sbd-gimp.sh
%{_sysconfdir}/scanbuttond/sbd-mail.sh
%{_sysconfdir}/scanbuttond/sbd-print.sh
%{_sysconfdir}/scanbuttond/sbd-scan.sh
%{_bindir}/scanbuttond
%{_sbindir}/rcscanbuttond
%{_sysconfdir}/init.d/scanbuttond
%{_libdir}/libscanbtnd-interface_usb.so.*
%{_libdir}/libscanbtnd-backend_*.so.*

%files devel
%defattr(-,root,root)
%{_includedir}/scanbuttond/
%{_libdir}/libscanbtnd-interface_usb.so
%{_libdir}/libscanbtnd-backend_*.so
#%{_libdir}/libscanbtnd-backend_epson.la
#%{_libdir}/libscanbtnd-backend_meta.la
#%{_libdir}/libscanbtnd-backend_mustek.la
#%{_libdir}/libscanbtnd-backend_niash.la
#%{_libdir}/libscanbtnd-backend_plustek.la
#%{_libdir}/libscanbtnd-backend_plustek_umax.la
#%{_libdir}/libscanbtnd-backend_snapscan.la
#%{_libdir}/libscanbtnd-interface_usb.la

%changelog
* Thu May  6 2010 lars@linux-schulserver.de
- disable flags for outdated distributions
- devel package requires libusb-compat-devel and glibc-devel now
* Mon Jun 11 2007 lars@suse.de
- initial version 0.2.3