File iscan-free.spec of Package iscan-free

#
# spec file for package iscan-free
#
# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

# norootforbuild


Name:           iscan-free
BuildRequires:  e2fsprogs-devel esound-devel gcc-c++ gimp-devel gnome-common libgphoto2-devel libjpeg-devel openssl-devel popt-devel sane-backends-devel update-desktop-files
Url:            http://www.avasys.jp/english/linux_e/index.html
License:        GPLv2+ ; LGPLv2.1+
Group:          Hardware/Scanner
AutoReqProv:    on
Summary:        Free Image Scan Version with epkowa Driver for Epson Scanners
# How to make Source0:
# Get the matching source from the iscan package (iscan_2.10.0-1.tar.bz2) 
# Unpack it:
# tar -xjvf iscan_2.10.0-1.tar.bz2
# Remove only the really non-free files:
# rm iscan-2.10.0/non-free/libesmod-i386*.so iscan-2.10.0/non-free/EAPL.*.txt
# The remaining file filter.hh and the Makefiles are free software. 
# The proprietary binary-only i386-only libesmod library is needed only
# to make the /usr/bin/iscan frontend and the EAPL.*.txt license files
# apply only to this libesmod library.
# By using "configure --disable-frontend" it builds without the frontend
# (i.e. without the non-free libesmod library).
# Pack the remaining free sources:
# tar -cjvf iscan-free_2.10.0-1.tar.bz2 iscan-2.10.0/*
Source0:        iscan-free_2.10.0-1.tar.bz2
# A README regarding the changes of the free version:
Source1:        README
Patch1:         libltdl.patch
# Patch3 replaces fixed HZ compile-time value by sysconf(_SC_CLK_TCK) runtime value:
Patch3:         replace-HZ-by-sysconf_SC_CLK_TCK.patch
# Patch4 applies fixes for GCC 4.3 (see http://en.opensuse.org/GCC_4.3_Transition):
Patch4:         fixes-for-GCC43.patch
# Patch5 fixes GCC 4.4 and glibc 2.10 issues,
# see http://udrepper.livejournal.com/20948.html
Patch5:         fixes-for-GCC44-glibc_2.10.patch
# Patch10 changes the "sane-epkowa" man page so that those models are removed
# which require a non-free binary-only i386-only plugin. To determine those models use
# egrep '^:model|^:comment' doc/epkowa.desc | grep -B1 'non-free' | grep '^:model'
Patch10:        adapt-man-for-free.patch
Patch11:        fix-link.patch
# Have Epson Avasys' release number at the end of the SUSE package Version:
Version:        2.10.0.1
Release:        102
# See the post and triggerin sections what is pre-required:
PreReq:         coreutils, /bin/grep, /bin/sed
Requires:       sane-backends
# Either iscan-free or iscan can be installed.
# If iscan replaces iscan-free, proprietary software becomes installed.
# If iscan-free replaces iscan, some scanner models do no longer work (see README).
# Therefore real "Conflicts" (and not "Obsoletes" which does a silent replacement):
Conflicts:      iscan
# Used to exclude libsane from the provide-list which is made by Autoreqprov:
%define my_provides /tmp/my-provides
# Install into this non-root directory (required when norootforbuild is used):
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
# Skip testing devel dependencies required by libtool .la files by the following comment:
# skip-check-libtool-deps

%prep
# Be quiet when unpacking.
# The directory in the Source0 archive is different because
# the package name is different and Version has the Epson Avasys' release number at the end:
%setup -q -n iscan-2.10.0
# Get the README regarding the changes of the free version:
cp %{SOURCE1} .
%patch1
# Patch3 replaces fixed HZ compile-time value by sysconf(_SC_CLK_TCK) runtime value:
%patch3
# Patch4 applies fixes for GCC 4.3:
%patch4
# Patch5 fixes GCC 4.4 and glibc 2.10 issues:
%patch5
# Remove those models from the man page which require a non-free plugin:
%patch10
%patch11 -p1
# Distinguish the no longer supported models in the description file
# but do not remove them because otherwise they would be no longer shown in YaST
# when the package iscan-free is installed because the 'triggerin' section
# replaces the description file and from this file YaST will re-build its database
# using /usr/lib/YaST2/bin/create_scanner_database which tests if a comment
# contains 'requires DFSG non-free' and if yes it sets the package name
# in the YaST database to iscan (otherwise to iscan-free) so that YaST can
# test and install the right package even for the no longer supported models:
grep -q 'requires DFSG non-free' doc/epkowa.desc || exit 1
sed -i -e '/requires DFSG non-free/s/^:comment[[:space:]][[:space:]]*"/:comment "unsupported by the iscan-free package<br>/' doc/epkowa.desc
sed -i -e 's/requires DFSG non-free/requires DFSG non-free plugin in the iscan-proprietary-drivers package:/' doc/epkowa.desc

%build
rm -f m4/libtool.m4
autoreconf -fi
# Set our preferred architecture-specific flags for the compiler and linker:
# If -D_GNU_SOURCE is not set, the prototype for strndup in /usr/include/string.h is skipped.
export CFLAGS="$RPM_OPT_FLAGS -D_GNU_SOURCE -fPIC"
export CXXFLAGS="$RPM_OPT_FLAGS -D_GNU_SOURCE -fno-strict-aliasing"
# See /usr/lib/rpm/suse_macros regarding our RPM macros (e.g. sysconfdir is /etc).
# enable-jpeg and enable-png is used in Epson Avasys' iscan.spec file.
# By using disable-frontend it builds without the frontend (i.e. without the non-free stuff):
%configure --disable-static \
           --with-pic \
           --enable-jpeg \
           --enable-png \
           --disable-frontend
%{__make} %{?jobs:-j%jobs}

%install
make install DESTDIR=${RPM_BUILD_ROOT}
# Install the backend's config file:
install -d %{buildroot}%{_sysconfdir}/sane.d/
install -m 644 backend/epkowa.conf %{buildroot}%{_sysconfdir}/sane.d/
# Install the backend's description file:
install -d %{buildroot}%{_datadir}/iscan/
# Change the manufacturer name to the same as in SANE's epson.desc file.
grep -q '^:mfg[[:space:]][[:space:]]*"EPSON"' doc/epkowa.desc || exit 1
sed -e 's|^:mfg[[:space:]][[:space:]]*"EPSON".*|:mfg "Epson"|' doc/epkowa.desc >%{buildroot}%{_datadir}/iscan/epkowa.desc
# Install the USB usermap file (list of USB manufacturer and model IDs)
# and the matching hotplug script under /usr/share/iscan
# and move the installed /usr/lib/iscan/make-udev-rules away
# because we do not use any of them because our udev uses our resmgr to grant USB access
# and resmgr does it without hotplug or usermap stuff.
install -m 644 utils/hotplug/iscan.usermap %{buildroot}%{_datadir}/iscan/
install -m 755 utils/hotplug/iscan-device %{buildroot}%{_datadir}/iscan/
mv %{buildroot}%{_libdir}/iscan/make-udev-rules %{buildroot}%{_datadir}/iscan/
# Remove the installed man page for the "iscan" frontend because it is not included in this package:
rm %{buildroot}%{_mandir}/man1/iscan.1
# Exclude libsane from the provide-list which is made by Autoreqprov:
cat << EOF > %{my_provides}
grep -v %{_libdir}/sane | %{__find_provides}
EOF
chmod 755 %{my_provides}
%define __find_provides %{my_provides}
%find_lang iscan
find %{buildroot} -type f -name "*.la" -exec %{__rm} -fv {} +

%post
/sbin/ldconfig

%triggerin -- sane-backends
# The package sane-backends can be updated or installed after iscan-free.
# In this case trigger to add the backend "epkowa" to /etc/sane.d/dll.conf if it is not there.
# Note that this is also run when only iscan-free is installed or updated
# and therefore the test that /etc/sane.d/dll.conf exists and is writable.
if test -w /etc/sane.d/dll.conf
then grep -q 'epkowa' /etc/sane.d/dll.conf || echo -e '# The epkowa backend is provided by the iscan-free package:\n#epkowa' >>/etc/sane.d/dll.conf
fi
# Save the sane-backends package backend description file and
# copy the iscan-free package description file to the sane-backends package location
# but don't overwrite epkowa.desc.sane when it already exists:
if test -f /usr/share/sane/descriptions-external/epkowa.desc -a ! -f /usr/share/sane/descriptions-external/epkowa.desc.sane
then mv /usr/share/sane/descriptions-external/epkowa.desc /usr/share/sane/descriptions-external/epkowa.desc.sane
fi
if test -d /usr/share/sane/descriptions-external/
then cp -p /usr/share/iscan/epkowa.desc /usr/share/sane/descriptions-external/
fi
exit 0

%postun
/sbin/ldconfig
# If the package was removed (but not if it was updated)
# then remove the epkowa lines in /etc/sane.d/dll.conf
# Note that sane-backends may not be installed (see triggerin)
# and therefore the test that /etc/sane.d/dll.conf exists and is writable.
[ "$1" = "0" -a -w /etc/sane.d/dll.conf ] && sed -i -e '/epkowa/d' /etc/sane.d/dll.conf
# Restore the sane-backends package backend description file:
if test -f /usr/share/sane/descriptions-external/epkowa.desc.sane
then mv -f /usr/share/sane/descriptions-external/epkowa.desc.sane /usr/share/sane/descriptions-external/epkowa.desc
fi
exit 0

%files -f iscan.lang
%defattr(-,root,root)
%doc COPYING COPYING.LIB AUTHORS NEWS
%doc README
%dir %{_sysconfdir}/sane.d
%config %{_sysconfdir}/sane.d/epkowa.conf
%dir %{_libdir}/sane
%{_libdir}/sane/libsane-epkowa.so*
%{_datadir}/iscan/
%{_mandir}/man5/sane-epkowa.5.gz

# To produce the list of scanners which require a proprietary driver library,
# get the latest SANE source file doc/descriptions-external/epkowa.desc
# and run the following command:
#   egrep '^:model|^:comment' doc/descriptions-external/epkowa.desc \
#   | grep -B1 'requires DFSG non-free' \
#   | grep '^:model' | cut -s -d '"' -f2 \
#   | tr ' \n' '_,' | sed -e 's/,/, /g' | fold -s -w 70 | tr '_' ' '
# To produce the list of scanners which require proprietary software
# to support scanner network interfaces, run the following command:
#   egrep '^:model|^:comment' doc/descriptions-external/epkowa.desc \
#   | grep -B1 'network interface supported via DFSG non-free' \
#   | grep '^:model' | cut -s -d '"' -f2 \
#   | tr ' \n' '_,' | sed -e 's/,/, /g' | fold -s -w 70 | tr '_' ' '
# To produce the list of scanners where the network interface
# is not supported, run the following command:
#   egrep '^:model|^:comment' doc/descriptions-external/epkowa.desc \
#   | grep -B1 'network interface not supported' \
#   | grep '^:model' | cut -s -d '"' -f2 \
#   | tr ' \n' '_,' | sed -e 's/,/, /g' | fold -s -w 70 | tr '_' ' '

%description
This version of the Image Scan for Linux software contains only
the free software parts of what Avasys provides.

In particular this version of the Image Scan for Linux software
neither contains any proprietary driver library nor firmware files
nor proprietary software to support scanner network interfaces
nor the proprietary "libesmod" library which would be required
by the "/usr/bin/iscan" frontend which is also not provided.

This package contains only the epkowa driver for SANE, which compiles
and runs natively even on non-i386 platforms. For documentation, see
"man sane-epkowa".

The frontend /usr/bin/iscan was removed because it requires the
proprietary "libesmod" library. This should cause no problem
because the driver epkowa in this version of the Image Scan
for Linux software runs natively even on non-i386 platforms
so that the usual frontends (like scanimage and xsane)
can be used even on non-i386 platforms.

Drawbacks:

The free version of the epkowa driver cannot work for those scanners
that require a proprietary driver library (and a firmware file).
As of this writing (June 2010), those scanners are the following models:

ES-D400, GT-1500, GT-7200U, GT-7300U, GT-9400UF, GT-D1000, GT-F500, 
GT-F520, GT-F550, GT-F570, GT-F600, GT-F650, GT-F670, GT-F700, 
GT-F720, GT-S50, GT-S80, GT-S600, GT-S620, GT-X750, GT-X770, GT-X820, 
Perfection 1250, Perfection 1250 PHOTO, Perfection 1260, 
Perfection 1260 PHOTO, Perfection 2480 PHOTO, Perfection 2580 PHOTO, 
Perfection 3170 PHOTO, Perfection 3490 PHOTO, Perfection 3590 PHOTO, 
Perfection 4180 PHOTO, Perfection 4490 PHOTO, Perfection V10, 
Perfection V30, Perfection V100 Photo, Perfection V200 Photo, 
Perfection V300 Photo, Perfection V350 Photo, Perfection V500 Photo, 
Perfection V600 Photo, Stylus CX4300, Stylus CX4400, Stylus CX5500, 
Stylus CX5600, Stylus DX4400

Those models do not work with the free iscan version.
The third-party Image Scan driver software from Avasys
is required for those models.
The Image Scan driver software is made and provided by Avasys
at http://avasys.jp/eng/linux_driver/ where RPM packages
for 32-bit (i386) and 64-bit (x86_64) architecture can be downloaded
(provided you accept the Avasys and Epson license agreements).
The Image Scan driver from Avasys contains proprietary binary-only software.
For some models it is only available for 32-bit (i386) architecture
which does not work when you have a 64-bit system installation.
Some scanners are also supported by another (free-software) driver.
When your scanner model requires a non-free (proprietary) module,
you have to download and install two packages from Avasys:
The 'iscan' package for the base software and an additional
model dependant 'iscan-plugin' package with the proprietary module.

Other scanners may only work via USB but require a proprietary
software package which supports the network interface.
As of this writing (June 2010), those scanners are the following models:

Artisan 710 Series, Artisan 810 Series, EP-702A, EP-802A, EP-902A, 
ES-H7200, GT-20000, PX-602F, Stylus Office BX610FW Series, 
Stylus Office TX610FW Series, Stylus Photo PX650 Series, 
Stylus Photo PX710W Series, Stylus Photo PX810FW Series, 
Stylus Photo TX650 Series, Stylus Photo TX710W Series, 
Stylus SX610FW Series, WorkForce 610 Series

To use those models via the network interface, you need the above
mentioned third-party Image Scan driver software from Avasys
plus an additional iscan-network-nt package from Avasys
which provides support for the network interface.

Note that the iscan-network-nt package from Avasys does not
provide support for the network interface for all models.
As of this writing (June 2010), the network interface
of the following models is not supported:

AcuLaser CX11NF, AcuLaser CX21, Artisan 700, Artisan 800, EP-801A, 
EP-901A, EP-901F, ES-H300, Expression 10000XL, 
Expression 10000XL Graphic Arts, Expression 10000XL Photo, GT-2500, 
LP-A500, LP-M5000, LP-M5500, LP-M5500F, LP-M5600, LP-M6000, 
ME Office 700FW, PM-A840S, PX-501A, PX-601F, Stylus Office BX600FW, 
Stylus Office TX600FW, Stylus Photo PX700W, Stylus Photo PX800FW, 
Stylus Photo TX700W, Stylus Photo TX800FW, Stylus NX400, 
Stylus NX410 Series, Stylus SX400, Stylus SX410 Series, 
Stylus SX600FW, Stylus TX400, Stylus TX410 Series, WorkForce 600




%changelog
openSUSE Build Service is sponsored by