File cups-pdf.spec of Package cups-pdf

#
# spec file for package cups-pdf
#
# Copyright (c) 2012 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:		cups-pdf
Version:	2.6.1
Release:	1.0
License:	GPL-2.0
Group:		System/Printing
Url:		http://www.cups-pdf.de/
# URL for Source0: http://www.cups-pdf.de/src/cups-pdf_2.6.1.tar.gz
# URL for MD5 for Source0: http://www.cups-pdf.de/src/cups-pdf_2.6.1.tar.gz.md5
# MD5 for Source0: 65f3fd525c4a9b1d736b91594b3166d5
Source0:	cups-pdf_%{version}.tar.gz
BuildRoot:	%{_tmppath}/%{name}-%{version}-build
Requires:	cups-client
Summary:	Virtual PDF printer for CUPS

%description
CUPS-PDF is a PDF writer backend for CUPS.
It provides a virtual CUPS-PDF printer which produces PDF files
so that application programs which have no built-in support
to "Save as PDF" could print to CUPS-PDF to get a PDF file. 
For details see /usr/share/doc/packages/cups-pdf/README
and http://en.opensuse.org/SDB:Printing_to_PDF

%prep
%setup -q

%build
cd src
%{__cc} $RPM_OPT_FLAGS -o cups-pdf cups-pdf.c  

%install
%__install -Dm644 extra/CUPS-PDF.ppd %{buildroot}%{_datadir}/cups/model/CUPS-PDF.ppd
%__install -Dm644 extra/cups-pdf.conf %{buildroot}/etc/cups/cups-pdf.conf 
%__install -Dm700 src/cups-pdf %{buildroot}/usr/lib/cups/backend/cups-pdf
%__install -dm755 %{buildroot}/var/spool/cups-pdf

%clean
test "%{buildroot}" != "/" && %__rm -rf %{buildroot}

%post
# Add a symbolic link if /usr/lib64/cups/backend/ exists:
if test -d /usr/lib64/cups/backend
then ln -s /usr/lib/cups/backend/cups-pdf /usr/lib64/cups/backend/cups-pdf || :
fi
# Add a "CUPS-PDF" queue if the package is installed (but not when the package is updated):
if test "$1" -eq "1"
then /usr/sbin/lpadmin -h localhost -p CUPS-PDF -v cups-pdf:/ -m CUPS-PDF.ppd -E || :
fi
# Exit successfully in any case:
exit 0

%postun
# Only if the package is erased (but not when it is replaced with an update package):
if test "$1" -eq "0"
then # Remove the "CUPS-PDF" queue (be silent if it does not exist):
     /usr/sbin/lpadmin -h localhost -x CUPS-PDF 2>/dev/null || :
     # Remove the symbolic link (ignore if it does not exist):
     rm -f /usr/lib64/cups/backend/cups-pdf || :
fi
# Exit successfully in any case:
exit 0

%files
%defattr(-,root,root)
%doc COPYING ChangeLog README
%config(noreplace) /etc/cups/cups-pdf.conf
%dir /usr/lib/cups
%dir /usr/lib/cups/backend
%attr(700, root, root) /usr/lib/cups/backend/cups-pdf
%dir %{_datadir}/cups
%dir %{_datadir}/cups/model
%{_datadir}/cups/model/CUPS-PDF.ppd
%dir /var/spool/cups-pdf

%changelog
openSUSE Build Service is sponsored by