Spec cleanup

This commit is contained in:
Andrey Bondrov 2015-10-24 01:52:48 +10:00
parent 6c61dab714
commit a13450bbf5

252
sane.spec
View file

@ -1,5 +1,5 @@
%define iscanversion 2.29.3
%define beta %nil
%define major 1
%define libname %mklibname %{name} %{major}
%define devname %mklibname %{name} %{major} -d
@ -11,11 +11,7 @@
# All sane backends have SONAME libsane.so.1. We do not want
# sane-backends-iscan to provide libsane.so.1, so filter these out.
%if %{_use_internal_dependency_generator}
%define __noautoprovfiles %{_libdir}/sane
%else
%define _exclude_files_from_autoprov %{_libdir}/%{name}/
%endif
%define __libtoolize /bin/true
@ -82,14 +78,14 @@ Patch203: sane-backends-1.0.23-udev.patch
BuildRequires: gettext
BuildRequires: gettext-devel
BuildRequires: ieee1284-devel
BuildRequires: libtool-devel
BuildRequires: jpeg-devel
BuildRequires: tiff-devel
BuildRequires: libtool-devel
BuildRequires: pkgconfig(gtk+-2.0)
BuildRequires: pkgconfig(libusb)
BuildRequires: pkgconfig(libtiff-4)
%if %{with gphoto2}
BuildRequires: pkgconfig(libgphoto2)
%endif
BuildRequires: pkgconfig(libusb)
%if %{with v4l}
BuildRequires: pkgconfig(libv4l1)
%endif
@ -110,65 +106,133 @@ 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.
#----------------------------------------------------------------------------
%package -n %{libname}
Group: System/Kernel and hardware
License: LGPLv2
Summary: SANE - local and remote scanner access. This package contains the sane library
Summary: Shared libraries for SANE
License: LGPLv2.1+
Group: System/Libraries
%description -n %{libname}
This package contains the shared libraries for %{name}.
%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
#----------------------------------------------------------------------------
%package -n %{devname}
Summary: Development files for SANE
License: LGPLv2.1+
Group: Development/C
License: LGPL
Summary: SANE - local and remote scanner access
Requires: %{libname} = %{version}-%{release}
Provides: sane-devel = %{version}-%{release}
Requires: %{libname} = %{EVRD}
Provides: sane-devel = %{EVRD}
%description -n %{devname}
This package contains the headers and development libraries necessary
to develop applications using SANE.
%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
#----------------------------------------------------------------------------
%package backends
Group: System/Kernel and hardware
License: LGPLv2
Summary: SANE - local and remote scanner access
Provides: %{name} = %{version}-%{release}
License: LGPLv2.1+
Group: System/Kernel and hardware
Provides: %{name} = %{EVRD}
%if %{with epkowa}
Suggests: iscan
%endif
Suggests: sane-firmware
Requires(pre,postun): rpm-helper
%description backends
This package contains the backends for different scanners.
%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
#----------------------------------------------------------------------------
%if %{with epkowa}
%package backends-iscan
Group: System/Kernel and hardware
License: LGPLv2
Summary: SANE - local and remote scanner access
License: LGPLv2.1+
Group: System/Kernel and hardware
Provides: iscan = %{iscanversion}
%description backends-iscan
This package contains the iscan backend, in order to not conflict with
manufacturer-supplied packages.
%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.*
%endif
#----------------------------------------------------------------------------
%package backends-doc
Summary: Documentation for SANE backends
Group: System/Kernel and hardware
Group: Documentation
%description backends-doc
This package contains the SANE backend documentation for different
scanners.
%files backends-doc
%doc %{_docdir}/sane-backends-doc-%{version}
#----------------------------------------------------------------------------
%package -n saned
Group: System/Kernel and hardware
License: LGPLv2
Summary: SANE - local and remote scanner access
Provides: %{name} = %{version}-%{release}
Provides: saned = %{version}-%{release}
Requires: sane-backends >= %{version}-%{release}
License: LGPLv2.1+
Group: System/Kernel and hardware
Provides: saned = %{EVRD}
Requires: sane-backends >= %{EVRD}
Requires(post,postun): xinetd
Requires(preun,post): rpm-helper
@ -176,8 +240,28 @@ Requires(preun,post): rpm-helper
This package contains saned, a daemon that allows remote clients to
access image acquisition devices available on the local host.
%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 "system user for saned" saned -G cdwriter,usb,scanner || :
%preun -n saned
systemctl restart xinetd
%postun -n saned
systemctl restart xinetd
#----------------------------------------------------------------------------
%prep
%setup -qn sane-backends-%{version}%{beta}
%setup -qn sane-backends-%{version}
%patch1 -p1 -b .plusteks12
%patch28 -p1 -b .group
@ -194,30 +278,9 @@ access image acquisition devices available on the local host.
%patch202 -p1 -b .open-macro
%patch203 -p1 -b .udev
# "geniusvp2" backend
#setup -q -T -D -a 14 -n sane-backends-%{version}
# "hp3500" backend
# Patch does not match on file unsupported.desc (change should not affect
# the backend itself), so we force it in
#bzcat %{PATCH20} | patch -p0 -b --suffix .hp3500 -f || :
# Fix parallel build (Gwenole)
#for a in `find . -name Makefile.in -print`; do \
# perl -p -i -e 's/^(\s*TARGETS\s+=\s+)(\S+)(\s+)(\$\(\S+_LTOBJS\))/$1$4$3$2/' $a; \
#done
# Patch for the HP ScanJet 44x0C scanners ("hp_rts88xx" backend)
#%setup -q -T -D -a 9 -n sane-backends-%{version}%{beta}
#cd sane_hp_rts88xx/sane_hp_rts88xx
#./patch-sane.sh $RPM_BUILD_DIR/sane-backends-%{version}%{beta}
#cd ../..
#patch21 -p1 -b .hp_rts88xx-0.18-fix_link
#echo 'hp_rts88xx' >> backend/dll.conf.in
# Primax parallel port scanners
%if %{with primax}
%setup -q -T -D -a 3 -n sane-backends-%{version}%{beta}
%setup -q -T -D -a 3 -n sane-backends-%{version}
%endif
# "primascan" backend
@ -225,18 +288,11 @@ access image acquisition devices available on the local host.
######%patch29 -p0 -b .primascan
cat %{SOURCE11} > backend/primascan.h
cat %{SOURCE12} > backend/primascan.c
##perl -p -i -e 's:(BACKENDS=\"):$1primascan :' configure.in
# <mrl> avoid autoconf by applying change to configure too.
##perl -p -i -e 's:(BACKENDS=\"):$1primascan :' configure
##perl -p -i -e 's:(DISTFILES\s*=\s*):$1primascan.h primascan.c :' backend/Makefile.in
echo '#primascan' >> backend/dll.conf.in
# Scanners in some Brother MF devices
#setup -q -T -D -a 10 -n sane-backends-%{version}%{beta}
# Epson Avasys driver for Epson scanners
%if %{with epkowa}
%setup -q -T -D -a 13 -n sane-backends-%{version}%{beta}
%setup -q -T -D -a 13 -n sane-backends-%{version}
%endif
# lib64 fixes (avoid patch)
@ -306,8 +362,6 @@ cd ..
# Create missing lock dir
install -d %{buildroot}/var/lib/lock/sane
#mv %{buildroot}/%{_sbindir}/saned %{buildroot}/%{_sbindir}/in.saned
#install -m 755 tools/sane-find-scanner %{buildroot}/%{_bindir}
perl -pi -e "s/installed.*/installed=yes/g" %{buildroot}%{_libdir}/libsane.la
/sbin/ldconfig -n %{buildroot}%{_libdir} %{buildroot}%{_libdir}/sane
@ -344,7 +398,6 @@ EOF
install -d %{buildroot}%{_docdir}/sane-backends-%{version}/
install -d %{buildroot}%{_docdir}/sane-backends-doc-%{version}/
pushd %{buildroot}/usr/doc/sane-%{version}
#pushd %{buildroot}/usr/doc/sane-1.0.18-cvs
mv `find -mindepth 1 -type d` *.html *.txt %{buildroot}%{_docdir}/sane-backends-doc-%{version}/
mv README README.linux %{buildroot}%{_docdir}/sane-backends-%{version}/
rm -f README.*
@ -392,82 +445,3 @@ perl -p -i -e 's/(\#.{500}).*$/$1 .../' %{buildroot}/lib/udev/rules.d/60-libsane
sed -i '/^%dir/d' sane-backends.lang
%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 "system user for saned" saned -G cdwriter,usb,scanner || :
#%_pre_useradd saned /etc/sane.d /bin/false
%preun -n saned
systemctl restart xinetd
%postun -n saned
systemctl restart xinetd
%pre backends
%_pre_groupadd scanner
%postun backends
%_postun_groupdel scanner
%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/*[^saned]
%config(noreplace) %{_sysconfdir}/sane.d/*
/lib/udev/rules.d/*-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
%if %{with epkowa}
%files backends-iscan
%{_libdir}/sane/libsane-epkowa.*
%{_sysconfdir}/sane.d/epkowa.conf
%{_mandir}/man5/sane-epkowa.5*
%{_mandir}/man8/iscan-registry.*
%endif
%files backends-doc
%doc %{_docdir}/sane-backends-doc-%{version}
%files -n %{libname}
%{_libdir}/*.so.*
%dir %{_libdir}/sane
%{_libdir}/sane/*.so.*
%if %{with epkowa}
%exclude %{_libdir}/sane/libsane-epkowa.*
%endif
%files -n %{devname}
%{_bindir}/sane-config
%{_libdir}/*.so
%{_libdir}/sane/*.so
%{_includedir}/sane
%{_libdir}/pkgconfig/sane-backends.pc
%if %{with epkowa}
%exclude %{_libdir}/sane/libsane-epkowa*
%endif
%files -n saned
%{_sbindir}/*
%{_mandir}/man8/saned*
#config(noreplace) %{_sysconfdir}/sane.d/saned.conf
%attr(644,root,root) %config(noreplace) %{_sysconfdir}/xinetd.d/saned