File cups-filters.spec of Package cups-filters

#
# spec file for package cups-filters
#
# Copyright (c) 2018 SUSE LINUX 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/
#


Summary:        OpenPrinting CUPS filters, backends, and cups-browsed
# See also http://www.linuxfoundation.org/collaborate/workgroups/openprinting/pdf_as_standard_print_job_format
License:        GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-only AND MIT
Group:          Hardware/Printing
Url:            http://www.linuxfoundation.org/collaborate/workgroups/openprinting/cups-filters
# For a breakdown of the licensing, see COPYING file
# GPLv2:   filters: commandto*, imagetoraster, pdftops, rasterto*,
#                   imagetopdf, pstopdf, texttopdf
#         backends: parallel, serial
# GPLv2+:  filters: textonly, texttops, imagetops
# GPLv3:   filters: bannertopdf
# MIT:     filters: pdftoijs, pdftoopvp, pdftopdf, pdftoraster
Name:           cups-filters
# Normal version for official cups-filters releases is the upstream version (e.g. "Version: 1.0.49").
# For a current tarball cups-filters-1.0-yyyymmdd.tar.gz (e.g. cups-filters-1.0-20140326.tar.gz)
# the current tarball's date is added to the version to ensure a strictly increasing sequence
# "last version" < "current version" < "next version" e.g. "1.0.49" < "1.0.49.20140326" < "1.0.50"
# to verify this run: zypper vcmp 'last version' 'current version'
#       and also run: zypper vcmp 'next version' 'current version'
# e.g. zypper vcmp '1.0.49' '1.0.49.20140326' -> 1.0.49 is older than 1.0.49.20140326
#  and zypper vcmp '1.0.50' '1.0.49.20140326' -> 1.0.50 is newer than 1.0.49.20140326
Version:        1.20.3
Release:        0
Source0:        http://www.openprinting.org/download/cups-filters/cups-filters-%{version}.tar.xz
# Upstream fix for https://bugs.linuxfoundation.org/show_bug.cgi?id=1421
# in https://github.com/OpenPrinting/cups-filters/commit/6db3b08d3b20332b1525b8dd1a47950381b8f637
# dowloaded via
# wget -O fix_upstream_bug_1421.patch https://github.com/OpenPrinting/cups-filters/commit/6db3b08d3b20332b1525b8dd1a47950381b8f637.patch
# and then removed the changes of the NEWS file from that patch because
# the NEWS changes do not apply on the sources of the pristine 1.20.0 release:
# Patch100 fix_upstream_bug_1421.patch is fixed in the cups-filters 1.20.1 sources.
# Since cups-filters version 1.0.42 foomatic-rip is also provided by cups-filters.
# The foomatic-rip version that is provided by cups-filters is not specified in the cups-filters sources
# but on http://www.openprinting.org/download/foomatic/ the foomatic-filters-4.0-current.tar.gz
# dated 27-Mar-2014 (i.e. from today as of this writing) contains a VERSION.full file that reads "4.0.17.256"
# so that foomatic_rip_version (macro name can be only alphanumeric and '_' i.e. "foomatic-rip_version" does not work)
# is defined here accordingly but with one more additional trailing number '.1' to ensure that
# the sub-package cups-filters-foomatic-rip (see below) conflicts with any foomatic-filters package:
#   zypper vcmp '4.0.17.256' '4.0.17.256.1' -> 4.0.17.256 is older than 4.0.17.256.1
#   zypper vcmp '4.0.17.257' '4.0.17.256.1' -> 4.0.17.257 is newer than 4.0.17.256.1
%define foomatic_rip_version 4.0.17.256.1
# Support for cups154 in the SLE12 legacy module is abandoned (by default SLE12 has CUPS 1.7.5)
# because newer cups-filters versions use stuff that is provided since CUPS > 1.5.4 so that it does
# no longer build with CUPS 1.5.4 so that cups-filters does not work with CUPS 1.5.4:
BuildRequires:  cups-devel > 1.5.4
Requires:       cups > 1.5.4
BuildRequires:  pkgconfig
# pdftopdf
BuildRequires:  qpdf-devel
# pdftops
BuildRequires:  poppler-tools
# pdftoijs, pdftoopvp, pdftoraster
BuildRequires:  ghostscript-mini-devel
BuildRequires:  libjpeg-devel
BuildRequires:  libpng-devel
BuildRequires:  libpoppler-cpp0
BuildRequires:  libpoppler-devel
BuildRequires:  libpoppler-glib-devel
BuildRequires:  libtiff-devel
BuildRequires:  zlib-devel
# libijs
BuildRequires:  fontconfig-devel
BuildRequires:  freetype2-devel
BuildRequires:  liblcms2-devel
# braille embossers
BuildRequires:  liblouis-devel
# Make sure we get postscriptdriver tags.
# suse_version >= 1330 means "after any SLE12 service pack and after any Leap 42.x"
# see https://en.opensuse.org/openSUSE:Build_Service_cross_distribution_howto
# and cf. cups.spec where the same test is used:
%if 0%{?suse_version} >= 1330
BuildRequires:  python3-cups
%else
BuildRequires:  python-cups
%endif
# cups-browsed
# "BuildRequires libavahi-devel" is insufficient
# (build fails at configure "checking for AVAHI_GLIB")
# "BuildRequires libavahi-gobject-devel" is too much
# (libavahi-gobject-devel requires libavahi-glib-devel and libavahi-devel)
# "BuildRequires libavahi-glib-devel" is sufficient
# (libavahi-glib-devel requires libavahi-devel)
BuildRequires:  libavahi-glib-devel
# autogen.sh
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  gcc-c++
BuildRequires:  glibc-devel
BuildRequires:  libtool
BuildRequires:  systemd
BuildRequires:  xz
%systemd_requires
# test requires
BuildRequires:  dejavu-fonts
# Conflict with CUPS < 1.6 because up to CUPS 1.5.4
# the following files are provided by the cups binary RPM package
# /usr/lib/cups/filter/commandtoescpx
# /usr/lib/cups/filter/commandtopclx
# /usr/lib/cups/filter/imagetops
# /usr/lib/cups/filter/imagetoraster
# /usr/lib/cups/filter/pdftops
# /usr/lib/cups/filter/rastertoescpx
# /usr/lib/cups/filter/rastertopclx
# /usr/lib/cups/filter/texttops
# /usr/lib/cups/backend/parallel
# /usr/lib/cups/backend/serial
# and the following files are provided by the cups-devel package
# /usr/share/cups/ppdc/escp.h
# /usr/share/cups/ppdc/pcl.h
Conflicts:      cups < 1.6
# Since version 1.14.0 there are no longer sub-packages (except cups-filters-devel).
# The separation of cups-filters into sub-packages was done to make it possible
# to use cups-filters on systems with the traditional CUPS < 1.6
# (i.e. on systems before the SLE12 code base)
# because parts of the cups-filters software conflict with traditional CUPS < 1.6,
# see the comments and package descriptions in older cups-filters.spec.
# But nowadays cups-filters can no longer be built with CUPS < 1.6 with reasonable effort,
# see the entry dated "Wed Oct  7 11:16:13 CEST 2015" in cups-filters.changes.
# On systems with CUPS >= 1.6 (i.e. since SLE12 GA / Leap 42.1) there is no good reason
# to keep cups-filters split into sub-packages and furthermore that split causes
# continuous (nowadays useless) efforts and bugs like
# https://bugzilla.opensuse.org/show_bug.cgi?id=1034877
# Therefore the cups-filters main package must provide
# all what was provided by its former sub-packages
# i.e. all sub-packages names and all explicit "Provides"
# and furthermore it obsoletes all the old sub-packages:
Provides:       cups-filters-ghostscript
Obsoletes:      cups-filters-ghostscript < %{version}
Obsoletes:      cups-filters-ghostscript-debuginfo
Provides:       cups-filters-cups-browsed
Provides:       gstoraster
Obsoletes:      cups-filters-cups-browsed < %{version}
Obsoletes:      cups-filters-cups-browsed-debuginfo
Provides:       cups-browsed
Provides:       cups-filters-foomatic-rip
Obsoletes:      cups-filters-foomatic-rip < %{version}
Obsoletes:      cups-filters-foomatic-rip-debuginfo
Provides:       foomatic-rip
# Provide foomatic-filters with the exact foomatic_rip_version
# see https://bugzilla.novell.com/show_bug.cgi?id=870621
# and conflict with any other foomatic-filters version because
# the following files are also provided by foomatic-filters
# /usr/lib/cups/filter/foomatic-rip /usr/share/man/man1/foomatic-rip
# Regardless that foomatic-filters exists only up to SLE11 and openSUSE 13.1
# it is still built in the OBS "Printing" project for current SLE12 and
# openSUSE Leap and Tumbleweed so that the conflict is still needed.
# The RPM documentation http://www.rpm.org/max-rpm/s1-rpm-depend-manual-dependencies.html
# and /usr/share/doc/packages/rpm/manual/dependencies (in rpm-4.8.0 in openSUSE 11.4)
# does not show a comparison operator for "not equal" so that two Conflicts are used:
Conflicts:      foomatic-filters < %{foomatic_rip_version}
Provides:       foomatic-filters = %{foomatic_rip_version}
Conflicts:      foomatic-filters > %{foomatic_rip_version}
# /usr/bin/pdftops (provided by poppler-tools)
# is needed (but not required for non-PostScript printers)
# to print PDFs on PostScript printers because in this case
# the CUPS filter chain is:
#  /usr/lib/cups/filter/pdftopdf
#  /usr/lib/cups/filter/pdftops
#  where /usr/lib/cups/filter/pdftops calls /usr/bin/pdftops
#  /usr/lib/cups/backend/...
# see https://bugzilla.novell.com/show_bug.cgi?id=868148
Recommends:     poppler-tools

%description
Contains backends, filters, and other software
that was once part of the core CUPS distribution
but is no longer maintained by Apple Inc.
In addition it contains additional filters
and software developed independently of Apple,
especially filters for the PDF-centric printing
workflow introduced by OpenPrinting and a daemon
to browse broadcasts of remote CUPS printers
and makes these printers available locally.
Since Ghostscript version 9.10 the CUPS filters
gstoraster and gstopxl are removed from Ghostscript.
Those filters are now provided by cups-filters.
Since cups-filters version 1.0.42 foomatic-rip
is also provided by cups-filters.
Since CUPS >= 1.6 the CUPS Browsing functionality
is dropped in CUPS. The OpenPrinting cups-browsed
is a daemon running in parallel to the CUPS daemon
to provide again basic CUPS Browsing functionality.
This way basic CUPS Browsing works on clients
with CUPS >= 1.6 when there are remote CUPS servers
of CUPS version 1.5 and older in the network.
Load-balancing (what CUPS <= 1.5 did via implicit classes)
is not supported with cups-browsed.

%package devel
Summary:        Development files for cups-filters
Group:          Development/Libraries/C and C++
Requires:       %{name} = %{version}
# Conflict with cups-devel < 1.6 because up to CUPS 1.5.4
# the following files are provided by the cups-devel package
# /usr/share/cups/ppdc/escp.h
# /usr/share/cups/ppdc/pcl.h
Conflicts:      cups-devel < 1.6

%description devel
This package contains the development files for cups-filters.

%prep
%setup -q

%build
# Just do what is described in the upstream INSTALL file
# unless there is a really good reason not to do it this way
# and then it is probably worth submitting an upstream issue report to
# https://bugs.linuxfoundation.org for "Product: OpenPrinting" and "Component: cups-filters"
./autogen.sh
# No need to set our preferred architecture-specific flags for the compiler and linker
# via export CFLAGS="$RPM_OPT_FLAGS" and export CXXFLAGS="$RPM_OPT_FLAGS"
# because the RPM macro configure does that.
# --with-pdftops=pdftops - use Poppler instead of Ghostscript (see README)
# --enable-braille - enable Braille embosing filters, requires liblouis
# --disable-mutool - disable mupdf processing as we use ghostcript
%configure --disable-static \
           --disable-mutool \
           --disable-silent-rules \
           --enable-shared \
           --enable-imagefilters \
           --enable-braille \
           --enable-ijs \
           --enable-opvp \
           --with-pdftops=pdftops \
           --with-browseremoteprotocols=DNSSD,CUPS \
           --without-php \
	   --with-rcdir=no \
	   --with-test-font-path=/usr/share/fonts/truetype/DejaVuSans.ttf
make %{?_smp_mflags}

%check
make check %{?_smp_mflags}

%install
%make_install
# As band-aid for now remove the "# BrowseAllow cups.example.com" example line in cups-browsed.conf
# because currently hostnames do not work, see https://bugs.linuxfoundation.org/show_bug.cgi?id=1205
if grep -q '^# BrowseAllow cups.example.com' %{buildroot}%{_sysconfdir}/cups/cups-browsed.conf
then sed -i -e '/^# BrowseAllow cups.example.com/d' %{buildroot}%{_sysconfdir}/cups/cups-browsed.conf
else echo "No longer '# BrowseAllow cups.example.com' in cups-browsed.conf - clean up cups-filters.spec"
     exit 9
fi
# https://fedoraproject.org/wiki/Packaging_tricks#With_.25doc
mkdir __doc
mv %{buildroot}%{_datadir}/doc/cups-filters/* __doc
rm -r %{buildroot}%{_datadir}/doc/cups-filters
mv fontembed/README __doc/fontembed.README
# Install the cups-browsed.service systemd unit file from the upstream sources:
mkdir -p %{buildroot}%{_unitdir}
install -p -m 644 utils/cups-browsed.service %{buildroot}%{_unitdir}
# Provide SUSE policy symlink /usr/sbin/rcFOO -> /etc/init.d/FOO
# /usr/sbin/service exists only since openSUSE 12.3:
%if 0%{?suse_version} > 1220
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rccups-browsed
%else
ln -s /sbin/service %{buildroot}%{_sbindir}/rccups-browsed
%endif
# Don't ship libtool la files.
rm -f %{buildroot}%{_libdir}/lib*.la
# Not sure what is this good for
rm -f %{buildroot}%{_bindir}/ttfread

%pre
# For cups-browsed:
%service_add_pre cups-browsed.service
exit 0

%post
# For cups-browsed:
%service_add_post cups-browsed.service
# Re-configure dynamic linker run-time bindings:
/sbin/ldconfig
exit 0

%preun
# For cups-browsed:
%service_del_preun cups-browsed.service
exit 0

%postun
# For cups-browsed:
%service_del_postun cups-browsed.service
# Re-configure dynamic linker run-time bindings:
/sbin/ldconfig
exit 0

%files
# The files sections list all mandatory files explicitly one by one.
# In particular all executables are listed explicitly.
# This avoids that whatever configure magic might silently
# not build and install an executable when whatever condition
# for configure's automated tests is not fulfilled in the build system,
# (cf. https://bugzilla.novell.com/show_bug.cgi?id=526847#c9).
# When all mandatory files are explicitly listed,
# the build fails intentionally if a mandatory file was not built
# which ensures that already existing correctly built binary RPMs
# are not overwritten by broken RPMs where mandatory files are missing.
%defattr(-,root,root)
%doc __doc/README __doc/AUTHORS __doc/NEWS __doc/COPYING __doc/fontembed.README
%config(noreplace) %{_sysconfdir}/fonts/conf.d/99pdftoopvp.conf
%config(noreplace) %{_sysconfdir}/cups/cups-browsed.conf
%{_unitdir}/cups-browsed.service
%{_sbindir}/cups-browsed
%{_sbindir}/rccups-browsed
%{_mandir}/man5/cups-browsed.conf.5.gz
%{_mandir}/man8/cups-browsed.8.gz
%{_bindir}/driverless
%{_mandir}/man1/driverless.1.gz
%{_bindir}/foomatic-rip
%{_mandir}/man1/foomatic-rip.1.gz
%dir /usr/lib/cups
%dir /usr/lib/cups/driver
/usr/lib/cups/driver/driverless
%dir /usr/lib/cups/backend
%attr(0755,root,root) /usr/lib/cups/backend/beh
%attr(0755,root,root) /usr/lib/cups/backend/implicitclass
%attr(0755,root,root) /usr/lib/cups/backend/parallel
%attr(0755,root,root) /usr/lib/cups/backend/cups-brf
# Serial backend needs to run as root
# see https://bugzilla.redhat.com/show_bug.cgi?id=212577#c4
%attr(0700,root,root) /usr/lib/cups/backend/serial
# Explicit attr() mode not applicable to symlink /usr/lib/cups/backend/driverless
/usr/lib/cups/backend/driverless
%dir /usr/lib/cups/filter
%attr(0755,root,root) /usr/lib/cups/filter/bannertopdf
%attr(0755,root,root) /usr/lib/cups/filter/brftopagedbrf
# Explicit attr() mode not applicable to symlink /usr/lib/cups/filter/cgmtopdf
/usr/lib/cups/filter/cgmtopdf
# Explicit attr() mode not applicable to symlink /usr/lib/cups/filter/cmxtopdf
/usr/lib/cups/filter/cmxtopdf
%attr(0755,root,root) /usr/lib/cups/filter/commandtoescpx
%attr(0755,root,root) /usr/lib/cups/filter/commandtopclx
# Explicit attr() mode not applicable to symlink /usr/lib/cups/filter/emftopdf
/usr/lib/cups/filter/emftopdf
%attr(0755,root,root) /usr/lib/cups/filter/foomatic-rip
%attr(0755,root,root) /usr/lib/cups/filter/gstoraster
%attr(0755,root,root) /usr/lib/cups/filter/gstopxl
%attr(0755,root,root) /usr/lib/cups/filter/gstopdf
%attr(0755,root,root) /usr/lib/cups/filter/imagetopdf
%attr(0755,root,root) /usr/lib/cups/filter/imagetops
%attr(0755,root,root) /usr/lib/cups/filter/imagetoraster
%attr(0755,root,root) /usr/lib/cups/filter/musicxmltobrf
%attr(0755,root,root) /usr/lib/cups/filter/pdftoijs
%attr(0755,root,root) /usr/lib/cups/filter/pdftoopvp
%attr(0755,root,root) /usr/lib/cups/filter/pdftopdf
%attr(0755,root,root) /usr/lib/cups/filter/pdftops
%attr(0755,root,root) /usr/lib/cups/filter/pdftoraster
%attr(0755,root,root) /usr/lib/cups/filter/rastertoescpx
%attr(0755,root,root) /usr/lib/cups/filter/rastertopclm
%attr(0755,root,root) /usr/lib/cups/filter/rastertopclx
%attr(0755,root,root) /usr/lib/cups/filter/rastertops
%attr(0755,root,root) /usr/lib/cups/filter/rastertopdf
# Explicit attr() mode not applicable to symlink /usr/lib/cups/filter/svgtopdf
/usr/lib/cups/filter/svgtopdf
%attr(0755,root,root) /usr/lib/cups/filter/sys5ippprinter
%attr(0755,root,root) /usr/lib/cups/filter/vectortobrf
%attr(0755,root,root) /usr/lib/cups/filter/vectortopdf
# Explicit attr() mode not applicable to symlink /usr/lib/cups/filter/vectortoubrl
/usr/lib/cups/filter/vectortoubrl
%attr(0755,root,root) /usr/lib/cups/filter/texttopdf
%attr(0755,root,root) /usr/lib/cups/filter/texttops
%attr(0755,root,root) /usr/lib/cups/filter/texttotext
# Explicit attr() mode not applicable to symlink /usr/lib/cups/filter/wmftopdf
/usr/lib/cups/filter/wmftopdf
# Explicit attr() mode not applicable to symlink /usr/lib/cups/filter/xfigtopdf
/usr/lib/cups/filter/xfigtopdf
# See the "./configure --help" output
#  --with-apple-raster-filter=rastertopdf|urftopdf
#    Select filter for Apple Raster input. Default:
#    rastertopdf for CUPS 2.2.2+, urftopdf for older CUPS
# and see in the NEWS file the CHANGES IN V1.13.0
#  - rastertopdf, urftopdf: As with libcupsimage from CUPS 2.2.2
#    on rastertopdf also understands Apple Raster and much better
#    than urftopdf does, use rastertopdf for Apple Raster
#    (image/urf) input files then. Also allow for manually
#    choosing by the ./configure command line.
# Because Factory/Tumbleweed uses CUPS in the Printing project for build
# (which is currently CUPS 2.2.3 as of this writing Fri Jun 2)
# the filter for Apple Raster input is rastertopdf
# so that /usr/lib/cups/filter/urftopdf must be excluded
# from the RPM files list for Factory/Tumbleweed.
# For the current suse_version value for openSUSE Factory see
# https://en.opensuse.org/openSUSE:Build_Service_cross_distribution_howto
# because that value changes:
%if 0%{?suse_version} <= 1320
%attr(0755,root,root) /usr/lib/cups/filter/urftopdf
%endif
# Filters for braille embosser support:
%attr(0755,root,root) /usr/lib/cups/filter/brftoembosser
%attr(0755,root,root) /usr/lib/cups/filter/imagetobrf
# Explicit attr() mode not applicable to symlink /usr/lib/cups/filter/imagetoubrl
/usr/lib/cups/filter/imagetoubrl
%attr(0755,root,root) /usr/lib/cups/filter/imageubrltoindexv3
%attr(0755,root,root) /usr/lib/cups/filter/imageubrltoindexv4
%attr(0755,root,root) /usr/lib/cups/filter/textbrftoindexv3
# Explicit attr() mode not applicable to symlink /usr/lib/cups/filter/textbrftoindexv4
/usr/lib/cups/filter/textbrftoindexv4
%attr(0755,root,root) /usr/lib/cups/filter/texttobrf
%dir %{_datadir}/cups
%{_datadir}/cups/banners
# Shell helpers for braille embosser support:
%{_datadir}/cups/braille
%{_datadir}/cups/charsets
%dir %{_datadir}/cups/data
%{_datadir}/cups/data/*
%dir %{_datadir}/cups/drv
%{_datadir}/cups/drv/cupsfilters.drv
# Driver info files for braille embosser support:
%{_datadir}/cups/drv/generic-brf.drv
%{_datadir}/cups/drv/generic-ubrl.drv
%{_datadir}/cups/drv/indexv3.drv
%{_datadir}/cups/drv/indexv4.drv
%dir %{_datadir}/cups/mime
%{_datadir}/cups/mime/cupsfilters.types
%{_datadir}/cups/mime/cupsfilters.convs
%{_datadir}/cups/mime/cupsfilters-ghostscript.convs
%{_datadir}/cups/mime/cupsfilters-poppler.convs
# MIME conversion types and rules for braille embosser support:
%{_datadir}/cups/mime/braille.types
%{_datadir}/cups/mime/braille.convs
# CUPS PPD file compiler driver information files for braille embosser support:
%dir %{_datadir}/cups/ppdc
%{_datadir}/cups/ppdc/braille.defs
%{_datadir}/cups/ppdc/fr-braille.po
%{_datadir}/cups/ppdc/imagemagick.defs
%{_datadir}/cups/ppdc/index.defs
%{_datadir}/cups/ppdc/liblouis.defs
%{_datadir}/cups/ppdc/liblouis1.defs
%{_datadir}/cups/ppdc/liblouis2.defs
%{_datadir}/cups/ppdc/liblouis3.defs
%{_datadir}/cups/ppdc/liblouis4.defs
%{_datadir}/cups/ppdc/media-braille.defs
# PPD files:
%dir %{_datadir}/ppd
%{_datadir}/ppd/cupsfilters
# Libraries:
%{_libdir}/libcupsfilters.so.*
%{_libdir}/libfontembed.so.*

%files devel
%defattr(-,root,root)
%dir %{_datadir}/cups/ppdc
%{_datadir}/cups/ppdc/pcl.h
%{_datadir}/cups/ppdc/escp.h
%{_libdir}/libcupsfilters.so
%{_libdir}/libfontembed.so
%{_libdir}/pkgconfig/libcupsfilters.pc
%{_libdir}/pkgconfig/libfontembed.pc
%{_includedir}/cupsfilters
%{_includedir}/fontembed

%changelog
openSUSE Build Service is sponsored by