File sane-frontends.spec of Package sane-frontends

#
# spec file for package sane-frontends (Version 1.0.14)
#
# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

# norootforbuild

Name:           sane-frontends
BuildRequires:  cups-libs
BuildRequires:  gimp-devel
BuildRequires:  libgphoto2-devel
BuildRequires:  libjpeg-devel
BuildRequires:  sane-backends-devel
BuildRequires:  update-desktop-files
License:        GNU General Public License (GPL)
Group:          Hardware/Scanner
Autoreqprov:    on
Summary:        SANE-frontends xscanimage, xcam, and scanadf
Version:        1.0.14
Release:        56
URL:            http://www.sane-project.org/
# URL for Source0: http://alioth.debian.org/download.php/1140/sane-frontends-1.0.14.tar.gz
Source0:        sane-frontends-%{version}.tar.bz2
# Patch0 to set the correct docdir for the frontends
# at the moment this patch is not needed because nothing is written to $(prefix)/doc/sane
# except what is installed "manually" in the install section
Patch0:         sane-frontends-docdir.dif
# Fix "... is used uninitialized ..." warnings:
Patch1:         fix-uninitialized-variables.diff
# Fix "array subscript out of range" error:
Patch2:         fix-buffer-overflow.diff
# Install into this non-root directory (required when norootforbuild is used):
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
PreReq:         /sbin/ldconfig
Requires:       sane-backends

%description
xscanimage is a graphical scanner frontend for SANE. It can be invoked
either directly from the command-line or through the GIMP image
manipulation program.

xcam is a graphical camera frontend for SANE.

scanadf is a command-line frontend for SANE to control a scanner with
an automatic document feeder (ADF).


%prep
%setup -q
# Patch0 to set the correct docdir for the frontends
%patch0 -p0
# Fix "... is used uninitialized ..." warnings:
%patch1
# Fix "array subscript out of range" error:
%patch2

%build
export CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing"
./configure --prefix=%{_prefix} \
            --exec-prefix=%{_prefix} \
            --sysconfdir=%{_sysconfdir} \
            --libdir=%{_libdir} \
            --sbindir=%{_sbindir} \
            --mandir=%{_mandir} \
            --datadir=%{_datadir}
make

%install
make install DESTDIR=$RPM_BUILD_ROOT
# Create GIMP plugin link (see "man xscanimage"):
install -d %{buildroot}%{_libdir}/gimp/2.0/plug-ins
ln -s %{_bindir}/xscanimage %{buildroot}%{_libdir}/gimp/2.0/plug-ins/xscanimage
# Install frontend specific documentation:
install -d $RPM_BUILD_ROOT/%{_defaultdocdir}/sane-frontends
# Avoid install's default permissions rwxr-xr-x by setting explicite permissions:
install -m 644 AUTHORS COPYING Changelog INSTALL NEWS PROBLEMS README $RPM_BUILD_ROOT/%{_defaultdocdir}/sane-frontends

%post
/sbin/ldconfig
exit 0

%postun
/sbin/ldconfig
exit 0

%files
%defattr(-,root,root)
%{_bindir}/xscanimage
%{_bindir}/xcam
%{_bindir}/scanadf
%dir %{_datadir}/sane
%{_datadir}/sane/sane-style.rc
%{_libdir}/gimp/2.0/plug-ins/xscanimage
%doc %{_mandir}/man1/scanadf.1.gz
%doc %{_mandir}/man1/xcam.1.gz
%doc %{_mandir}/man1/xscanimage.1.gz
%doc %{_defaultdocdir}/sane-frontends

%changelog