File foomatic-filters.spec of Package foomatic-filters

#
# spec file for package foomatic-filters
#
# Copyright (c) 2013 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/
#


Name:           foomatic-filters
# a2ps (or similar) is needed for build because
# configure tests for it and if not found it fails with:
# "configure: error: cannot find a2ps, enscript, mpage, or CUPS' texttops.
#  You need to have at least one installed":
BuildRequires:  a2ps
# Since foomatic-filters-4.0.8 D-Bus is required for build
# because there is ICC color managment via colord and colord requires D-Bus:
BuildRequires:  dbus-1-devel
# In the "Printing" repository Ghostscript is cleaned up
# and upgraded to a stable release >= 9.05
# see https://bugzilla.novell.com/show_bug.cgi?id=735824
# where ghostscript-library is replaced
# by ghostscript plus ghostscript-devel
# and ghostscript-mini plus ghostscript-mini-devel:
BuildRequires:  ghostscript-mini-devel
# Since a foomatic-filters version after 4.0.6 pkg-config is required for build:
BuildRequires:  pkg-config
# The /usr/lib/cups/backend/beh is perl script text:
Requires:       perl
# "man foomatic-rip" reads:
# "Non-PostScript/PDF files are translated to PostScript ... This is usually done by a2ps":
Recommends:     a2ps
# See the VERSION.full file if it is a snapshot with "bzrdate":
Version:        4.0.12
Release:        0
# Source0...Source9 is for sources from upstream:
# URL for Source0: http://www.openprinting.org/download/foomatic/foomatic-filters-4.0-20120208.tar.gz
#%%define bzrdate 4.0-20120208
#Source0:        foomatic-filters-%%{bzrdate}.tar.gz
# URL for Source0: http://www.openprinting.org/download/foomatic/foomatic-filters-4.0.12.tar.gz
Source0:        http://www.openprinting.org/download/foomatic/%{name}-%{version}.tar.gz
# Patch0...Patch9 is for patches from upstream:
# ...
# Patch10...Patch99 is for Suse patches for the sources from upstream:
# ...
# Source100... is for special Suse sources:
# ...
Url:            http://www.openprinting.org/
# Install into this non-root directory (required when norootforbuild is used):
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Summary:        The universal print filter foomatic-rip
License:        GPL-2.0+
Group:          Hardware/Printing

%description
The print filter "foomatic-rip" is used
by print spoolers (in particular by CUPS)
to convert PostScript print job data into
the printer's native format as described
by a printer/driver-specific Foomatic PPD file.

%prep
# Show which ghostscript have been actually installed by
# the dependency resolver in our build system and
# verify that the ghostscript-mini-devel dependencies are
# actually fulfilled, see the BuildRequires above.
# Unfortunately the dependency resolver in our build system
# may install ghostscript-mini from another repository
# see https://bugzilla.novell.com/show_bug.cgi?id=507414
# regardless of the versioned requirement for ghostscript-mini
# in ghostscript-mini-devel.
# Build should intentionally fail if the ghostscript-mini-devel
# dependencies are not fulfilled:
rpm -qa | grep ^ghostscript
rpm -V ghostscript-mini-devel
# Be quiet when unpacking:
%setup -q
# Use this "setup" if it is a snapshot with "bzrdate":
#%%setup -q -n foomatic-filters-%%{bzrdate}

%build
export CFLAGS="$RPM_OPT_FLAGS -fstack-protector"
# Use explicit "/usr/lib/" to enforce the right directory
# for CUPS backends and filters which is "/usr/lib/"
# regardless of the architecture see "Compliance with Upstream CUPS"
# at http://en.opensuse.org/Portal:Printing
# and https://bugzilla.novell.com/show_bug.cgi?id=575544#c2
# and http://bugs.linux-foundation.org/show_bug.cgi?id=349
export CUPS_BACKENDS="/usr/lib/cups/backend"
export CUPS_FILTERS="/usr/lib/cups/filter"
%configure \
	--libdir=/usr/lib
make %{?_smp_mflags}

%install
export CUPS_BACKENDS="/usr/lib/cups/backend"
export CUPS_FILTERS="/usr/lib/cups/filter"
make install PREFIX=$RPM_BUILD_ROOT/%{_prefix} DESTDIR=$RPM_BUILD_ROOT
# Remove stuff which we (i.e. Suse/Novell) do not need.
# We provide no PPR spooler (and the development for it had stopped):
rm -f $RPM_BUILD_ROOT/usr/lib*/ppr/interfaces/foomatic-rip
rm -f $RPM_BUILD_ROOT/usr/lib*/ppr/lib/foomatic-rip

%files
%defattr(-, root, root)
%dir %{_sysconfdir}/foomatic
%config %{_sysconfdir}/foomatic/filter.conf
%{_sysconfdir}/foomatic/filter.conf.sample
%{_bindir}/foomatic-rip
%dir /usr/lib/cups
%dir /usr/lib/cups/filter
/usr/lib/cups/filter/foomatic-rip
%dir /usr/lib/cups/backend
/usr/lib/cups/backend/beh
%doc %{_mandir}/man1/foomatic-*
%doc COPYING ChangeLog README TODO USAGE

%changelog