summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Franzke <benjaminfranzke@googlemail.com>2012-02-08 07:16:07 +0100
committerBenjamin Franzke <benjaminfranzke@googlemail.com>2012-02-08 07:16:07 +0100
commitbe47e822ad713ebf7fc92ed3b5ca911238feb1b2 (patch)
treeb4bad224b4a3028d7c54aba818df5b986bdfef9e
parentweston: Fix noinst->bin substitition (diff)
downloadbenf-be47e822ad713ebf7fc92ed3b5ca911238feb1b2.tar.gz
benf-be47e822ad713ebf7fc92ed3b5ca911238feb1b2.tar.bz2
benf-be47e822ad713ebf7fc92ed3b5ca911238feb1b2.zip
Remove cups ebuild
-rw-r--r--net-print/cups/Manifest12
-rw-r--r--net-print/cups/cups-1.5.0-r3.ebuild259
-rw-r--r--net-print/cups/files/cups-1.4.4-dont-compress-manpages.patch20
-rw-r--r--net-print/cups/files/cups-1.4.4-fix-install-perms.patch22
-rw-r--r--net-print/cups/files/cups-1.4.4-nostrip.patch14
-rw-r--r--net-print/cups/files/cups-1.4.4-perl-includes.patch12
-rw-r--r--net-print/cups/files/cups-1.4.4-php-destdir.patch21
-rw-r--r--net-print/cups/files/cups-1.4.8-CVE-2011-3170.patch37
-rw-r--r--net-print/cups/files/cups-1.4.8-largeimage.patch18
-rw-r--r--net-print/cups/files/cups-1.5.0-systemd-socket.patch1152
-rw-r--r--net-print/cups/files/cupsd.init.d20
-rw-r--r--net-print/cups/files/pdftops-1.20.gentoo340
12 files changed, 0 insertions, 1927 deletions
diff --git a/net-print/cups/Manifest b/net-print/cups/Manifest
deleted file mode 100644
index 1bd15aa..0000000
--- a/net-print/cups/Manifest
+++ /dev/null
@@ -1,12 +0,0 @@
-AUX cups-1.4.4-dont-compress-manpages.patch 580 RMD160 cbc2bf11025c1f27286bd7f2ece7ba76be6aa7ee SHA1 d7b2447263724eeb092b8cfc8ce54553ad1e5e11 SHA256 cdefd273dcdc78aa5fe14bb0246e25572da7d28a91de5c7ac8be2a0bdd915860
-AUX cups-1.4.4-fix-install-perms.patch 838 RMD160 206bd49e918bab96d24ca72f85f679d3c9122975 SHA1 6e8ef0f3e5c0efa636b4d2324bab2c8edc9461db SHA256 66e68f3bebd7339434e3de99582190d0bedce4b2e5370ff65104cc863daee6c2
-AUX cups-1.4.4-nostrip.patch 487 RMD160 27fe9a5512abb3496416e492dc4ec4fcd9c733c2 SHA1 2a1b6e7b718a5feb5921f38ec02f37b9d0edd310 SHA256 b96448896f08c5f91d5afb0c093f2638a262d1c45e716c29d5164cefee18bc61
-AUX cups-1.4.4-perl-includes.patch 637 RMD160 88d4f170ed5c9392860462f140adf9f860a24cfd SHA1 93185acfe7252ff9a69499f63192b3483d857cb0 SHA256 c730419e7b4bc16a8773a01eeb66523882901480af68686d0790558a2f5fe57d
-AUX cups-1.4.4-php-destdir.patch 679 RMD160 1b15d42373a952a608a01cb8c97efbbd3c78ac77 SHA1 e312bbae57224dead45284f9c62942b1a25282fc SHA256 d5126c5e917d8c41c7a4da1477800edd4aa752aaa4c6a67a73adbe1e3b050110
-AUX cups-1.4.8-CVE-2011-3170.patch 1045 RMD160 9a27eb1ec34ced57da5bbe7c55261d8aa35b01c0 SHA1 6155d7c4b34ff6447a93aa56fa4b5958eb943202 SHA256 c94d49c3ff980b830874dae4158768554f87f429ae400838a605505aae350af6
-AUX cups-1.4.8-largeimage.patch 572 RMD160 62e0a92fb1dc62adff43bcdc22f201da426d8916 SHA1 1528f2b1f67e7c532418dd7f495db1788ae7d2d4 SHA256 364a3ed3e161ad75836e6bc56746c25207680ab6f44563219c93146f0cf74541
-AUX cups-1.5.0-systemd-socket.patch 36984 RMD160 a021d89093a01978ad6473ea6eb3ad210356fc8f SHA1 05d540ede6b4bcff193e97945ecb63eb369516f2 SHA256 7ffbfc995fd4ae03cb89b84e2d492fe74c33a4b5e127676a0bb3f10360f56438
-AUX cupsd.init.d 293 RMD160 19fbef21cee7e472e7028f3101b680baa0089c54 SHA1 e6b27b2638fec258fe2f55c926c2530e909ca3d2 SHA256 b4268a6bae95e96b6af21c3716ecc905073736ce7dc33be1489d574a447f3c48
-AUX pdftops-1.20.gentoo 10412 RMD160 16e229662c47e03af1d1f4cb5764a76d17a66642 SHA1 6afb8a655b6ff013a2c8c8cbfb615ba1e561503b SHA256 ac5fa01ca776d75bd7cef62eef9f6b0c3945ee87e8950b40ca9f9f3ff46a16c1
-DIST cups-1.5.0-source.tar.bz2 4090210 RMD160 e7be9b6b44428561609c59abaea8fa31a11aefff SHA1 628f549867751e373fc20c7558fec422f9eb942b SHA256 c6f99b68a558f4d626e9a5076d664f38e9925715dc541b07f0328c9aeb02ec33
-EBUILD cups-1.5.0-r3.ebuild 6631 RMD160 e0617e91035917abb3a7ea741217c9dc88a0e97c SHA1 38949c4fadc37e9e90ebb208134717adc0a5bd52 SHA256 e064510b49d1fd0c9d4031a1d9434444dea8a046d82ac60edfd5b7e8637c2569
diff --git a/net-print/cups/cups-1.5.0-r3.ebuild b/net-print/cups/cups-1.5.0-r3.ebuild
deleted file mode 100644
index 735c218..0000000
--- a/net-print/cups/cups-1.5.0-r3.ebuild
+++ /dev/null
@@ -1,259 +0,0 @@
-# Copyright 1999-2011 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: $
-#
-# See http://git.overlays.gentoo.org/gitweb/?p=dev/dilfridge.git;a=blob;f=net-print/cups/notes.txt;hb=HEAD
-# for some notes about the ongoing work here
-#
-
-EAPI=3
-
-PYTHON_DEPEND="python? 2:2.5"
-
-inherit autotools eutils flag-o-matic multilib pam perl-module python versionator java-pkg-opt-2 systemd
-
-MY_P=${P/_}
-MY_PV=${PV/_}
-
-DESCRIPTION="The Common Unix Printing System"
-HOMEPAGE="http://www.cups.org/"
-SRC_URI="mirror://easysw/${PN}/${MY_PV}/${MY_P}-source.tar.bz2"
-
-LICENSE="GPL-2"
-SLOT="0"
-KEYWORDS="~amd64 ~x86"
-IUSE="acl dbus debug gnutls java +jpeg kerberos ldap pam perl php +png python samba slp +ssl static-libs +threads +tiff usb X xinetd"
-
-LANGS="da de es eu fi fr id it ja ko nl no pl pt pt_BR ru sv zh zh_TW"
-for X in ${LANGS} ; do
- IUSE="${IUSE} linguas_${X}"
-done
-
-RDEPEND="
- app-text/libpaper
- acl? (
- kernel_linux? (
- sys-apps/acl
- sys-apps/attr
- )
- )
- dbus? ( sys-apps/dbus )
- java? ( >=virtual/jre-1.6 )
- jpeg? ( virtual/jpeg:0 )
- kerberos? ( virtual/krb5 )
- ldap? ( net-nds/openldap[ssl?,gnutls?] )
- pam? ( virtual/pam )
- perl? ( dev-lang/perl )
- php? ( dev-lang/php )
- png? ( >=media-libs/libpng-1.4.3 )
- slp? ( >=net-libs/openslp-1.0.4 )
- ssl? (
- gnutls? (
- dev-libs/libgcrypt
- >=net-libs/gnutls-2.11
- )
- !gnutls? ( >=dev-libs/openssl-0.9.8g )
- )
- tiff? ( >=media-libs/tiff-3.5.5 )
- usb? ( virtual/libusb:0 )
- X? ( x11-misc/xdg-utils )
- xinetd? ( sys-apps/xinetd )
- !net-print/cupsddk
-"
-
-DEPEND="${RDEPEND}
- dev-util/pkgconfig
-"
-
-PDEPEND="
- app-text/ghostscript-gpl[cups]
- >=app-text/poppler-0.12.3-r3[utils]
-"
-
-# upstream includes an interactive test which is a nono for gentoo.
-RESTRICT="test"
-
-S="${WORKDIR}/${MY_P}"
-
-pkg_setup() {
- enewgroup lp
- enewuser lp -1 -1 -1 lp
- enewgroup lpadmin 106
-
- # python 3 is no-go
- if use python; then
- python_set_active_version 2
- python_pkg_setup
- fi
-}
-
-src_prepare() {
- # various build time fixes
- epatch "${FILESDIR}/${PN}-1.4.4-dont-compress-manpages.patch"
- epatch "${FILESDIR}/${PN}-1.4.4-fix-install-perms.patch"
- epatch "${FILESDIR}/${PN}-1.4.4-nostrip.patch"
- epatch "${FILESDIR}/${PN}-1.4.4-php-destdir.patch"
- epatch "${FILESDIR}/${PN}-1.4.4-perl-includes.patch"
- epatch "${FILESDIR}/${PN}-1.4.8-largeimage.patch"
- # security fixes
- epatch "${FILESDIR}/${PN}-1.4.8-CVE-2011-3170.patch"
-
- epatch "${FILESDIR}/${P}-systemd-socket.patch"
-
- AT_M4DIR=config-scripts eaclocal
- eautoconf
-}
-
-src_configure() {
- export DSOFLAGS="${LDFLAGS}"
-
- # locale support
- strip-linguas ${LANGS}
- if [ -z "${LINGUAS}" ] ; then
- export LINGUAS=none
- fi
-
- local myconf
- if use ssl || use gnutls ; then
- myconf+="
- $(use_enable gnutls)
- $(use_enable !gnutls openssl)
- "
- else
- myconf+="
- --disable-gnutls
- --disable-openssl
- "
- fi
-
- # bug 352252, recheck for later versions if still necessary....
- if use gnutls && ! use threads ; then
- ewarn "The useflag gnutls requires also threads enabled. Switching on threads."
- fi
- if use gnutls || use threads ; then
- myconf+=" --enable-threads "
- else
- myconf+=" --disable-threads "
- fi
-
- econf \
- --libdir=/usr/$(get_libdir) \
- --localstatedir=/var \
- --with-cups-user=lp \
- --with-cups-group=lp \
- --with-docdir=/usr/share/cups/html \
- --with-languages="${LINGUAS}" \
- --with-pdftops=/usr/bin/pdftops \
- --with-system-groups=lpadmin \
- $(use_enable acl) \
- $(use_enable dbus) \
- $(use_enable debug) \
- $(use_enable debug debug-guards) \
- $(use_enable jpeg) \
- $(use_enable kerberos gssapi) \
- $(use_enable ldap) \
- $(use_enable pam) \
- $(use_enable png) \
- $(use_enable slp) \
- $(use_enable static-libs static) \
- $(use_enable tiff) \
- $(use_enable usb libusb) \
- $(use_with java) \
- $(use_with perl) \
- $(use_with php) \
- $(use_with python) \
- $(use_with xinetd xinetd /etc/xinetd.d) \
- --enable-libpaper \
- --disable-dnssd \
- $(systemd_with_unitdir) \
- ${myconf}
-
- # install in /usr/libexec always, instead of using /usr/lib/cups, as that
- # makes more sense when facing multilib support.
- sed -i -e 's:SERVERBIN.*:SERVERBIN = "$(BUILDROOT)"/usr/libexec/cups:' Makedefs || die
- sed -i -e 's:#define CUPS_SERVERBIN.*:#define CUPS_SERVERBIN "/usr/libexec/cups":' config.h || die
- sed -i -e 's:cups_serverbin=.*:cups_serverbin=/usr/libexec/cups:' cups-config || die
-}
-
-src_compile() {
- emake || die "emake failed"
-
- if use perl ; then
- cd "${S}"/scripting/perl
- perl-module_src_prep
- perl-module_src_compile
- fi
-
- if use php ; then
- cd "${S}"/scripting/php
- emake || die "emake php failed"
- fi
-}
-
-src_install() {
- emake BUILDROOT="${D}" install || die "emake install failed"
- dodoc {CHANGES,CREDITS,README}.txt || die "dodoc install failed"
-
- if use perl ; then
- cd "${S}"/scripting/perl
- perl-module_src_install
- fixlocalpod
- fi
-
- if use php ; then
- cd "${S}"/scripting/php
- emake DESTDIR="${D}" install || die "emake install for php bindings failed"
- fi
-
- # clean out cups init scripts
- rm -rf "${D}"/etc/{init.d/cups,rc*,pam.d/cups}
-
- # install our init script
- local neededservices
- use dbus && neededservices+=" dbus"
- [[ -n ${neededservices} ]] && neededservices="need${neededservices}"
- cp "${FILESDIR}"/cupsd.init.d "${T}"/cupsd || die
- sed -i \
- -e "s/@neededservices@/$neededservices/" \
- "${T}"/cupsd || die
- doinitd "${T}"/cupsd || die "doinitd failed"
-
- # install our pam script
- pamd_mimic_system cups auth account
-
- if use xinetd ; then
- # correct path
- sed -i \
- -e "s:server = .*:server = /usr/libexec/cups/daemon/cups-lpd:" \
- "${D}"/etc/xinetd.d/cups-lpd || die
- # it is safer to disable this by default, bug #137130
- grep -w 'disable' "${D}"/etc/xinetd.d/cups-lpd || \
- { sed -i -e "s:}:\tdisable = yes\n}:" "${D}"/etc/xinetd.d/cups-lpd || die ; }
- # write permission for file owner (root), bug #296221
- fperms u+w /etc/xinetd.d/cups-lpd || die "fperms failed"
- else
- rm -rf "${D}"/etc/xinetd.d
- fi
-
- keepdir /usr/libexec/cups/driver /usr/share/cups/{model,profiles} \
- /var/cache/cups /var/cache/cups/rss /var/log/cups /var/run/cups/certs \
- /var/spool/cups/tmp
-
- keepdir /etc/cups/{interfaces,ppd,ssl}
-
- # FIXME: dont collide with systemd-units
- dodir /etc/systemd/system/
- mv "${D}"/usr/lib/systemd/system/cups.service "${D}"/etc/systemd/system/
-
- use X || rm -r "${D}"/usr/share/applications
-
- # create /etc/cups/client.conf, bug #196967 and #266678
- echo "ServerName /var/run/cups/cups.sock" >> "${D}"/etc/cups/client.conf
-}
-
-pkg_postinst() {
- echo
- elog "For information about installing a printer and general cups setup"
- elog "take a look at: http://www.gentoo.org/doc/en/printing-howto.xml"
- echo
-}
diff --git a/net-print/cups/files/cups-1.4.4-dont-compress-manpages.patch b/net-print/cups/files/cups-1.4.4-dont-compress-manpages.patch
deleted file mode 100644
index 4a639c0..0000000
--- a/net-print/cups/files/cups-1.4.4-dont-compress-manpages.patch
+++ /dev/null
@@ -1,20 +0,0 @@
-# Source: Fedora
-
-diff -up cups-1.4b2-svn8404/config-scripts/cups-manpages.m4.no-gzip-man cups-1.4b2-svn8404/config-scripts/cups-manpages.m4
---- cups-1.4b2-svn8404/config-scripts/cups-manpages.m4.no-gzip-man 2009-01-16 08:58:42.000000000 +0000
-+++ cups-1.4b2-svn8404/config-scripts/cups-manpages.m4 2009-03-05 11:11:12.000000000 +0000
-@@ -69,10 +69,10 @@ case "$uname" in
- ;;
- Linux* | GNU* | Darwin*)
- # Linux, GNU Hurd, and Mac OS X
-- MAN1EXT=1.gz
-- MAN5EXT=5.gz
-- MAN7EXT=7.gz
-- MAN8EXT=8.gz
-+ MAN1EXT=1
-+ MAN5EXT=5
-+ MAN7EXT=7
-+ MAN8EXT=8
- MAN8DIR=8
- ;;
- *)
diff --git a/net-print/cups/files/cups-1.4.4-fix-install-perms.patch b/net-print/cups/files/cups-1.4.4-fix-install-perms.patch
deleted file mode 100644
index 726f030..0000000
--- a/net-print/cups/files/cups-1.4.4-fix-install-perms.patch
+++ /dev/null
@@ -1,22 +0,0 @@
-# Source: Fedora
-
-diff -up cups-1.4.2/Makedefs.in.0755 cups-1.4.2/Makedefs.in
---- cups-1.4.2/Makedefs.in.0755 2010-01-13 17:06:48.507913044 +0000
-+++ cups-1.4.2/Makedefs.in 2010-01-13 17:07:10.049912905 +0000
-@@ -41,13 +41,13 @@ SHELL = /bin/sh
- # Installation programs...
- #
-
--INSTALL_BIN = $(LIBTOOL) $(INSTALL) -c -m 555 @INSTALL_STRIP@
-+INSTALL_BIN = $(LIBTOOL) $(INSTALL) -c -m 755 @INSTALL_STRIP@
- INSTALL_CONFIG = $(INSTALL) -c -m @CUPS_CONFIG_FILE_PERM@
- INSTALL_DATA = $(INSTALL) -c -m 444
- INSTALL_DIR = $(INSTALL) -d
--INSTALL_LIB = $(LIBTOOL) $(INSTALL) -c -m 555 @INSTALL_STRIP@
-+INSTALL_LIB = $(LIBTOOL) $(INSTALL) -c -m 755 @INSTALL_STRIP@
- INSTALL_MAN = $(INSTALL) -c -m 444
--INSTALL_SCRIPT = $(INSTALL) -c -m 555
-+INSTALL_SCRIPT = $(INSTALL) -c -m 755
-
- #
- # Default user, group, and system groups for the scheduler...
diff --git a/net-print/cups/files/cups-1.4.4-nostrip.patch b/net-print/cups/files/cups-1.4.4-nostrip.patch
deleted file mode 100644
index cd2b070..0000000
--- a/net-print/cups/files/cups-1.4.4-nostrip.patch
+++ /dev/null
@@ -1,14 +0,0 @@
-# Source: Gentoo
-
-diff -urN cups-1.4.4/config-scripts/cups-compiler.m4 cups-1.4.4.new/config-scripts/cups-compiler.m4
---- cups-1.4.4/config-scripts/cups-compiler.m4 2009-05-17 02:13:47.000000000 +0200
-+++ cups-1.4.4.new/config-scripts/cups-compiler.m4 2010-08-12 19:19:45.937020635 +0200
-@@ -30,7 +30,7 @@
- if test x$enable_debug = xyes; then
- OPTIM="-g"
- else
-- INSTALL_STRIP="-s"
-+ INSTALL_STRIP=""
- fi
-
- dnl Debug printfs can slow things down, so provide a separate option for that
diff --git a/net-print/cups/files/cups-1.4.4-perl-includes.patch b/net-print/cups/files/cups-1.4.4-perl-includes.patch
deleted file mode 100644
index 677c57d..0000000
--- a/net-print/cups/files/cups-1.4.4-perl-includes.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-diff -urN cups-1.4.4/scripting/perl/Makefile.PL cups-1.4.4.new//scripting/perl/Makefile.PL
---- cups-1.4.4/scripting/perl/Makefile.PL 2002-08-19 22:43:03.000000000 +0200
-+++ cups-1.4.4.new//scripting/perl/Makefile.PL 2010-09-12 19:12:53.173000149 +0200
-@@ -11,7 +11,7 @@
- 'LIBS' => ['-lcups '], # e.g., '-lm'
- 'DEFINE' => '', # e.g., '-DHAVE_SOMETHING'
- # Insert -I. if you add *.h files later:
-- 'INC' => '', # e.g., '-I/usr/include/other'
-+ 'INC' => '-I../../', # e.g., '-I/usr/include/other'
- # Un-comment this if you add C files to link with later:
- # 'OBJECT' => '$(O_FILES)', # link all the C files too
- );
diff --git a/net-print/cups/files/cups-1.4.4-php-destdir.patch b/net-print/cups/files/cups-1.4.4-php-destdir.patch
deleted file mode 100644
index 01a64c8..0000000
--- a/net-print/cups/files/cups-1.4.4-php-destdir.patch
+++ /dev/null
@@ -1,21 +0,0 @@
-# Source: Gentoo
-
-diff -urN cups-1.4.4/scripting/php/Makefile cups-1.4.4.new//scripting/php/Makefile
---- cups-1.4.4/scripting/php/Makefile 2008-08-27 23:12:43.000000000 +0200
-+++ cups-1.4.4.new//scripting/php/Makefile 2010-08-13 10:32:35.764063909 +0200
-@@ -95,11 +95,11 @@
-
- install-exec:
- echo Installing $(PHPCUPS) in $(PHPDIR)
-- $(INSTALL_DIR) $(PHPDIR)
-- $(INSTALL_LIB) $(PHPCUPS) $(PHPDIR)
-+ $(INSTALL_DIR) $(DESTDIR)/$(PHPDIR)
-+ $(INSTALL_LIB) $(PHPCUPS) $(DESTDIR)/$(PHPDIR)
- if test "x$(SYMROOT)" != x; then \
-- $(INSTALL_DIR) $(SYMROOT); \
-- cp $(PHPCUPS) $(SYMROOT); \
-+ $(INSTALL_DIR) $(DESTDIR)/$(SYMROOT); \
-+ cp $(PHPCUPS) $(DESTDIR)/$(SYMROOT); \
- fi
-
-
diff --git a/net-print/cups/files/cups-1.4.8-CVE-2011-3170.patch b/net-print/cups/files/cups-1.4.8-CVE-2011-3170.patch
deleted file mode 100644
index 843456f..0000000
--- a/net-print/cups/files/cups-1.4.8-CVE-2011-3170.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-Source: Upstream http://cups.org/str.php?L3914
-Reason: Avoid GIF reader loop (CVE-2011-2896)
-Upstream: Fixed in trunk
-
-diff -up cups-1.4.8/filter/image-gif.c.CVE-2011-2896 cups-1.4.8/filter/image-gif.c
---- cups-1.4.8/filter/image-gif.c.CVE-2011-2896 2011-06-20 21:37:51.000000000 +0100
-+++ cups-1.4.8/filter/image-gif.c 2011-08-19 11:33:37.547911212 +0100
-@@ -648,11 +648,13 @@ gif_read_lzw(FILE *fp, /* I - File to
-
- if (code == max_code)
- {
-- *sp++ = firstcode;
-- code = oldcode;
-+ if (sp < (stack + 8192))
-+ *sp++ = firstcode;
-+
-+ code = oldcode;
- }
-
-- while (code >= clear_code)
-+ while (code >= clear_code && sp < (stack + 8192))
- {
- *sp++ = table[1][code];
- if (code == table[0][code])
-@@ -661,8 +663,10 @@ gif_read_lzw(FILE *fp, /* I - File to
- code = table[0][code];
- }
-
-- *sp++ = firstcode = table[1][code];
-- code = max_code;
-+ if (sp < (stack + 8192))
-+ *sp++ = firstcode = table[1][code];
-+
-+ code = max_code;
-
- if (code < 4096)
- {
diff --git a/net-print/cups/files/cups-1.4.8-largeimage.patch b/net-print/cups/files/cups-1.4.8-largeimage.patch
deleted file mode 100644
index abf0b44..0000000
--- a/net-print/cups/files/cups-1.4.8-largeimage.patch
+++ /dev/null
@@ -1,18 +0,0 @@
-Index: filter/image.c
-===================================================================
---- filter/image.c (Revision 9872)
-+++ filter/image.c (Revision 9873)
-@@ -349,9 +349,10 @@
- * Load the image as appropriate...
- */
-
-- img->max_ics = CUPS_TILE_MINIMUM;
-- img->xppi = 128;
-- img->yppi = 128;
-+ img->cachefile = -1;
-+ img->max_ics = CUPS_TILE_MINIMUM;
-+ img->xppi = 128;
-+ img->yppi = 128;
-
- if (!memcmp(header, "GIF87a", 6) || !memcmp(header, "GIF89a", 6))
- status = _cupsImageReadGIF(img, fp, primary, secondary, saturation, hue,
diff --git a/net-print/cups/files/cups-1.5.0-systemd-socket.patch b/net-print/cups/files/cups-1.5.0-systemd-socket.patch
deleted file mode 100644
index fbc245e..0000000
--- a/net-print/cups/files/cups-1.5.0-systemd-socket.patch
+++ /dev/null
@@ -1,1152 +0,0 @@
-diff -up cups-1.5.0/config-scripts/cups-systemd.m4.systemd-socket cups-1.5.0/config-scripts/cups-systemd.m4
---- cups-1.5.0/config-scripts/cups-systemd.m4.systemd-socket 2011-10-10 13:24:38.727210334 +0100
-+++ cups-1.5.0/config-scripts/cups-systemd.m4 2011-10-10 13:24:38.727210334 +0100
-@@ -0,0 +1,25 @@
-+dnl
-+dnl "$Id$"
-+dnl
-+dnl systemd stuff for CUPS.
-+
-+dnl Find whether systemd is available
-+
-+AC_ARG_WITH([systemdsystemunitdir],
-+ AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]),
-+ [], [with_systemdsystemunitdir=$($PKGCONFIG --variable=systemdsystemunitdir systemd)])
-+if test "x$with_systemdsystemunitdir" != xno; then
-+ AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
-+fi
-+
-+if test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ; then
-+ SYSTEMD_UNITS="cups.service cups.socket cups.path"
-+else
-+ SYSTEMD_UNITS=""
-+fi
-+
-+AC_SUBST(SYSTEMD_UNITS)
-+
-+dnl
-+dnl "$Id$"
-+dnl
-diff -up cups-1.5.0/configure.in.systemd-socket cups-1.5.0/configure.in
---- cups-1.5.0/configure.in.systemd-socket 2010-11-20 01:03:46.000000000 +0000
-+++ cups-1.5.0/configure.in 2011-10-10 13:24:38.728210315 +0100
-@@ -37,6 +37,7 @@ sinclude(config-scripts/cups-pam.m4)
- sinclude(config-scripts/cups-largefile.m4)
- sinclude(config-scripts/cups-dnssd.m4)
- sinclude(config-scripts/cups-launchd.m4)
-+sinclude(config-scripts/cups-systemd.m4)
- sinclude(config-scripts/cups-defaults.m4)
- sinclude(config-scripts/cups-pdf.m4)
- sinclude(config-scripts/cups-scripting.m4)
-@@ -71,6 +72,9 @@ AC_OUTPUT(Makedefs
- conf/snmp.conf
- cups-config
- data/testprint
-+ data/cups.service
-+ data/cups.socket
-+ data/cups.path
- desktop/cups.desktop
- doc/help/ref-cupsd-conf.html
- doc/help/standard.html
-diff -up cups-1.5.0/cups/usersys.c.systemd-socket cups-1.5.0/cups/usersys.c
---- cups-1.5.0/cups/usersys.c.systemd-socket 2011-10-10 13:24:38.493214694 +0100
-+++ cups-1.5.0/cups/usersys.c 2011-10-10 13:24:38.729210297 +0100
-@@ -770,7 +770,7 @@ cups_read_client_conf(
- struct stat sockinfo; /* Domain socket information */
-
- if (!stat(CUPS_DEFAULT_DOMAINSOCKET, &sockinfo) &&
-- (sockinfo.st_mode & S_IRWXO) == S_IRWXO)
-+ (sockinfo.st_mode & (S_IROTH | S_IWOTH)) == (S_IROTH | S_IWOTH))
- cups_server = CUPS_DEFAULT_DOMAINSOCKET;
- else
- #endif /* CUPS_DEFAULT_DOMAINSOCKET */
-diff -up cups-1.5.0/data/cups.path.in.systemd-socket cups-1.5.0/data/cups.path.in
---- cups-1.5.0/data/cups.path.in.systemd-socket 2011-10-10 13:24:38.729210297 +0100
-+++ cups-1.5.0/data/cups.path.in 2011-10-10 13:24:38.730210279 +0100
-@@ -0,0 +1,8 @@
-+[Unit]
-+Description=CUPS Printer Service Spool
-+
-+[Path]
-+PathExistsGlob=@CUPS_REQUESTS@/d*
-+
-+[Install]
-+WantedBy=multi-user.target
-diff -up cups-1.5.0/data/cups.service.in.systemd-socket cups-1.5.0/data/cups.service.in
---- cups-1.5.0/data/cups.service.in.systemd-socket 2011-10-10 13:24:38.730210279 +0100
-+++ cups-1.5.0/data/cups.service.in 2011-10-10 13:24:38.730210279 +0100
-@@ -0,0 +1,9 @@
-+[Unit]
-+Description=CUPS Printing Service
-+
-+[Service]
-+ExecStart=@sbindir@/cupsd -f
-+
-+[Install]
-+Also=cups.socket cups.path
-+WantedBy=printer.target
-diff -up cups-1.5.0/data/cups.socket.in.systemd-socket cups-1.5.0/data/cups.socket.in
---- cups-1.5.0/data/cups.socket.in.systemd-socket 2011-10-10 13:24:38.730210279 +0100
-+++ cups-1.5.0/data/cups.socket.in 2011-10-10 13:25:05.726707278 +0100
-@@ -0,0 +1,10 @@
-+[Unit]
-+Description=CUPS Printing Service Sockets
-+
-+[Socket]
-+ListenStream=@CUPS_DEFAULT_DOMAINSOCKET@
-+ListenStream=631
-+BindIPv6Only=ipv6-only
-+
-+[Install]
-+WantedBy=sockets.target
-diff -up cups-1.5.0/data/Makefile.systemd-socket cups-1.5.0/data/Makefile
---- cups-1.5.0/data/Makefile.systemd-socket 2011-05-12 06:21:56.000000000 +0100
-+++ cups-1.5.0/data/Makefile 2011-10-10 13:24:38.731210260 +0100
-@@ -112,6 +112,12 @@ install-data:
- $(INSTALL_DATA) $$file $(DATADIR)/ppdc; \
- done
- $(INSTALL_DIR) -m 755 $(DATADIR)/profiles
-+ if test "x$(SYSTEMD_UNITS)" != "x" ; then \
-+ $(INSTALL_DIR) -m 755 $(SYSTEMDUNITDIR); \
-+ for file in $(SYSTEMD_UNITS); do \
-+ $(INSTALL_DATA) $$file $(SYSTEMDUNITDIR); \
-+ done; \
-+ fi
-
-
- #
-@@ -159,6 +165,9 @@ uninstall:
- -$(RMDIR) $(DATADIR)/charsets
- -$(RMDIR) $(DATADIR)/banners
- -$(RMDIR) $(DATADIR)
-+ for file in $(SYSTEMD_UNITS); do \
-+ $(RM) $(SYSTEMDUNITDIR)/$$file; \
-+ done
-
-
- #
-diff -up cups-1.5.0/Makedefs.in.systemd-socket cups-1.5.0/Makedefs.in
---- cups-1.5.0/Makedefs.in.systemd-socket 2011-10-10 13:24:38.567213315 +0100
-+++ cups-1.5.0/Makedefs.in 2011-10-10 13:24:38.731210260 +0100
-@@ -143,6 +143,7 @@ CXXFLAGS = @CPPFLAGS@ @CXXFLAGS@
- CXXLIBS = @CXXLIBS@
- DBUS_NOTIFIER = @DBUS_NOTIFIER@
- DBUS_NOTIFIERLIBS = @DBUS_NOTIFIERLIBS@
-+SYSTEMD_UNITS = @SYSTEMD_UNITS@
- DNSSD_BACKEND = @DNSSD_BACKEND@
- DSOFLAGS = -L../cups @DSOFLAGS@
- DSOLIBS = @DSOLIBS@ $(COMMONLIBS)
-@@ -267,6 +268,7 @@ PAMFILE = @PAMFILE@
-
- DEFAULT_LAUNCHD_CONF = @DEFAULT_LAUNCHD_CONF@
- DBUSDIR = @DBUSDIR@
-+SYSTEMDUNITDIR = $(BUILDROOT)@systemdsystemunitdir@
-
-
- #
-diff -up cups-1.5.0/scheduler/client.h.systemd-socket cups-1.5.0/scheduler/client.h
---- cups-1.5.0/scheduler/client.h.systemd-socket 2011-03-25 21:25:38.000000000 +0000
-+++ cups-1.5.0/scheduler/client.h 2011-10-10 13:24:38.732210241 +0100
-@@ -75,6 +75,7 @@ typedef struct
- int fd; /* File descriptor for this server */
- http_addr_t address; /* Bind address of socket */
- http_encryption_t encryption; /* To encrypt or not to encrypt... */
-+ int is_systemd; /* Is this a systemd socket? */
- } cupsd_listener_t;
-
-
-diff -up cups-1.5.0/scheduler/listen.c.systemd-socket cups-1.5.0/scheduler/listen.c
---- cups-1.5.0/scheduler/listen.c.systemd-socket 2011-04-16 00:38:13.000000000 +0100
-+++ cups-1.5.0/scheduler/listen.c 2011-10-10 13:24:38.733210222 +0100
-@@ -401,7 +401,7 @@ cupsdStopListening(void)
- lis;
- lis = (cupsd_listener_t *)cupsArrayNext(Listeners))
- {
-- if (lis->fd != -1)
-+ if (lis->fd != -1 && !lis->is_systemd)
- {
- #ifdef WIN32
- closesocket(lis->fd);
-diff -up cups-1.5.0/scheduler/main.c.systemd-socket cups-1.5.0/scheduler/main.c
---- cups-1.5.0/scheduler/main.c.systemd-socket 2011-10-10 13:24:38.689211041 +0100
-+++ cups-1.5.0/scheduler/main.c 2011-10-10 13:24:38.735210184 +0100
-@@ -26,6 +26,8 @@
- * launchd_checkin() - Check-in with launchd and collect the listening
- * fds.
- * launchd_checkout() - Update the launchd KeepAlive file as needed.
-+ * systemd_checkin() - Check-in with systemd and collect the
-+ * listening fds.
- * parent_handler() - Catch USR1/CHLD signals...
- * process_children() - Process all dead children...
- * select_timeout() - Calculate the select timeout value.
-@@ -62,6 +64,8 @@
- # endif /* !LAUNCH_JOBKEY_SERVICEIPC */
- #endif /* HAVE_LAUNCH_H */
-
-+#include "sd-daemon.h"
-+
- #if defined(HAVE_MALLOC_H) && defined(HAVE_MALLINFO)
- # include <malloc.h>
- #endif /* HAVE_MALLOC_H && HAVE_MALLINFO */
-@@ -78,6 +82,7 @@
- static void launchd_checkin(void);
- static void launchd_checkout(void);
- #endif /* HAVE_LAUNCHD */
-+static void systemd_checkin(void);
- static void parent_handler(int sig);
- static void process_children(void);
- static void sigchld_handler(int sig);
-@@ -538,6 +543,11 @@ main(int argc, /* I - Number of comm
- #endif /* HAVE_LAUNCHD */
-
- /*
-+ * If we were started by systemd get the listen sockets file descriptors...
-+ */
-+ systemd_checkin();
-+
-+ /*
- * Startup the server...
- */
-
-@@ -760,6 +770,12 @@ main(int argc, /* I - Number of comm
- #endif /* HAVE_LAUNCHD */
-
- /*
-+ * If we were started by systemd get the listen sockets file descriptors...
-+ */
-+
-+ systemd_checkin();
-+
-+ /*
- * Startup the server...
- */
-
-@@ -1584,6 +1600,98 @@ launchd_checkout(void)
- }
- #endif /* HAVE_LAUNCHD */
-
-+static void
-+systemd_checkin(void)
-+{
-+ int n, fd;
-+
-+ n = sd_listen_fds(0);
-+ if (n < 0)
-+ {
-+ cupsdLogMessage(CUPSD_LOG_ERROR,
-+ "systemd_checkin: Failed to acquire sockets from systemd - %s",
-+ strerror(-n));
-+ exit(EXIT_FAILURE);
-+ return;
-+ }
-+
-+ if (n == 0)
-+ return;
-+
-+ for (fd = SD_LISTEN_FDS_START; fd < SD_LISTEN_FDS_START + n; fd ++)
-+ {
-+ http_addr_t addr;
-+ socklen_t addrlen = sizeof (addr);
-+ int r;
-+ cupsd_listener_t *lis;
-+ char s[256];
-+
-+ r = sd_is_socket(fd, AF_UNSPEC, SOCK_STREAM, 1);
-+ if (r < 0) {
-+ cupsdLogMessage(CUPSD_LOG_ERROR,
-+ "systemd_checkin: Unable to verify socket type - %s",
-+ strerror(-r));
-+ continue;
-+ }
-+
-+ if (!r) {
-+ cupsdLogMessage(CUPSD_LOG_ERROR,
-+ "systemd_checkin: Socket not of the right type");
-+ continue;
-+ }
-+
-+ if (getsockname(fd, (struct sockaddr*) &addr, &addrlen))
-+ {
-+ cupsdLogMessage(CUPSD_LOG_ERROR,
-+ "systemd_checkin: Unable to get local address - %s",
-+ strerror(errno));
-+ continue;
-+ }
-+
-+ /*
-+ * Try to match the systemd socket address to one of the listeners...
-+ */
-+
-+ for (lis = (cupsd_listener_t *)cupsArrayFirst(Listeners);
-+ lis;
-+ lis = (cupsd_listener_t *)cupsArrayNext(Listeners))
-+ if (httpAddrEqual(&lis->address, &addr))
-+ break;
-+
-+ if (lis)
-+ {
-+ cupsdLogMessage(CUPSD_LOG_DEBUG,
-+ "systemd_checkin: Matched existing listener %s with fd %d...",
-+ httpAddrString(&(lis->address), s, sizeof(s)), fd);
-+ }
-+ else
-+ {
-+ cupsdLogMessage(CUPSD_LOG_DEBUG,
-+ "systemd_checkin: Adding new listener %s with fd %d...",
-+ httpAddrString(&addr, s, sizeof(s)), fd);
-+
-+ if ((lis = calloc(1, sizeof(cupsd_listener_t))) == NULL)
-+ {
-+ cupsdLogMessage(CUPSD_LOG_ERROR,
-+ "systemd_checkin: Unable to allocate listener - "
-+ "%s.", strerror(errno));
-+ exit(EXIT_FAILURE);
-+ }
-+
-+ cupsArrayAdd(Listeners, lis);
-+
-+ memcpy(&lis->address, &addr, sizeof(lis->address));
-+ }
-+
-+ lis->fd = fd;
-+ lis->is_systemd = 1;
-+
-+# ifdef HAVE_SSL
-+ if (_httpAddrPort(&(lis->address)) == 443)
-+ lis->encryption = HTTP_ENCRYPT_ALWAYS;
-+# endif /* HAVE_SSL */
-+ }
-+}
-
- /*
- * 'parent_handler()' - Catch USR1/CHLD signals...
-diff -up cups-1.5.0/scheduler/Makefile.systemd-socket cups-1.5.0/scheduler/Makefile
---- cups-1.5.0/scheduler/Makefile.systemd-socket 2011-10-10 13:24:38.704210762 +0100
-+++ cups-1.5.0/scheduler/Makefile 2011-10-10 13:24:38.736210166 +0100
-@@ -39,5 +39,6 @@ CUPSDOBJS = \
- server.o \
- statbuf.o \
- subscriptions.o \
-+ sd-daemon.o \
- sysman.o
- LIBOBJS = \
-@@ -571,6 +572,14 @@ sloc:
-
-
- #
-+# Update sd-daemon.[ch] drop-in file from upstream git
-+#
-+
-+update-systemd:
-+ curl http://cgit.freedesktop.org/systemd/plain/src/sd-daemon.c > sd-daemon.c
-+ curl http://cgit.freedesktop.org/systemd/plain/src/sd-daemon.h > sd-daemon.h
-+
-+#
- # Dependencies...
- #
-
-diff -up cups-1.5.0/scheduler/sd-daemon.c.systemd-socket cups-1.5.0/scheduler/sd-daemon.c
---- cups-1.5.0/scheduler/sd-daemon.c.systemd-socket 2011-10-10 13:24:38.737210148 +0100
-+++ cups-1.5.0/scheduler/sd-daemon.c 2011-10-10 13:24:38.737210148 +0100
-@@ -0,0 +1,520 @@
-+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-+
-+/***
-+ Copyright 2010 Lennart Poettering
-+
-+ Permission is hereby granted, free of charge, to any person
-+ obtaining a copy of this software and associated documentation files
-+ (the "Software"), to deal in the Software without restriction,
-+ including without limitation the rights to use, copy, modify, merge,
-+ publish, distribute, sublicense, and/or sell copies of the Software,
-+ and to permit persons to whom the Software is furnished to do so,
-+ subject to the following conditions:
-+
-+ The above copyright notice and this permission notice shall be
-+ included in all copies or substantial portions of the Software.
-+
-+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-+ BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-+ ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-+ SOFTWARE.
-+***/
-+
-+#ifndef _GNU_SOURCE
-+#define _GNU_SOURCE
-+#endif
-+
-+#include <sys/types.h>
-+#include <sys/stat.h>
-+#include <sys/socket.h>
-+#include <sys/un.h>
-+#include <sys/fcntl.h>
-+#include <netinet/in.h>
-+#include <stdlib.h>
-+#include <errno.h>
-+#include <unistd.h>
-+#include <string.h>
-+#include <stdarg.h>
-+#include <stdio.h>
-+#include <stddef.h>
-+#include <limits.h>
-+
-+#if defined(__linux__)
-+#include <mqueue.h>
-+#endif
-+
-+#include "sd-daemon.h"
-+
-+#if (__GNUC__ >= 4) && !defined(SD_EXPORT_SYMBOLS)
-+#define _sd_hidden_ __attribute__ ((visibility("hidden")))
-+#else
-+#define _sd_hidden_
-+#endif
-+
-+_sd_hidden_ int sd_listen_fds(int unset_environment) {
-+
-+#if defined(DISABLE_SYSTEMD) || !defined(__linux__)
-+ return 0;
-+#else
-+ int r, fd;
-+ const char *e;
-+ char *p = NULL;
-+ unsigned long l;
-+
-+ if (!(e = getenv("LISTEN_PID"))) {
-+ r = 0;
-+ goto finish;
-+ }
-+
-+ errno = 0;
-+ l = strtoul(e, &p, 10);
-+
-+ if (errno != 0) {
-+ r = -errno;
-+ goto finish;
-+ }
-+
-+ if (!p || *p || l <= 0) {
-+ r = -EINVAL;
-+ goto finish;
-+ }
-+
-+ /* Is this for us? */
-+ if (getpid() != (pid_t) l) {
-+ r = 0;
-+ goto finish;
-+ }
-+
-+ if (!(e = getenv("LISTEN_FDS"))) {
-+ r = 0;
-+ goto finish;
-+ }
-+
-+ errno = 0;
-+ l = strtoul(e, &p, 10);
-+
-+ if (errno != 0) {
-+ r = -errno;
-+ goto finish;
-+ }
-+
-+ if (!p || *p) {
-+ r = -EINVAL;
-+ goto finish;
-+ }
-+
-+ for (fd = SD_LISTEN_FDS_START; fd < SD_LISTEN_FDS_START + (int) l; fd ++) {
-+ int flags;
-+
-+ if ((flags = fcntl(fd, F_GETFD)) < 0) {
-+ r = -errno;
-+ goto finish;
-+ }
-+
-+ if (flags & FD_CLOEXEC)
-+ continue;
-+
-+ if (fcntl(fd, F_SETFD, flags | FD_CLOEXEC) < 0) {
-+ r = -errno;
-+ goto finish;
-+ }
-+ }
-+
-+ r = (int) l;
-+
-+finish:
-+ if (unset_environment) {
-+ unsetenv("LISTEN_PID");
-+ unsetenv("LISTEN_FDS");
-+ }
-+
-+ return r;
-+#endif
-+}
-+
-+_sd_hidden_ int sd_is_fifo(int fd, const char *path) {
-+ struct stat st_fd;
-+
-+ if (fd < 0)
-+ return -EINVAL;
-+
-+ memset(&st_fd, 0, sizeof(st_fd));
-+ if (fstat(fd, &st_fd) < 0)
-+ return -errno;
-+
-+ if (!S_ISFIFO(st_fd.st_mode))
-+ return 0;
-+
-+ if (path) {
-+ struct stat st_path;
-+
-+ memset(&st_path, 0, sizeof(st_path));
-+ if (stat(path, &st_path) < 0) {
-+
-+ if (errno == ENOENT || errno == ENOTDIR)
-+ return 0;
-+
-+ return -errno;
-+ }
-+
-+ return
-+ st_path.st_dev == st_fd.st_dev &&
-+ st_path.st_ino == st_fd.st_ino;
-+ }
-+
-+ return 1;
-+}
-+
-+_sd_hidden_ int sd_is_special(int fd, const char *path) {
-+ struct stat st_fd;
-+
-+ if (fd < 0)
-+ return -EINVAL;
-+
-+ if (fstat(fd, &st_fd) < 0)
-+ return -errno;
-+
-+ if (!S_ISREG(st_fd.st_mode) && !S_ISCHR(st_fd.st_mode))
-+ return 0;
-+
-+ if (path) {
-+ struct stat st_path;
-+
-+ if (stat(path, &st_path) < 0) {
-+
-+ if (errno == ENOENT || errno == ENOTDIR)
-+ return 0;
-+
-+ return -errno;
-+ }
-+
-+ if (S_ISREG(st_fd.st_mode) && S_ISREG(st_path.st_mode))
-+ return
-+ st_path.st_dev == st_fd.st_dev &&
-+ st_path.st_ino == st_fd.st_ino;
-+ else if (S_ISCHR(st_fd.st_mode) && S_ISCHR(st_path.st_mode))
-+ return st_path.st_rdev == st_fd.st_rdev;
-+ else
-+ return 0;
-+ }
-+
-+ return 1;
-+}
-+
-+static int sd_is_socket_internal(int fd, int type, int listening) {
-+ struct stat st_fd;
-+
-+ if (fd < 0 || type < 0)
-+ return -EINVAL;
-+
-+ if (fstat(fd, &st_fd) < 0)
-+ return -errno;
-+
-+ if (!S_ISSOCK(st_fd.st_mode))
-+ return 0;
-+
-+ if (type != 0) {
-+ int other_type = 0;
-+ socklen_t l = sizeof(other_type);
-+
-+ if (getsockopt(fd, SOL_SOCKET, SO_TYPE, &other_type, &l) < 0)
-+ return -errno;
-+
-+ if (l != sizeof(other_type))
-+ return -EINVAL;
-+
-+ if (other_type != type)
-+ return 0;
-+ }
-+
-+ if (listening >= 0) {
-+ int accepting = 0;
-+ socklen_t l = sizeof(accepting);
-+
-+ if (getsockopt(fd, SOL_SOCKET, SO_ACCEPTCONN, &accepting, &l) < 0)
-+ return -errno;
-+
-+ if (l != sizeof(accepting))
-+ return -EINVAL;
-+
-+ if (!accepting != !listening)
-+ return 0;
-+ }
-+
-+ return 1;
-+}
-+
-+union sockaddr_union {
-+ struct sockaddr sa;
-+ struct sockaddr_in in4;
-+ struct sockaddr_in6 in6;
-+ struct sockaddr_un un;
-+ struct sockaddr_storage storage;
-+};
-+
-+_sd_hidden_ int sd_is_socket(int fd, int family, int type, int listening) {
-+ int r;
-+
-+ if (family < 0)
-+ return -EINVAL;
-+
-+ if ((r = sd_is_socket_internal(fd, type, listening)) <= 0)
-+ return r;
-+
-+ if (family > 0) {
-+ union sockaddr_union sockaddr;
-+ socklen_t l;
-+
-+ memset(&sockaddr, 0, sizeof(sockaddr));
-+ l = sizeof(sockaddr);
-+
-+ if (getsockname(fd, &sockaddr.sa, &l) < 0)
-+ return -errno;
-+
-+ if (l < sizeof(sa_family_t))
-+ return -EINVAL;
-+
-+ return sockaddr.sa.sa_family == family;
-+ }
-+
-+ return 1;
-+}
-+
-+_sd_hidden_ int sd_is_socket_inet(int fd, int family, int type, int listening, uint16_t port) {
-+ union sockaddr_union sockaddr;
-+ socklen_t l;
-+ int r;
-+
-+ if (family != 0 && family != AF_INET && family != AF_INET6)
-+ return -EINVAL;
-+
-+ if ((r = sd_is_socket_internal(fd, type, listening)) <= 0)
-+ return r;
-+
-+ memset(&sockaddr, 0, sizeof(sockaddr));
-+ l = sizeof(sockaddr);
-+
-+ if (getsockname(fd, &sockaddr.sa, &l) < 0)
-+ return -errno;
-+
-+ if (l < sizeof(sa_family_t))
-+ return -EINVAL;
-+
-+ if (sockaddr.sa.sa_family != AF_INET &&
-+ sockaddr.sa.sa_family != AF_INET6)
-+ return 0;
-+
-+ if (family > 0)
-+ if (sockaddr.sa.sa_family != family)
-+ return 0;
-+
-+ if (port > 0) {
-+ if (sockaddr.sa.sa_family == AF_INET) {
-+ if (l < sizeof(struct sockaddr_in))
-+ return -EINVAL;
-+
-+ return htons(port) == sockaddr.in4.sin_port;
-+ } else {
-+ if (l < sizeof(struct sockaddr_in6))
-+ return -EINVAL;
-+
-+ return htons(port) == sockaddr.in6.sin6_port;
-+ }
-+ }
-+
-+ return 1;
-+}
-+
-+_sd_hidden_ int sd_is_socket_unix(int fd, int type, int listening, const char *path, size_t length) {
-+ union sockaddr_union sockaddr;
-+ socklen_t l;
-+ int r;
-+
-+ if ((r = sd_is_socket_internal(fd, type, listening)) <= 0)
-+ return r;
-+
-+ memset(&sockaddr, 0, sizeof(sockaddr));
-+ l = sizeof(sockaddr);
-+
-+ if (getsockname(fd, &sockaddr.sa, &l) < 0)
-+ return -errno;
-+
-+ if (l < sizeof(sa_family_t))
-+ return -EINVAL;
-+
-+ if (sockaddr.sa.sa_family != AF_UNIX)
-+ return 0;
-+
-+ if (path) {
-+ if (length <= 0)
-+ length = strlen(path);
-+
-+ if (length <= 0)
-+ /* Unnamed socket */
-+ return l == offsetof(struct sockaddr_un, sun_path);
-+
-+ if (path[0])
-+ /* Normal path socket */
-+ return
-+ (l >= offsetof(struct sockaddr_un, sun_path) + length + 1) &&
-+ memcmp(path, sockaddr.un.sun_path, length+1) == 0;
-+ else
-+ /* Abstract namespace socket */
-+ return
-+ (l == offsetof(struct sockaddr_un, sun_path) + length) &&
-+ memcmp(path, sockaddr.un.sun_path, length) == 0;
-+ }
-+
-+ return 1;
-+}
-+
-+_sd_hidden_ int sd_is_mq(int fd, const char *path) {
-+#if !defined(__linux__)
-+ return 0;
-+#else
-+ struct mq_attr attr;
-+
-+ if (fd < 0)
-+ return -EINVAL;
-+
-+ if (mq_getattr(fd, &attr) < 0)
-+ return -errno;
-+
-+ if (path) {
-+ char fpath[PATH_MAX];
-+ struct stat a, b;
-+
-+ if (path[0] != '/')
-+ return -EINVAL;
-+
-+ if (fstat(fd, &a) < 0)
-+ return -errno;
-+
-+ strncpy(stpcpy(fpath, "/dev/mqueue"), path, sizeof(fpath) - 12);
-+ fpath[sizeof(fpath)-1] = 0;
-+
-+ if (stat(fpath, &b) < 0)
-+ return -errno;
-+
-+ if (a.st_dev != b.st_dev ||
-+ a.st_ino != b.st_ino)
-+ return 0;
-+ }
-+
-+ return 1;
-+#endif
-+}
-+
-+_sd_hidden_ int sd_notify(int unset_environment, const char *state) {
-+#if defined(DISABLE_SYSTEMD) || !defined(__linux__) || !defined(SOCK_CLOEXEC)
-+ return 0;
-+#else
-+ int fd = -1, r;
-+ struct msghdr msghdr;
-+ struct iovec iovec;
-+ union sockaddr_union sockaddr;
-+ const char *e;
-+
-+ if (!state) {
-+ r = -EINVAL;
-+ goto finish;
-+ }
-+
-+ if (!(e = getenv("NOTIFY_SOCKET")))
-+ return 0;
-+
-+ /* Must be an abstract socket, or an absolute path */
-+ if ((e[0] != '@' && e[0] != '/') || e[1] == 0) {
-+ r = -EINVAL;
-+ goto finish;
-+ }
-+
-+ if ((fd = socket(AF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC, 0)) < 0) {
-+ r = -errno;
-+ goto finish;
-+ }
-+
-+ memset(&sockaddr, 0, sizeof(sockaddr));
-+ sockaddr.sa.sa_family = AF_UNIX;
-+ strncpy(sockaddr.un.sun_path, e, sizeof(sockaddr.un.sun_path));
-+
-+ if (sockaddr.un.sun_path[0] == '@')
-+ sockaddr.un.sun_path[0] = 0;
-+
-+ memset(&iovec, 0, sizeof(iovec));
-+ iovec.iov_base = (char*) state;
-+ iovec.iov_len = strlen(state);
-+
-+ memset(&msghdr, 0, sizeof(msghdr));
-+ msghdr.msg_name = &sockaddr;
-+ msghdr.msg_namelen = offsetof(struct sockaddr_un, sun_path) + strlen(e);
-+
-+ if (msghdr.msg_namelen > sizeof(struct sockaddr_un))
-+ msghdr.msg_namelen = sizeof(struct sockaddr_un);
-+
-+ msghdr.msg_iov = &iovec;
-+ msghdr.msg_iovlen = 1;
-+
-+ if (sendmsg(fd, &msghdr, MSG_NOSIGNAL) < 0) {
-+ r = -errno;
-+ goto finish;
-+ }
-+
-+ r = 1;
-+
-+finish:
-+ if (unset_environment)
-+ unsetenv("NOTIFY_SOCKET");
-+
-+ if (fd >= 0)
-+ close(fd);
-+
-+ return r;
-+#endif
-+}
-+
-+_sd_hidden_ int sd_notifyf(int unset_environment, const char *format, ...) {
-+#if defined(DISABLE_SYSTEMD) || !defined(__linux__)
-+ return 0;
-+#else
-+ va_list ap;
-+ char *p = NULL;
-+ int r;
-+
-+ va_start(ap, format);
-+ r = vasprintf(&p, format, ap);
-+ va_end(ap);
-+
-+ if (r < 0 || !p)
-+ return -ENOMEM;
-+
-+ r = sd_notify(unset_environment, p);
-+ free(p);
-+
-+ return r;
-+#endif
-+}
-+
-+_sd_hidden_ int sd_booted(void) {
-+#if defined(DISABLE_SYSTEMD) || !defined(__linux__)
-+ return 0;
-+#else
-+
-+ struct stat a, b;
-+
-+ /* We simply test whether the systemd cgroup hierarchy is
-+ * mounted */
-+
-+ if (lstat("/sys/fs/cgroup", &a) < 0)
-+ return 0;
-+
-+ if (lstat("/sys/fs/cgroup/systemd", &b) < 0)
-+ return 0;
-+
-+ return a.st_dev != b.st_dev;
-+#endif
-+}
-diff -up cups-1.5.0/scheduler/sd-daemon.h.systemd-socket cups-1.5.0/scheduler/sd-daemon.h
---- cups-1.5.0/scheduler/sd-daemon.h.systemd-socket 2011-10-10 13:24:38.737210148 +0100
-+++ cups-1.5.0/scheduler/sd-daemon.h 2011-10-10 13:24:38.738210130 +0100
-@@ -0,0 +1,277 @@
-+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-+
-+#ifndef foosddaemonhfoo
-+#define foosddaemonhfoo
-+
-+/***
-+ Copyright 2010 Lennart Poettering
-+
-+ Permission is hereby granted, free of charge, to any person
-+ obtaining a copy of this software and associated documentation files
-+ (the "Software"), to deal in the Software without restriction,
-+ including without limitation the rights to use, copy, modify, merge,
-+ publish, distribute, sublicense, and/or sell copies of the Software,
-+ and to permit persons to whom the Software is furnished to do so,
-+ subject to the following conditions:
-+
-+ The above copyright notice and this permission notice shall be
-+ included in all copies or substantial portions of the Software.
-+
-+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-+ BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-+ ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-+ SOFTWARE.
-+***/
-+
-+#include <sys/types.h>
-+#include <inttypes.h>
-+
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
-+/*
-+ Reference implementation of a few systemd related interfaces for
-+ writing daemons. These interfaces are trivial to implement. To
-+ simplify porting we provide this reference implementation.
-+ Applications are welcome to reimplement the algorithms described
-+ here if they do not want to include these two source files.
-+
-+ The following functionality is provided:
-+
-+ - Support for logging with log levels on stderr
-+ - File descriptor passing for socket-based activation
-+ - Daemon startup and status notification
-+ - Detection of systemd boots
-+
-+ You may compile this with -DDISABLE_SYSTEMD to disable systemd
-+ support. This makes all those calls NOPs that are directly related to
-+ systemd (i.e. only sd_is_xxx() will stay useful).
-+
-+ Since this is drop-in code we don't want any of our symbols to be
-+ exported in any case. Hence we declare hidden visibility for all of
-+ them.
-+
-+ You may find an up-to-date version of these source files online:
-+
-+ http://cgit.freedesktop.org/systemd/plain/src/sd-daemon.h
-+ http://cgit.freedesktop.org/systemd/plain/src/sd-daemon.c
-+
-+ This should compile on non-Linux systems, too, but with the
-+ exception of the sd_is_xxx() calls all functions will become NOPs.
-+
-+ See sd-daemon(7) for more information.
-+*/
-+
-+#ifndef _sd_printf_attr_
-+#if __GNUC__ >= 4
-+#define _sd_printf_attr_(a,b) __attribute__ ((format (printf, a, b)))
-+#else
-+#define _sd_printf_attr_(a,b)
-+#endif
-+#endif
-+
-+/*
-+ Log levels for usage on stderr:
-+
-+ fprintf(stderr, SD_NOTICE "Hello World!\n");
-+
-+ This is similar to printk() usage in the kernel.
-+*/
-+#define SD_EMERG "<0>" /* system is unusable */
-+#define SD_ALERT "<1>" /* action must be taken immediately */
-+#define SD_CRIT "<2>" /* critical conditions */
-+#define SD_ERR "<3>" /* error conditions */
-+#define SD_WARNING "<4>" /* warning conditions */
-+#define SD_NOTICE "<5>" /* normal but significant condition */
-+#define SD_INFO "<6>" /* informational */
-+#define SD_DEBUG "<7>" /* debug-level messages */
-+
-+/* The first passed file descriptor is fd 3 */
-+#define SD_LISTEN_FDS_START 3
-+
-+/*
-+ Returns how many file descriptors have been passed, or a negative
-+ errno code on failure. Optionally, removes the $LISTEN_FDS and
-+ $LISTEN_PID file descriptors from the environment (recommended, but
-+ problematic in threaded environments). If r is the return value of
-+ this function you'll find the file descriptors passed as fds
-+ SD_LISTEN_FDS_START to SD_LISTEN_FDS_START+r-1. Returns a negative
-+ errno style error code on failure. This function call ensures that
-+ the FD_CLOEXEC flag is set for the passed file descriptors, to make
-+ sure they are not passed on to child processes. If FD_CLOEXEC shall
-+ not be set, the caller needs to unset it after this call for all file
-+ descriptors that are used.
-+
-+ See sd_listen_fds(3) for more information.
-+*/
-+int sd_listen_fds(int unset_environment);
-+
-+/*
-+ Helper call for identifying a passed file descriptor. Returns 1 if
-+ the file descriptor is a FIFO in the file system stored under the
-+ specified path, 0 otherwise. If path is NULL a path name check will
-+ not be done and the call only verifies if the file descriptor
-+ refers to a FIFO. Returns a negative errno style error code on
-+ failure.
-+
-+ See sd_is_fifo(3) for more information.
-+*/
-+int sd_is_fifo(int fd, const char *path);
-+
-+/*
-+ Helper call for identifying a passed file descriptor. Returns 1 if
-+ the file descriptor is a special character device on the file
-+ system stored under the specified path, 0 otherwise.
-+ If path is NULL a path name check will not be done and the call
-+ only verifies if the file descriptor refers to a special character.
-+ Returns a negative errno style error code on failure.
-+
-+ See sd_is_special(3) for more information.
-+*/
-+int sd_is_special(int fd, const char *path);
-+
-+/*
-+ Helper call for identifying a passed file descriptor. Returns 1 if
-+ the file descriptor is a socket of the specified family (AF_INET,
-+ ...) and type (SOCK_DGRAM, SOCK_STREAM, ...), 0 otherwise. If
-+ family is 0 a socket family check will not be done. If type is 0 a
-+ socket type check will not be done and the call only verifies if
-+ the file descriptor refers to a socket. If listening is > 0 it is
-+ verified that the socket is in listening mode. (i.e. listen() has
-+ been called) If listening is == 0 it is verified that the socket is
-+ not in listening mode. If listening is < 0 no listening mode check
-+ is done. Returns a negative errno style error code on failure.
-+
-+ See sd_is_socket(3) for more information.
-+*/
-+int sd_is_socket(int fd, int family, int type, int listening);
-+
-+/*
-+ Helper call for identifying a passed file descriptor. Returns 1 if
-+ the file descriptor is an Internet socket, of the specified family
-+ (either AF_INET or AF_INET6) and the specified type (SOCK_DGRAM,
-+ SOCK_STREAM, ...), 0 otherwise. If version is 0 a protocol version
-+ check is not done. If type is 0 a socket type check will not be
-+ done. If port is 0 a socket port check will not be done. The
-+ listening flag is used the same way as in sd_is_socket(). Returns a
-+ negative errno style error code on failure.
-+
-+ See sd_is_socket_inet(3) for more information.
-+*/
-+int sd_is_socket_inet(int fd, int family, int type, int listening, uint16_t port);
-+
-+/*
-+ Helper call for identifying a passed file descriptor. Returns 1 if
-+ the file descriptor is an AF_UNIX socket of the specified type
-+ (SOCK_DGRAM, SOCK_STREAM, ...) and path, 0 otherwise. If type is 0
-+ a socket type check will not be done. If path is NULL a socket path
-+ check will not be done. For normal AF_UNIX sockets set length to
-+ 0. For abstract namespace sockets set length to the length of the
-+ socket name (including the initial 0 byte), and pass the full
-+ socket path in path (including the initial 0 byte). The listening
-+ flag is used the same way as in sd_is_socket(). Returns a negative
-+ errno style error code on failure.
-+
-+ See sd_is_socket_unix(3) for more information.
-+*/
-+int sd_is_socket_unix(int fd, int type, int listening, const char *path, size_t length);
-+
-+/*
-+ Helper call for identifying a passed file descriptor. Returns 1 if
-+ the file descriptor is a POSIX Message Queue of the specified name,
-+ 0 otherwise. If path is NULL a message queue name check is not
-+ done. Returns a negative errno style error code on failure.
-+*/
-+int sd_is_mq(int fd, const char *path);
-+
-+/*
-+ Informs systemd about changed daemon state. This takes a number of
-+ newline separated environment-style variable assignments in a
-+ string. The following variables are known:
-+
-+ READY=1 Tells systemd that daemon startup is finished (only
-+ relevant for services of Type=notify). The passed
-+ argument is a boolean "1" or "0". Since there is
-+ little value in signaling non-readiness the only
-+ value daemons should send is "READY=1".
-+
-+ STATUS=... Passes a single-line status string back to systemd
-+ that describes the daemon state. This is free-from
-+ and can be used for various purposes: general state
-+ feedback, fsck-like programs could pass completion
-+ percentages and failing programs could pass a human
-+ readable error message. Example: "STATUS=Completed
-+ 66% of file system check..."
-+
-+ ERRNO=... If a daemon fails, the errno-style error code,
-+ formatted as string. Example: "ERRNO=2" for ENOENT.
-+
-+ BUSERROR=... If a daemon fails, the D-Bus error-style error
-+ code. Example: "BUSERROR=org.freedesktop.DBus.Error.TimedOut"
-+
-+ MAINPID=... The main pid of a daemon, in case systemd did not
-+ fork off the process itself. Example: "MAINPID=4711"
-+
-+ Daemons can choose to send additional variables. However, it is
-+ recommended to prefix variable names not listed above with X_.
-+
-+ Returns a negative errno-style error code on failure. Returns > 0
-+ if systemd could be notified, 0 if it couldn't possibly because
-+ systemd is not running.
-+
-+ Example: When a daemon finished starting up, it could issue this
-+ call to notify systemd about it:
-+
-+ sd_notify(0, "READY=1");
-+
-+ See sd_notifyf() for more complete examples.
-+
-+ See sd_notify(3) for more information.
-+*/
-+int sd_notify(int unset_environment, const char *state);
-+
-+/*
-+ Similar to sd_notify() but takes a format string.
-+
-+ Example 1: A daemon could send the following after initialization:
-+
-+ sd_notifyf(0, "READY=1\n"
-+ "STATUS=Processing requests...\n"
-+ "MAINPID=%lu",
-+ (unsigned long) getpid());
-+
-+ Example 2: A daemon could send the following shortly before
-+ exiting, on failure:
-+
-+ sd_notifyf(0, "STATUS=Failed to start up: %s\n"
-+ "ERRNO=%i",
-+ strerror(errno),
-+ errno);
-+
-+ See sd_notifyf(3) for more information.
-+*/
-+int sd_notifyf(int unset_environment, const char *format, ...) _sd_printf_attr_(2,3);
-+
-+/*
-+ Returns > 0 if the system was booted with systemd. Returns < 0 on
-+ error. Returns 0 if the system was not booted with systemd. Note
-+ that all of the functions above handle non-systemd boots just
-+ fine. You should NOT protect them with a call to this function. Also
-+ note that this function checks whether the system, not the user
-+ session is controlled by systemd. However the functions above work
-+ for both user and system services.
-+
-+ See sd_booted(3) for more information.
-+*/
-+int sd_booted(void);
-+
-+#ifdef __cplusplus
-+}
-+#endif
-+
-+#endif
diff --git a/net-print/cups/files/cupsd.init.d b/net-print/cups/files/cupsd.init.d
deleted file mode 100644
index e5529ee..0000000
--- a/net-print/cups/files/cupsd.init.d
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/sbin/runscript
-
-depend() {
- use net
- @neededservices@
- before nfs
- after logger
-}
-
-start() {
- ebegin "Starting cupsd"
- start-stop-daemon --start --quiet --exec /usr/sbin/cupsd
- eend $?
-}
-
-stop() {
- ebegin "Stopping cupsd"
- start-stop-daemon --stop --quiet --exec /usr/sbin/cupsd
- eend $?
-}
diff --git a/net-print/cups/files/pdftops-1.20.gentoo b/net-print/cups/files/pdftops-1.20.gentoo
deleted file mode 100644
index 8fdafe3..0000000
--- a/net-print/cups/files/pdftops-1.20.gentoo
+++ /dev/null
@@ -1,340 +0,0 @@
-#!/usr/bin/perl -w
-# pdftops.pl - wrapper script for xpdf's pdftops utility to act as a CUPS filter
-# ==============================================================================
-# 1.00 - 2004-10-05/Bl
-# Initial implementation
-# 1.10 - 2006-09-27/Bl
-# Alternatively, use Adobe Reader in place of Xpdf's pdftops
-# 1.20 - 2007-12-03/Bl
-# Safe temp file creation (fix gentoo bug # 201042)
-#
-# Copyright: Helge Blischke / SRZ Berlin 2004-2006
-# This program is free seoftware and governed by the GNU Public License Version 2.
-#
-# Description:
-# ------------
-# This program wraps the pdftops utility from the xpdf 3.00 (and higher) suite
-# to behave as a CUPS filter as a replacement for the original pdftops filter.
-# As an alternative the Adobe Reader may be used.
-#
-# The main purpose of this approach is to keep the properties of a PDF to be
-# printed as undesturbed as possible, especially with respect to page size,
-# scaling, and positioning.
-#
-# The pdftops utility reads a configuration file 'pdftops.conf' or 'acroread.conf',
-# respectively, in the CUPS_SERVERROOT directory, which must exist but may be empty.
-# The sample configuration file accompanying this program sets the defaults which
-# seem plausible to me with respect to high end production printers.
-#
-# To give the user highest possible flexibility, this program accepts and
-# evaluates a set of job attributes special to this filter, which are
-# described below:
-#
-# pdf-pages=<f>,<l>
-# expands to the -f and -l options of pdftops
-# or the -start and -end options of acroread, respectively
-# to select a page range to process. This is independent
-# of the page-ranges attribute and may significantly
-# increase throughput when printing page ranges.
-# Either of these numbers may be omitted.
-#
-# pdf-paper=<name>
-# For pdftops, <name> may be one of "letter", "legal",
-# "A4", "A3", or "match"; for acroread, the permetted values
-# are "letter", "legal", "tabloid", "ledger", "executive",
-# "a3", "a4", "a5", "b4", "b5", respectively (without the
-# quotes; the names are treated case independent).
-# In case of acroread, no paper specification is equivalent
-# to pdsftops's "match".
-# pdf-paper=<width>x<height>
-# <name> may be one of letter, legal , A4, A3, or match;
-# <width> and <height> are the paper width and height
-# in printers points (1/72 inch). This expands to
-# either the -paper or the -paperh and -paperw options
-# of pdftops or the -size option of acroread.
-#
-# pdf-opw=<password>
-# pdf-upw=<password>
-# expand to the -opw and -upw options of pdftops,
-# respectively and permit printing of password
-# protected PDFs.
-#
-# pdf-<option> where <option> is one of
-# level1, level1sep, level2, level2sep, level3, level3sep,
-# opi, nocrop, expand, noshrink, nocenter.
-# See the pdftops manpage for a detailed description of
-# the respective options.
-# In case of acroread, the options level1, level?sep, opi,
-# nocrop, noshrink, and nocenter are silently ignored.
-#
-# All other pdftops commandline options are refused.
-#
-# The return code of the pdftops utility or acroread, if nonzero, is used as the exit code
-# of this program; error messages of the pdftops utility are only visible
-# if 'debug' is specified as LogLevel in cupsd.conf.
-#
-# NOTE:
-# -----
-# This wrapper script has been initially designed to use the original pdftops utility
-# as a CUPS filter and now extended to alternately use acroread.
-# But there are situations where you need to be able to select either variant, thus it
-# is possible to configure the wrapper to both programs but select one of them by default;
-# the other one then may be selected by command line option:
-#
-# use-pdftops selects pdftops
-# use-acroread selects acroread
-#
-# if both are configured (by defining the appropriate configuration file).
-#
-
-#
-# Site specific parameters - modify as needed
-# ----------------------------------------------------------------------------------
-$pdftops_path = "/usr/bin/pdftops"; # path to the xpdf utility
-$acroread_path = "/opt/bin/acroread"; # path to Adobe Reader
-$default_app = 'use-pdftops'; # the default if both are configured
-$use_pdftops = 1; # default on gentoo and highly recommended
-$use_acroread = 0; # not supported/working on gentoo yet, use at your own risk
-# ----------------------------------------------------------------------------------
-
-use File::Temp qw( tempfile );
-
-#
-# Check which app to use - pdftops or acroread
-#
-$rootdir = $ENV{CUPS_SERVERROOT} || die ("ERROR: CUPS server root directory undefined\n");
-$use_both = $use_pdftops && $use_acroread;
-
-#
-# Check the arguments
-#
-die ("ERROR: wrong number of arguments\n") if (scalar @ARGV < 5);
-
-$jobid = $username = $title = $copies = undef;
-$jobid = shift; # Job ID
-$username = shift; # Job requesting user name
-$title = shift; # Job title
-$copies = shift; # Number of requested copies
-$options = shift; # Textual representation of job attributes
-$pdffile = shift; # Pathname of PDF file to process
-
-if (defined $use_both && $use_both)
-{
- my $optstr = " $options ";
- my $to_use = '';
- if ($optstr =~ /\s+(use-acroread|use-pdftops)\s+/)
- {
- $to_use = $1;
- }
- else
- {
- $to_use = $default_app;
- }
- if ($to_use eq 'use-acroread')
- {
- undef $use_pdftops;
- }
- elsif ($to_use eq 'use-pdftops')
- {
- undef $use_acroread;
- }
- else
- {
- die ("ERROR: cannot use both pdftops and acroread simultaneously\n");
- }
-}
-
-
-if (defined $use_pdftops)
-{
- # If we are reading from STDIN, we must copy the input to a temporary file
- # as the PDF consumer needs a seekable input.
- if (! defined $pdffile)
- {
- my $template = "pdfinXXXXXX";
- my $tmpdir = $ENV{TMPDIR};
- my ($bytes, $buffer);
- my ($tmpfh, $tmpfile) = tempfile ($template, OPEN => 1, DIR => $tmpdir, UNLINK => 0, SUFFIX => '.tmp');
- while (($bytes = read (STDIN, $buffer, 1024)) > 0)
- {
- print $tmpfh "$buffer";
- }
- if ($bytes < 0)
- {
- close ($tmpfh);
- unlink $tmpfile;
- die ("ERROR: pdftops wrapper: $tmpfile: $!\n");
- }
- close ($tmpfh);
- $pdffile = $tmpfile;
- $delete_input = 1; # for deleting the temp file after converting
- }
-}
-
-
-#
-# Check the options string for options to modify the bahaviour of the pdftops utility:
-#
-@optarr = split (/\s+/, $options);
-if (defined $use_pdftops)
-{
- $cmdopt = ""; # do not pass the -cfg argument to the poppler pdftops util
- # The following are the (parameterless) command line options that may be used to change the
- # defaults defiend by pdftops.conf
- $simple = 'level1|level1sep|level2|level2sep|level3|level3sep|opi|nocrop|expand|noshrink|nocenter';
- %papernames = (
- 'letter' => '-paper letter',
- 'tabloid' => '-paperw 792 -paperh 1224',
- 'ledger' => '-paperw 1224 -paperh 792',
- 'legal' => '-paper legal',
- 'executive' => '-paperw 756 -paperh 522',
- 'a3' => '-paper A3',
- 'a4' => '-paper A4',
- 'a5' => '-paperw 421 -paperh 595',
- 'b4' => '-paperw 709 -paperh 1002',
- 'b5' => '-paperw 501 -paperh 709',
- 'match' => '-paper match'
- );
-}
-else
-{
- open (CFG, "<$rootdir/acroread.conf") || die ("ERROR: acroread.conf: $!\n");
- $cmdopt = '-toPostScript';
- while (<CFG>)
- {
- chomp;
- next if (/^\s*#/); # skip comment lines
- next if (/^\s*$/); # skip blank lines
- s/^-\s*//; # discard leading '-' and white space, as it will be generated later
- s/\s+$//; # discard trailing white space
- $cmdopt .= " -$_";
- }
- close (CFG);
- $simple = 'level1|level1sep|level2|level2sep|level3|level3sep|opi|nocrop|expand|noshrink|nocenter';
- %papernames = (
- 'letter' => '-size letter',
- 'tabloid' => '-size tabloid',
- 'ledger' => '-size ledger',
- 'legal' => '-size legal',
- 'executive' => '-size executive',
- 'a3' => '-size a3',
- 'a4' => '-size a4',
- 'a5' => '-size a5',
- 'b4' => '-size b4',
- 'b5' => '-size b5',
- 'match' => '' # this is the default with acroread
- );
-}
-
-foreach my $option (@optarr)
-{
- if ($option =~ /^pdf-(.+)$/)
- { # We assume this is an option to evaluate
- my $optkey = $1; # possible pdftops option
- if ($optkey =~ /^pages=(\d*),(\d*)$/)
- {
- # We do this hack here to avoid clashes with the page-ranges atrribute
- # which is handled by the pstops filter. And we allow one of the numbers
- # to be omitted.
- my $first = $1;
- my $lastp = $2;
- if (defined $use_pdftops)
- {
- $cmdopt .= " -f $1" if ($1); # first page
- $cmdopt .= " -l $2" if ($2); # last page
- }
- else
- {
- $cmdopt .= " -start $1" if ($1); # first page
- $cmdopt .= " -end $2" if ($2); # last page
- }
- }
- elsif ($optkey =~ /^paper=(letter|tabloid|ledger|legal|[Aa]3|[Aa]4|[Aa]5|[Bb]4|[Bb]5|match)$/)
- {
- # evaluate paper name
- my $paper = $1;
- $paper =~ tr/A-Z/a-z/;
- my $value = $papernames{$paper};
- $cmdopt .= " $value" if ($value);
- }
- elsif ($optkey =~ /^paper=(\d+)x(\d+)$/)
- {
- # evaluate paper dimensions
- if (defined $use_pdftops)
- {
- $cmdopt .= " -paperw $1 -paperh $2";
- }
- else
- {
- $cmdopt .= " -size $1" . 'x' . "$2";
- }
- }
- elsif ($optkey =~ /^(o|u)pw=(\S+)$/)
- {
- $cmdopt .= " $1" . 'pw ' . $2 if (defined $use_pdftops); # owner/user password
- }
- elsif ($optkey =~ /^($simple)$/)
- {
- my $thisopt = $1;
- if (defined $use_pdftops)
- {
- $cmdopt .= ' -' . $1; # allowed simple options
- }
- else
- {
- $thisopt =~ s/sep$//; # ignore the ...sep suffix
- if ($thisopt =~ /level1|opi|nocrop|nocenter/)
- {
- $thisopt = '';
- }
- elsif ($thisopt eq 'noshrink')
- {
- $thisopt = '';
- $cmdopt =~ s/ -shrink//;
- }
- $cmdopt .= " -" . $thisopt if ($thisopt);
- }
- }
- else
- {
- warn ("ERROR: pdftops wrapper: illegal attribute \"pdf-$optkey\"\n");
- }
- }
- # All other attributes are processed elsewhere
-}
-#
-# Complete the command
-#
-if (defined $use_pdftops)
-{
- warn ("ERROR: pdftops-options: $cmdopt\n");
-}
-else
-{
- warn ("ERROR: acroread-options: $cmdopt\n");
-}
-if (defined $use_pdftops)
-{
- $rc = system ("$pdftops_path $cmdopt $pdffile -");
-}
-else
-{
- if (defined $pdffile && $pdffile)
- {
- $rc = system ("$acroread_path $cmdopt < $pdffile")
- }
- else
- {
- $rc = system ("$acroread_path $cmdopt");
- }
-}
-if ($rc)
-{
- $ir = $rc & 127;
- $rc >>= 8;
- my $temp = (defined $use_pdftops) ? $pdftops_path : $acroread_path;
- warn ("ERROR: $temp exited with ", ($ir) ? "signal $ir, " : " exit code $rc", "\n");
- exit $rc;
-}
-unlink ($pdffile) if (defined $delete_input); # Delete the temp file if any
-exit 0;