2014-09-24 06:52:07 -04:00
%define iscanversion 2.29.3
2015-10-24 01:52:48 +10:00
%define major 1
%define libname %mklibname %{name} %{major}
%define devname %mklibname %{name} %{major} -d
2012-02-01 14:44:58 +04:00
2015-10-24 01:25:57 +10:00
%bcond_without gphoto2
2013-10-07 12:30:31 +04:00
%bcond_without primax
%bcond_without v4l
%bcond_without epkowa
2012-02-01 14:44:58 +04:00
# All sane backends have SONAME libsane.so.1. We do not want
# sane-backends-iscan to provide libsane.so.1, so filter these out.
2012-08-15 22:46:13 +11:00
%define __noautoprovfiles %{_libdir}/sane
2012-08-16 01:27:01 +11:00
2012-02-01 14:44:58 +04:00
%define __libtoolize /bin/true
# Setting this makes the /etc/sane.d/dll.conf empty so that scanning apps
# do not search for all existing scanner models which makes their startup
# slow (the user or "scannerdrake" has to insert the names of the really
# installed scanners then)
2013-10-07 12:30:31 +04:00
%bcond_with empty_dll_conf
2012-02-01 14:44:58 +04:00
2013-09-09 13:23:56 +04:00
Summary : SANE - local and remote scanner access
2012-08-16 00:03:58 +11:00
Name : sane
2015-10-24 01:25:57 +10:00
Version : 1.0.25
Release : 1
2012-08-16 00:03:58 +11:00
# lib/ is LGPLv2+, backends are GPLv2+ with exceptions
# Tools are GPLv2+, docs are public domain
License : GPLv2+ and GPLv2+ with exceptions and Public Domain
Group : Graphics
2013-09-09 13:23:56 +04:00
Url : http://www.sane-project.org/
2015-10-24 01:25:57 +10:00
Source0 : http://alioth.debian.org/frs/download.php/file/3958/sane-backends-%{version} .tar.gz
2013-10-05 02:01:40 +04:00
Source3 : http://downloads.sourceforge.net/project/px-backend/primaxscan-source/1.1.beta1/primaxscan-1.1.beta1.tar.gz
2012-02-01 14:44:58 +04:00
Source5 : saned-xinetd
2013-10-05 02:01:40 +04:00
Source9 : http://downloads.sourceforge.net/project/hp44x0backend/hp44x0backend/sane_hp_rts88xx-0.18/sane_hp_rts88xx-0.18.tar.gz
Source10 : http://downloads.sourceforge.net/project/brother-mfc/brother-mfc/sane-driver/sane-driver-0.2.tar.gz
2012-02-01 14:44:58 +04:00
Source11 : http://www.geocities.com/trsh0101/SANE/primascan.h
Source12 : http://www.geocities.com/trsh0101/SANE/primascan.c
# The free part of Epson's scanner driver package IScan, full package
# downloaded from http://www.avasys.jp/english/linux_e/index.html
# Non-free part stripped out with
# mkdir x; cd x; tar -xvzf ../iscan_2.21.0-6.tar.gz; rm -f */non-free/EAPL*.txt */non-free/lib*.so; tar -cvjf ../iscan_2.21.0-6-free.tar.bz2 *; cd ..; rm -rf x
2014-02-04 16:28:49 +04:00
Source13 : iscan-%{iscanversion} -3-free.tar.bz2
2012-02-01 14:44:58 +04:00
Source14 : http://downloads.sourceforge.net/project/geniusvp2/sane-backend-geniusvp2/1.0.16.1/sane-backend-geniusvp2_1.0.16.1.tar.gz
2012-08-15 22:46:13 +11:00
Source15 : sane.rpmlintrc
2014-02-04 16:28:49 +04:00
Patch0 : sane-backends-1.0.19-fix-str-fmt.patch
2012-02-01 14:44:58 +04:00
Patch1 : sane-backends-1.0.18-plustek-s12.patch
2014-09-24 06:52:07 -04:00
Patch23 : iscan-2.29.3-fix-link.patch
2012-02-01 14:44:58 +04:00
Patch26 : iscan-2.20.1-no_non-free_please.diff
2014-02-04 16:28:49 +04:00
Patch27 : iscan-2.28.1-linkage_fix.patch
2012-02-01 14:44:58 +04:00
# (fc) 1.0.19-12mdv fix group for device
Patch28 : sane-backends-1.0.20-group.patch
# (fc) 1.0.20-1mdv primascan build support
2014-02-04 16:28:49 +04:00
Patch29 : sane-backends-1.0.21-primascan.patch
2012-02-01 14:44:58 +04:00
# (fc) list Brother MFC-260C, DCP130C as supported (Mdv bug # 52951)
2014-02-04 16:28:49 +04:00
Patch30 : sane-backends-1.0.22-brother2list.patch
Patch31 : sane-backends-1.0.20-strformat.patch
Patch33 : sane-backends-1.0.23-have-pthread.patch
2012-02-01 14:44:58 +04:00
# Debian patches
# new build system breaks build when using pthreads.
2014-02-04 16:28:49 +04:00
Patch101 : 01_missing_pthreads.dpatch
2012-02-01 14:44:58 +04:00
# add back SANE_CAP_ALWAYS_SETTABLE which was mistakenly
# removed from SANE 1.0.20
2014-02-04 16:28:49 +04:00
Patch106 : 06_cap_always_settable.dpatch
2012-02-01 14:44:58 +04:00
# Use fedora's patch to remove rpath
# Patch to the dll backend to look for pieces of dll.conf inside the
# /etc/sane.d/dll.d/ directory. This is a facility for packages providing
# external backends (like libsane-extras, hpoj and hplip).
2014-02-04 16:28:49 +04:00
Patch113 : 22_dll_backend_conf.dpatch
Patch115 : 24_sane-desc.c_debian_mods.dpatch
2012-02-01 14:44:58 +04:00
# Fedora patches
2013-09-09 13:23:56 +04:00
Patch202 : sane-backends-1.0.20-open-macro.patch
2014-02-04 16:28:49 +04:00
Patch203 : sane-backends-1.0.23-udev.patch
2012-08-16 00:03:58 +11:00
2012-02-01 14:44:58 +04:00
BuildRequires : gettext
BuildRequires : gettext-devel
2013-09-09 13:23:56 +04:00
BuildRequires : ieee1284-devel
BuildRequires : jpeg-devel
2015-10-24 01:52:48 +10:00
BuildRequires : libtool-devel
2012-08-16 00:03:58 +11:00
BuildRequires : pkgconfig(gtk+-2.0)
2015-10-24 01:52:48 +10:00
BuildRequires : pkgconfig(libtiff-4)
2013-10-05 02:01:40 +04:00
%if %{with gphoto2}
2012-08-16 00:03:58 +11:00
BuildRequires : pkgconfig(libgphoto2)
2012-02-01 14:44:58 +04:00
%endif
2015-10-24 01:52:48 +10:00
BuildRequires : pkgconfig(libusb)
2013-10-05 02:01:40 +04:00
%if %{with v4l}
2013-05-13 14:17:01 +04:00
BuildRequires : pkgconfig(libv4l1)
2012-02-01 14:44:58 +04:00
%endif
# ensure resmgr is not pulled
2012-08-16 00:03:58 +11:00
BuildConflicts : resmgr-devel
2012-02-01 14:44:58 +04:00
%description
SANE (Scanner Access Now Easy) is a sane and simple interface
to both local and networked scanners and other image acquisition devices
like digital still and video cameras. SANE currently includes modules for
accessing a range of scanners, including models from Agfa SnapScan, Apple,
Artec, Canon, CoolScan, Epson, HP, Microtek, Mustek, Nikon, Siemens,
Tamarack, UMAX, Connectix, QuickCams and other SANE devices via network.
For the latest information on SANE, the SANE standard definition, and
mailing list access, see http://www.mostang.com/sane/
This package does not enable network scanning by default; if you wish
to enable it, install the saned package.
2015-10-24 01:52:48 +10:00
#----------------------------------------------------------------------------
2012-02-01 14:44:58 +04:00
%package -n %{libname}
2015-10-24 01:52:48 +10:00
Summary : Shared libraries for SANE
License : LGPLv2.1+
Group : System/Libraries
2012-02-01 14:44:58 +04:00
%description -n %{libname}
2013-09-09 13:23:56 +04:00
This package contains the shared libraries for %{name} .
2012-02-01 14:44:58 +04:00
2015-10-24 01:52:48 +10:00
%files -n %{libname}
%{_libdir} /libsane.so.%{major} *
%dir %{_libdir} /sane
%{_libdir} /sane/*.so.%{major} *
%if %{with epkowa}
%exclude %{_libdir} /sane/libsane-epkowa.so.%{major} *
%endif
#----------------------------------------------------------------------------
2013-09-09 13:23:56 +04:00
%package -n %{devname}
2015-10-24 01:52:48 +10:00
Summary : Development files for SANE
License : LGPLv2.1+
2012-02-01 14:44:58 +04:00
Group : Development/C
2015-10-24 01:52:48 +10:00
Requires : %{libname} = %{EVRD}
Provides : sane-devel = %{EVRD}
2012-02-01 14:44:58 +04:00
2013-09-09 13:23:56 +04:00
%description -n %{devname}
2012-02-01 14:44:58 +04:00
This package contains the headers and development libraries necessary
to develop applications using SANE.
2015-10-24 01:52:48 +10:00
%files -n %{devname}
%{_bindir} /sane-config
%{_libdir} /libsane.so
%{_libdir} /sane/*.so
%{_includedir} /sane
%{_libdir} /pkgconfig/sane-backends.pc
%if %{with epkowa}
%exclude %{_libdir} /sane/libsane-epkowa.so
%endif
#----------------------------------------------------------------------------
2012-02-01 14:44:58 +04:00
%package backends
Summary : SANE - local and remote scanner access
2015-10-24 01:52:48 +10:00
License : LGPLv2.1+
Group : System/Kernel and hardware
Provides : %{name} = %{EVRD}
2013-10-05 02:01:40 +04:00
%if %{with epkowa}
2012-02-01 14:44:58 +04:00
Suggests : iscan
%endif
2015-01-23 12:30:05 +03:00
Suggests : sane-firmware
2015-10-24 01:52:48 +10:00
Requires(pre,postun): rpm-helper
2012-02-01 14:44:58 +04:00
%description backends
This package contains the backends for different scanners.
2015-10-24 01:52:48 +10:00
%files backends -f sane-backends.lang
%doc %{_docdir} /sane-backends-%{version}
%{_bindir} /sane-find-scanner
%{_bindir} /scanimage
%{_bindir} /gamma4scanimage
%if %{with primax}
%{_bindir} /primax_scan
%endif
%{_bindir} /umax_pp
%{_mandir} /man1/*
%{_mandir} /man5/*
%{_mandir} /man7/*
%dir %{_sysconfdir} /sane.d
%config (noreplace) %{_sysconfdir} /sane.d/*
%{_udevrulesdir} /*-libsane.rules
%attr (1777,root,root) %dir /var/lib/lock/sane
%if %{with epkowa}
# iscan files
%exclude %{_sysconfdir} /sane.d/epkowa.conf
%exclude %{_mandir} /man5/sane-epkowa.5*
%endif
%pre backends
%_pre_groupadd scanner
%postun backends
%_postun_groupdel scanner
#----------------------------------------------------------------------------
2013-10-05 02:01:40 +04:00
%if %{with epkowa}
2012-02-01 14:44:58 +04:00
%package backends-iscan
Summary : SANE - local and remote scanner access
2015-10-24 01:52:48 +10:00
License : LGPLv2.1+
Group : System/Kernel and hardware
2012-02-01 14:44:58 +04:00
Provides : iscan = %{iscanversion}
%description backends-iscan
This package contains the iscan backend, in order to not conflict with
manufacturer-supplied packages.
2015-10-24 01:52:48 +10:00
%files backends-iscan
%{_libdir} /sane/libsane-epkowa.so.%{major} *
%{_libdir} /sane/libsane-epkowa.so
%{_sysconfdir} /sane.d/epkowa.conf
%{_mandir} /man5/sane-epkowa.5*
%{_mandir} /man8/iscan-registry.*
2012-02-01 14:44:58 +04:00
%endif
2015-10-24 01:52:48 +10:00
#----------------------------------------------------------------------------
2012-02-01 14:44:58 +04:00
%package backends-doc
Summary : Documentation for SANE backends
2015-10-24 01:52:48 +10:00
Group : Documentation
2012-02-01 14:44:58 +04:00
%description backends-doc
This package contains the SANE backend documentation for different
scanners.
2015-10-24 01:52:48 +10:00
%files backends-doc
%doc %{_docdir} /sane-backends-doc-%{version}
#----------------------------------------------------------------------------
2012-02-01 14:44:58 +04:00
%package -n saned
2015-10-24 01:52:48 +10:00
Summary : SANE - local and remote scanner access
License : LGPLv2.1+
Group : System/Kernel and hardware
Provides : saned = %{EVRD}
Requires : sane-backends >= %{EVRD}
2015-01-27 09:22:23 -05:00
Requires(post,postun): xinetd
2012-02-01 14:44:58 +04:00
Requires(preun,post): rpm-helper
%description -n saned
This package contains saned, a daemon that allows remote clients to
access image acquisition devices available on the local host.
2015-10-24 01:52:48 +10:00
%files -n saned
%{_sbindir} /*
%{_mandir} /man8/saned*
%attr (644,root,root) %config (noreplace) %{_sysconfdir} /xinetd.d/saned
%post -n saned
systemctl restart xinetd
%pre -n saned
# Add saned to group scanner, cdwriter and usb for scanner access.
/usr/sbin/useradd -r -M -s /bin/false -c " s y s t e m u s e r f o r s a n e d " saned -G cdwriter,usb,scanner || :
%preun -n saned
systemctl restart xinetd
%postun -n saned
systemctl restart xinetd
#----------------------------------------------------------------------------
2012-02-01 14:44:58 +04:00
%prep
2015-10-24 01:52:48 +10:00
%setup -qn sane-backends-%{version}
2014-02-04 16:28:49 +04:00
2012-02-01 14:44:58 +04:00
%patch1 -p1 -b .plusteks12
%patch28 -p1 -b .group
%patch30 -p1 -b .brother2list
%patch31 -p1 -b .strformat
2014-02-04 16:28:49 +04:00
%patch33 -p1 -b .pthread
2012-02-01 14:44:58 +04:00
%patch101 -p1
%patch106 -p1
%patch113 -p1
%patch115 -p1
# Fedora patches
%patch202 -p1 -b .open-macro
2014-02-04 16:28:49 +04:00
%patch203 -p1 -b .udev
2012-02-01 14:44:58 +04:00
# Primax parallel port scanners
2014-02-04 17:29:01 +04:00
%if %{with primax}
2015-10-24 01:52:48 +10:00
%setup -q -T -D -a 3 -n sane-backends-%{version}
2012-02-01 14:44:58 +04:00
%endif
# "primascan" backend
# (commented out in dll.conf, as it claims to support every USB scanner)
2014-02-04 16:28:49 +04:00
######%patch29 -p0 -b .primascan
2012-02-01 14:44:58 +04:00
cat %{SOURCE11} > backend/primascan.h
cat %{SOURCE12} > backend/primascan.c
echo '#primascan' >> backend/dll.conf.in
2014-02-04 16:28:49 +04:00
2012-02-01 14:44:58 +04:00
# Epson Avasys driver for Epson scanners
2014-02-04 17:29:01 +04:00
%if %{with epkowa}
2015-10-24 01:52:48 +10:00
%setup -q -T -D -a 13 -n sane-backends-%{version}
2012-02-01 14:44:58 +04:00
%endif
# lib64 fixes (avoid patch)
# NOTE: don't regenerate configure script past this line
2014-02-04 16:28:49 +04:00
perl -pi -e " s @ / l i b ( \" | \b [ ^ / ] ) @ / % _ l i b \1 @ g i f / L D F L A G S = . * w i t h _ p t a l / " configure
2012-02-01 14:44:58 +04:00
# Reduce number of retries done by the "snapscan" backend when accessing
# the scanner
perl -p -i -e 's:for \(retries = 20; retries; retries--\):for (retries = 5; retries; retries--):' backend/snapscan-scsi.c
2014-02-04 17:29:01 +04:00
%if %{with epkowa}
2012-02-01 14:44:58 +04:00
pushd iscan-%{iscanversion}
%patch23 -p0 -b .iscan-2.10.0-1_fix_link
%patch26 -p0 -b .no_non-free_please
%patch27 -p2 -b .linkage_fix
popd
%endif
# Remove the backend/dll.conf file generated by the patches, it prevents
# the Makefile from generating the real dll.conf file
rm -f backend/dll.conf
%build
%configure 2_5x \
2012-08-16 00:03:58 +11:00
--disable-static \
--enable-rpath=no \
2013-10-05 02:01:40 +04:00
%if !%{with gphoto2}
2012-08-16 00:03:58 +11:00
--without-gphoto2
2012-02-01 14:44:58 +04:00
%endif
%make
# Primax parallel port scanners
2013-10-05 02:01:40 +04:00
%if %{with primax}
2012-02-01 14:44:58 +04:00
chmod a+rx tools/sane-config
cd primaxscan*
2013-09-09 13:23:56 +04:00
autoreconf -fi
2012-02-01 14:44:58 +04:00
PATH=`pwd`/../tools:${PATH}
CFLAGS=" ${RPM_OPT_FLAGS / - f f a s t - m a t h / } - f P I C - I ` p w d ` / . . / i n c l u d e - L ` p w d ` / . . / b a c k e n d / . l i b s / " \
2012-08-16 00:03:58 +11:00
%configure 2_5x \
--disable-static
2012-02-01 14:44:58 +04:00
%make
%make primax_scan
cd ..
%endif
# Epson Avasys driver for Epson scanners
2013-10-05 02:01:40 +04:00
%if %{with epkowa}
2012-02-01 14:44:58 +04:00
chmod a+rx tools/sane-config
PATH=`pwd`/tools:${PATH}
cd iscan-%{iscanversion}
sh ./bootstrap
export CFLAGS=" ${RPM_OPT_FLAGS / - f f a s t - m a t h / } - I ` p w d ` / . . / i n c l u d e - L ` p w d ` / . . / b a c k e n d / - f P I C "
export CXXFLAGS=" ${RPM_OPT_FLAGS / - f f a s t - m a t h / } - I ` p w d ` / . . / i n c l u d e - L ` p w d ` / . . / b a c k e n d / - f P I C "
2014-09-24 07:40:49 -04:00
export LIBUSB_1_0_LIBS=" - l u s b "
2012-08-16 00:03:58 +11:00
%configure 2_5x \
--disable-static \
--disable-frontend
2012-02-01 14:44:58 +04:00
%make
cd ..
%endif
%install
%makeinstall _std
# Create missing lock dir
install -d %{buildroot} /var/lib/lock/sane
perl -pi -e " s / i n s t a l l e d . * / i n s t a l l e d = y e s / g " %{buildroot} %{_libdir} /libsane.la
/sbin/ldconfig -n %{buildroot} %{_libdir} %{buildroot} %{_libdir} /sane
# Comment out entry for the "geniusvp2" backend in
# /etc/sane.d/dll.conf as it makes SANE hanging on some systems when
# the appropriate scanner is not present
perl -p -i -e 's/^(\s*geniusvp2)/\#$1/g' %{buildroot} %{_sysconfdir} /sane.d/dll.conf
# Comment out entry for the "epson" backend in /etc/sane.d/dll.conf as
# we have also Epson's "epkowa" backend which supports the same
# scanners
perl -p -i -e 's/^(\s*epson)/\#$1/g' %{buildroot} %{_sysconfdir} /sane.d/dll.conf
# Remove "hpoj" line from /etc/sane.d/dll.con
perl -p -i -e 's/HP\s+OfficeJet/HPLIP/g' %{buildroot} %{_sysconfdir} /sane.d/dll.conf
perl -p -i -e 's/hpoj.sf.net/hplip.sf.net/g' %{buildroot} %{_sysconfdir} /sane.d/dll.conf
perl -p -i -e 's/hpoj/hpaio/g' %{buildroot} %{_sysconfdir} /sane.d/dll.conf
2014-02-04 17:29:01 +04:00
%if %{with empty_dll_conf}
2012-02-01 14:44:58 +04:00
# The /etc/sane.d/dll.conf contains lines for every backend, so every
# backend probes for a scanner when a SANE frontend (e. g. xsane) is
# started. With this the user has always to wait around one minute
# before he can scan. We simply replace the file by a nearly empty one
# and let scannerdrake only insert the needed backends. So the
# frontends will start immediately
mv %{buildroot} %{_sysconfdir} /sane.d/dll.conf %{buildroot} %{_sysconfdir} /sane.d/dll.conf.orig
cat > %{buildroot} %{_sysconfdir} /sane.d/dll.conf <<EOF
# enable the next line if you want to allow access through the network:
net
EOF
%endif
# Move documentation from /usr/doc to /usr/share/doc
2013-09-09 13:23:56 +04:00
install -d %{buildroot} %{_docdir} /sane-backends-%{version} /
install -d %{buildroot} %{_docdir} /sane-backends-doc-%{version} /
2012-02-01 14:44:58 +04:00
pushd %{buildroot} /usr/doc/sane-%{version}
2014-02-04 17:29:01 +04:00
mv `find -mindepth 1 -type d` *.html *.txt %{buildroot} %{_docdir} /sane-backends-doc-%{version} /
2013-09-09 13:23:56 +04:00
mv README README.linux %{buildroot} %{_docdir} /sane-backends-%{version} /
2012-02-01 14:44:58 +04:00
rm -f README.*
2013-09-09 13:23:56 +04:00
mv * %{buildroot} %{_docdir} /sane-backends-%{version} /
2012-02-01 14:44:58 +04:00
popd
# Primax parallel port scanners
2014-02-04 17:29:01 +04:00
%if %{with primax}
2012-02-01 14:44:58 +04:00
cd primaxscan*
2014-02-04 16:28:49 +04:00
%makeinstall _std
rm -f %{buildroot} %{_libdir} /libsane-primax.a %{buildroot} %{_prefix} /lib/sane/libsane-primax.a
2012-02-01 14:44:58 +04:00
cp primax_scan %{buildroot} %{_bindir}
cd ..
2014-02-04 18:54:58 +04:00
%ifarch x86_64
mv -f %{buildroot} %{_prefix} /lib/sane/libsane-primax.* %{buildroot} %{_libdir} /sane/
rm -rf %{buildroot} %{_prefix} /lib/sane/
%endif
2012-02-01 14:44:58 +04:00
%endif
# Epson Avasys driver for Epson scanners
2014-02-04 17:29:01 +04:00
%if %{with epkowa}
2012-02-01 14:44:58 +04:00
cd iscan-%{iscanversion}
2014-02-04 16:28:49 +04:00
%makeinstall _std
2012-02-01 14:44:58 +04:00
rm -f %{buildroot} %{_libdir} /sane/libsane-epkowa.a
rm -f %{buildroot} %{_mandir} /man1/iscan.1*
rm -rf %{buildroot} %{_libdir} /iscan
cp backend/epkowa.conf %{buildroot} %{_sysconfdir} /sane.d/
echo 'epkowa' >> %{buildroot} %{_sysconfdir} /sane.d/dll.conf
cd ..
%endif
# Xinetd.d entry
mkdir %{buildroot} /etc/xinetd.d
cat %{SOURCE5} > %{buildroot} /etc/xinetd.d/saned
# udev rules for libusb user support
2014-02-04 16:28:49 +04:00
mkdir -p %{buildroot} /lib/udev/rules.d
install -m644 tools/udev/libsane.rules %{buildroot} /lib/udev/rules.d/60-libsane.rules
2012-02-01 14:44:58 +04:00
# Shorten too long comments
2014-02-04 16:28:49 +04:00
perl -p -i -e 's/(\#.{500}).*$/$1 .../' %{buildroot} /lib/udev/rules.d/60-libsane.rules
2012-02-01 14:44:58 +04:00
%find_lang sane-backends
sed -i '/^%dir/d' sane-backends.lang
2012-08-16 00:03:58 +11:00