%define __strip %{_mingw32_strip}
%define __objdump %{_mingw32_objdump}
%define _use_internal_dependency_generator 0
%define __find_requires %{_mingw32_findrequires}
%define __find_provides %{_mingw32_findprovides}

Name:           mingw32-sane-backends
Version:        1.0.19
Release:        1%{?dist}
Summary:        Scanner access software

License:        GPLv2+ and GPLv2+ with exceptions and Public Domain
Group:          System Environment/Libraries
URL:            http://www.sane-project.org
Source0:        ftp://ftp.sane-project.org/pub/sane/sane-backends-%{version}/sane-backends-%{version}.tar.gz
Patch0:         sane-win32-backend.patch
Patch1:         sane-win32-frontend.patch
Patch2:         sane-win32-lib.patch
Patch3:         sane-win32-sanei.patch
Patch4:         sane-win32-tools.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

BuildArch:      noarch

BuildRequires:  mingw32-filesystem >= 33
BuildRequires:  mingw32-gcc
BuildRequires:  mingw32-binutils
BuildRequires:  mingw32-libusb-win32


%description
Scanner Access Now Easy (SANE) is a universal scanner interface.  The
SANE application programming interface (API) provides standardized
access to any raster image scanner hardware (flatbed scanner,
hand-held scanner, video and still cameras, frame-grabbers, etc.).


%prep
%setup -q -n sane-backends-%{version}
%patch0 -p0
%patch1 -p0
%patch2 -p0
%patch3 -p0
%patch4 -p0

chmod -x COPYING


%build
export BACKENDS=fujitsu \
%{_mingw32_configure}
make %{?_smp_mflags}
touch backend/.libs/libsane-fujitsu-1.dll
touch backend/.libs/libsane-dll-1.dll


%install
rm -rf $RPM_BUILD_ROOT
make DESTDIR=$RPM_BUILD_ROOT install

# Remove documentation which duplicates that found in the native package.
rm -r $RPM_BUILD_ROOT/%{_mingw32_prefix}/doc
rm -r $RPM_BUILD_ROOT/%{_mingw32_prefix}/share

# Delete temp files
rm -r $RPM_BUILD_ROOT/%{_mingw32_libdir}/bin
rm -r $RPM_BUILD_ROOT/%{_mingw32_libdir}/sane

%clean
rm -rf $RPM_BUILD_ROOT


%files
%defattr(-,root,root)
%doc COPYING
%{_mingw32_bindir}/libsane-1.dll
%{_mingw32_bindir}/gamma4scanimage
%{_mingw32_bindir}/sane-config
%{_mingw32_bindir}/sane-find-scanner
%{_mingw32_bindir}/scanimage
%{_mingw32_libdir}/libsane.dll.a
%{_mingw32_libdir}/libsane.la
%{_mingw32_includedir}/sane/sane.h
%{_mingw32_includedir}/sane/saneopts.h
%{_mingw32_sysconfdir}/sane.d/dll.conf
%{_mingw32_sysconfdir}/sane.d/fujitsu.conf
%{_mingw32_sysconfdir}/sane.d/saned.conf


%changelog
* Tue Mar 24 2009 Michael Cronenworth <mike@cchtml.com> - 1.0.19-1
- Initial RPM release.
