parent
b3d4d653d3
commit
b8edca8063
@ -0,0 +1,14 @@
|
||||
AUX cups-1.4.0-backend-https.patch 483 RMD160 b338f67ebf0719b5e12eaa8490affbd7a1bb8c0e SHA1 bfeadba67792203d654a64bdec16f3d2a31aeca6 SHA256 9060a5d848d6655db4629822d01fd772a3fbe1a5107109c50cb0ecb4de7a9526
|
||||
AUX cups-1.4.2-str3200.patch 1654 RMD160 cc40d26f7e9dbe5a12d9426535d09de10254da26 SHA1 b330108bcfb8ca3ab5d6dd3b48dc3d2937c7bca1 SHA256 8a64f5c72d64ecd95d330fd90630eb02a67865c07921ecb0c010e84b49b537e0
|
||||
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.6-force-gnutls.patch 3319 RMD160 c6cc024a702305eb81661d5cdadd9857e9a6778e SHA1 5ac62ed3ca20bc7a4541c990c676c433299b2177 SHA256 beb4014eac5218d9f424b81946ac1e209625026bf20a7f4820758e5ee1fe5b66
|
||||
AUX cups-1.4.6-serialize-gnutls.patch 3625 RMD160 873b2806cfec732c4a4f3f2981f666a958dd5b0e SHA1 aae046121d0139fbba1cb9147c8742f73b2f1fa0 SHA256 6bc9e16fc6865b2f3e0ee2d1947bdde691e41f90fce32b9839b3661dcea4a827
|
||||
AUX cups-1.4.6-web-hang.patch 1749 RMD160 ff8d4cfa10a5de5a911c8672313904f50b13fd0f SHA1 f37a3fb7d71a6d56bbb3e5e7a8cf74ca8cb19276 SHA256 f49cef2ce1f2eecdd8ee07d85f306a19375f6d48510763aa51e96a0c54ad27c5
|
||||
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.4.6-source.tar.bz2 4517061 RMD160 94c9921e03f5ec52d9c16947435622365f53aef6 SHA1 42fb1ca00ee7291561564d3072716eb2045f05d1 SHA256 f08711702a77b52c7150f96fe1f45482f6151cb95ef601268c528607fe6ad514
|
||||
EBUILD cups-1.4.6-r2.ebuild 6811 RMD160 b6a02ab7931559e1d5f056850cb5ac3a2f2cc491 SHA1 3cfcf58734f10933ea9353011bd6e72d2674824e SHA256 dcf41190069014f9e68b31d169f060af64afdfb67dcc1e190bdcb2becd6b3668
|
@ -0,0 +1,252 @@
|
||||
# Copyright 1999-2011 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header: /var/cvsroot/gentoo-x86/net-print/cups/cups-1.4.6-r1.ebuild,v 1.4 2011/05/01 15:15:04 scarabeus Exp $
|
||||
|
||||
EAPI=3
|
||||
|
||||
PYTHON_DEPEND="python? 2:2.5"
|
||||
|
||||
inherit autotools eutils flag-o-matic linux-info multilib pam perl-module python versionator java-pkg-opt-2
|
||||
|
||||
MY_P=${P/_}
|
||||
|
||||
DESCRIPTION="The Common Unix Printing System"
|
||||
HOMEPAGE="http://www.cups.org/"
|
||||
SRC_URI="mirror://easysw/${PN}/${PV}/${MY_P}-source.tar.bz2"
|
||||
|
||||
LICENSE="GPL-2"
|
||||
SLOT="0"
|
||||
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~sparc-fbsd ~x86 ~x86-fbsd"
|
||||
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
|
||||
)
|
||||
!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() {
|
||||
# create a missing symlink to allow https printing via IPP, bug #217293
|
||||
epatch "${FILESDIR}/${PN}-1.4.0-backend-https.patch"
|
||||
# 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.6-force-gnutls.patch"
|
||||
epatch "${FILESDIR}/${PN}-1.4.6-serialize-gnutls.patch"
|
||||
# interface hangs using some browsers, bug #325871
|
||||
epatch "${FILESDIR}/${PN}-1.4.6-web-hang.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
|
||||
|
||||
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 threads) \
|
||||
$(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 \
|
||||
${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}
|
||||
|
||||
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
|
||||
|
||||
if use usb; then
|
||||
elog
|
||||
elog "You are going to use new libusb backed to access your usb printer."
|
||||
elog "This interface has quite few known issues and does not report all"
|
||||
elog "issues and just refuses to print."
|
||||
elog "Please consider disabling usb useflag if you are having issues."
|
||||
elog
|
||||
elog "Please note that if you disable the usb useflag your device will be"
|
||||
elog "still working using kernel usblp interface instead of libusb."
|
||||
fi
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
diff -Naur cups-1.4.0/backend/Makefile cups-1.4.0.new/backend/Makefile
|
||||
--- cups-1.4.0/backend/Makefile 2009-03-03 20:39:21.000000000 +0100
|
||||
+++ cups-1.4.0.new/backend/Makefile 2009-09-01 14:00:05.592615359 +0200
|
||||
@@ -91,6 +91,7 @@
|
||||
done
|
||||
$(RM) $(SERVERBIN)/backend/http
|
||||
$(LN) ipp $(SERVERBIN)/backend/http
|
||||
+ $(LN) ipp $(SERVERBIN)/backend/https
|
||||
if test "x$(DNSSD_BACKEND)" != x; then \
|
||||
$(RM) $(SERVERBIN)/backend/mdns; \
|
||||
$(LN) $(DNSSD_BACKEND) $(SERVERBIN)/backend/mdns; \
|
@ -0,0 +1,43 @@
|
||||
Index: scheduler/select.c
|
||||
===================================================================
|
||||
--- scheduler/select.c (revision 8887)
|
||||
+++ scheduler/select.c (working copy)
|
||||
@@ -454,7 +454,7 @@
|
||||
if (fdptr->read_cb && event->filter == EVFILT_READ)
|
||||
(*(fdptr->read_cb))(fdptr->data);
|
||||
|
||||
- if (fdptr->write_cb && event->filter == EVFILT_WRITE)
|
||||
+ if (fdptr->use > 1 && fdptr->write_cb && event->filter == EVFILT_WRITE)
|
||||
(*(fdptr->write_cb))(fdptr->data);
|
||||
|
||||
release_fd(fdptr);
|
||||
@@ -499,7 +499,8 @@
|
||||
if (fdptr->read_cb && (event->events & (EPOLLIN | EPOLLERR | EPOLLHUP)))
|
||||
(*(fdptr->read_cb))(fdptr->data);
|
||||
|
||||
- if (fdptr->write_cb && (event->events & (EPOLLOUT | EPOLLERR | EPOLLHUP)))
|
||||
+ if (fdptr->use > 1 && fdptr->write_cb &&
|
||||
+ (event->events & (EPOLLOUT | EPOLLERR | EPOLLHUP)))
|
||||
(*(fdptr->write_cb))(fdptr->data);
|
||||
|
||||
release_fd(fdptr);
|
||||
@@ -590,7 +591,8 @@
|
||||
if (fdptr->read_cb && (pfd->revents & (POLLIN | POLLERR | POLLHUP)))
|
||||
(*(fdptr->read_cb))(fdptr->data);
|
||||
|
||||
- if (fdptr->write_cb && (pfd->revents & (POLLOUT | POLLERR | POLLHUP)))
|
||||
+ if (fdptr->use > 1 && fdptr->write_cb &&
|
||||
+ (pfd->revents & (POLLOUT | POLLERR | POLLHUP)))
|
||||
(*(fdptr->write_cb))(fdptr->data);
|
||||
|
||||
release_fd(fdptr);
|
||||
@@ -645,7 +647,8 @@
|
||||
if (fdptr->read_cb && FD_ISSET(fdptr->fd, &cupsd_current_input))
|
||||
(*(fdptr->read_cb))(fdptr->data);
|
||||
|
||||
- if (fdptr->write_cb && FD_ISSET(fdptr->fd, &cupsd_current_output))
|
||||
+ if (fdptr->use > 1 && fdptr->write_cb &&
|
||||
+ FD_ISSET(fdptr->fd, &cupsd_current_output))
|
||||
(*(fdptr->write_cb))(fdptr->data);
|
||||
|
||||
release_fd(fdptr);
|
@ -0,0 +1,20 @@
|
||||
# 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
|
||||
;;
|
||||
*)
|
@ -0,0 +1,22 @@
|
||||
# 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...
|
@ -0,0 +1,14 @@
|
||||
# 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
|
@ -0,0 +1,12 @@
|
||||
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
|
||||
);
|
@ -0,0 +1,21 @@
|
||||
# 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
|
||||
|
||||
|
@ -0,0 +1,93 @@
|
||||
Source: http://pkgs.fedoraproject.org/gitweb/?p=cups.git;a=blob;f=cups-force-gnutls.patch;h=85adaa8bdcc013e5401fffe74306a5fe644cf088;hb=HEAD
|
||||
Reason: Force the use of gnutls despite thread-safety concerns (Gentoo bug #350406)
|
||||
Upstream: http://cups.org/str.php?L3605
|
||||
|
||||
diff -up cups-1.4.4/config-scripts/cups-ssl.m4.force-gnutls cups-1.4.4/config-scripts/cups-ssl.m4
|
||||
--- cups-1.4.4/config-scripts/cups-ssl.m4.force-gnutls 2010-09-15 16:49:22.343502552 +0100
|
||||
+++ cups-1.4.4/config-scripts/cups-ssl.m4 2010-09-15 16:49:42.347502595 +0100
|
||||
@@ -65,23 +65,21 @@ if test x$enable_ssl != xno; then
|
||||
if $PKGCONFIG --exists gnutls; then
|
||||
if test "x$have_pthread" = xyes; then
|
||||
AC_MSG_WARN([The current version of GNU TLS cannot be made thread-safe.])
|
||||
- else
|
||||
- have_ssl=1
|
||||
- SSLLIBS=`$PKGCONFIG --libs gnutls`
|
||||
- SSLFLAGS=`$PKGCONFIG --cflags gnutls`
|
||||
- AC_DEFINE(HAVE_SSL)
|
||||
- AC_DEFINE(HAVE_GNUTLS)
|
||||
fi
|
||||
+ have_ssl=1
|
||||
+ SSLLIBS=`$PKGCONFIG --libs gnutls`
|
||||
+ SSLFLAGS=`$PKGCONFIG --cflags gnutls`
|
||||
+ AC_DEFINE(HAVE_SSL)
|
||||
+ AC_DEFINE(HAVE_GNUTLS)
|
||||
elif test "x$LIBGNUTLSCONFIG" != x; then
|
||||
if test "x$have_pthread" = xyes; then
|
||||
AC_MSG_WARN([The current version of GNU TLS cannot be made thread-safe.])
|
||||
- else
|
||||
- have_ssl=1
|
||||
- SSLLIBS=`$LIBGNUTLSCONFIG --libs`
|
||||
- SSLFLAGS=`$LIBGNUTLSCONFIG --cflags`
|
||||
- AC_DEFINE(HAVE_SSL)
|
||||
- AC_DEFINE(HAVE_GNUTLS)
|
||||
fi
|
||||
+ have_ssl=1
|
||||
+ SSLLIBS=`$LIBGNUTLSCONFIG --libs`
|
||||
+ SSLFLAGS=`$LIBGNUTLSCONFIG --cflags`
|
||||
+ AC_DEFINE(HAVE_SSL)
|
||||
+ AC_DEFINE(HAVE_GNUTLS)
|
||||
fi
|
||||
|
||||
if test $have_ssl = 1; then
|
||||
diff -up cups-1.4.4/configure.force-gnutls cups-1.4.4/configure
|
||||
--- cups-1.4.4/configure.force-gnutls 2010-06-17 19:25:47.000000000 +0100
|
||||
+++ cups-1.4.4/configure 2010-09-15 16:50:01.689503165 +0100
|
||||
@@ -17542,36 +17542,34 @@ fi
|
||||
if test "x$have_pthread" = xyes; then
|
||||
{ echo "$as_me:$LINENO: WARNING: The current version of GNU TLS cannot be made thread-safe." >&5
|
||||
echo "$as_me: WARNING: The current version of GNU TLS cannot be made thread-safe." >&2;}
|
||||
- else
|
||||
- have_ssl=1
|
||||
- SSLLIBS=`$PKGCONFIG --libs gnutls`
|
||||
- SSLFLAGS=`$PKGCONFIG --cflags gnutls`
|
||||
- cat >>confdefs.h <<\_ACEOF
|
||||
+ fi
|
||||
+ have_ssl=1
|
||||
+ SSLLIBS=`$PKGCONFIG --libs gnutls`
|
||||
+ SSLFLAGS=`$PKGCONFIG --cflags gnutls`
|
||||
+ cat >>confdefs.h <<\_ACEOF
|
||||
#define HAVE_SSL 1
|
||||
_ACEOF
|
||||
|
||||
- cat >>confdefs.h <<\_ACEOF
|
||||
+ cat >>confdefs.h <<\_ACEOF
|
||||
#define HAVE_GNUTLS 1
|
||||
_ACEOF
|
||||
|
||||
- fi
|
||||
elif test "x$LIBGNUTLSCONFIG" != x; then
|
||||
if test "x$have_pthread" = xyes; then
|
||||
{ echo "$as_me:$LINENO: WARNING: The current version of GNU TLS cannot be made thread-safe." >&5
|
||||
echo "$as_me: WARNING: The current version of GNU TLS cannot be made thread-safe." >&2;}
|
||||
- else
|
||||
- have_ssl=1
|
||||
- SSLLIBS=`$LIBGNUTLSCONFIG --libs`
|
||||
- SSLFLAGS=`$LIBGNUTLSCONFIG --cflags`
|
||||
- cat >>confdefs.h <<\_ACEOF
|
||||
+ fi
|
||||
+ have_ssl=1
|
||||
+ SSLLIBS=`$LIBGNUTLSCONFIG --libs`
|
||||
+ SSLFLAGS=`$LIBGNUTLSCONFIG --cflags`
|
||||
+ cat >>confdefs.h <<\_ACEOF
|
||||
#define HAVE_SSL 1
|
||||
_ACEOF
|
||||
|
||||
- cat >>confdefs.h <<\_ACEOF
|
||||
+ cat >>confdefs.h <<\_ACEOF
|
||||
#define HAVE_GNUTLS 1
|
||||
_ACEOF
|
||||
|
||||
- fi
|
||||
fi
|
||||
|
||||
if test $have_ssl = 1; then
|
@ -0,0 +1,113 @@
|
||||
Source: http://pkgs.fedoraproject.org/gitweb/?p=cups.git;a=blob;f=cups-serialize-gnutls.patch;h=cdd82cb95574801bf714364a585e31eb05191750;hb=HEAD
|
||||
Reason: Perform locking for gnutls and avoid libgcrypt's broken locking (Gentoo bug #350406)
|
||||
Upstream: http://cups.org/str.php?L3605
|
||||
|
||||
diff -up cups-1.4.4/cups/http.c.serialize-gnutls cups-1.4.4/cups/http.c
|
||||
--- cups-1.4.4/cups/http.c.serialize-gnutls 2010-09-17 13:37:01.858871762 +0100
|
||||
+++ cups-1.4.4/cups/http.c 2010-09-17 13:55:22.579871934 +0100
|
||||
@@ -149,7 +149,7 @@ static int http_write_ssl(http_t *http,
|
||||
|
||||
# ifdef HAVE_GNUTLS
|
||||
# ifdef HAVE_PTHREAD_H
|
||||
-GCRY_THREAD_OPTION_PTHREAD_IMPL;
|
||||
+static pthread_mutex_t gnutls_lock;
|
||||
# endif /* HAVE_PTHREAD_H */
|
||||
|
||||
# elif defined(HAVE_LIBSSL) && defined(HAVE_PTHREAD_H)
|
||||
@@ -1231,7 +1231,7 @@ httpInitialize(void)
|
||||
*/
|
||||
|
||||
# ifdef HAVE_PTHREAD_H
|
||||
- gcry_control(GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);
|
||||
+ pthread_mutex_init(&gnutls_lock, NULL);
|
||||
# endif /* HAVE_PTHREAD_H */
|
||||
|
||||
/*
|
||||
@@ -2228,6 +2228,7 @@ _httpWait(http_t *http, /* I - Connect
|
||||
if (SSL_pending((SSL *)(http->tls)))
|
||||
return (1);
|
||||
# elif defined(HAVE_GNUTLS)
|
||||
+ /* lock already held here... */
|
||||
if (gnutls_record_check_pending(((http_tls_t *)(http->tls))->session))
|
||||
return (1);
|
||||
# elif defined(HAVE_CDSASSL)
|
||||
@@ -2294,6 +2295,8 @@ int /* O - 1 if data is available, 0
|
||||
httpWait(http_t *http, /* I - Connection to server */
|
||||
int msec) /* I - Milliseconds to wait */
|
||||
{
|
||||
+ int ret;
|
||||
+
|
||||
/*
|
||||
* First see if there is data in the buffer...
|
||||
*/
|
||||
@@ -2318,7 +2321,17 @@ httpWait(http_t *http, /* I - Connecti
|
||||
* If not, check the SSL/TLS buffers and do a select() on the connection...
|
||||
*/
|
||||
|
||||
- return (_httpWait(http, msec, 1));
|
||||
+#if defined(HAVE_SSL) && defined(HAVE_GNUTLS) && defined(HAVE_PTHREAD_H)
|
||||
+ pthread_mutex_lock(&gnutls_lock);
|
||||
+#endif
|
||||
+
|
||||
+ ret = _httpWait(http, msec, 1);
|
||||
+
|
||||
+#if defined(HAVE_SSL) && defined(HAVE_GNUTLS) && defined(HAVE_PTHREAD_H)
|
||||
+ pthread_mutex_unlock(&gnutls_lock);
|
||||
+#endif
|
||||
+
|
||||
+ return (ret);
|
||||
}
|
||||
|
||||
|
||||
@@ -2769,7 +2782,9 @@ http_read_ssl(http_t *http, /* I - Conn
|
||||
ssize_t result; /* Return value */
|
||||
|
||||
|
||||
+ pthread_mutex_lock(&gnutls_lock);
|
||||
result = gnutls_record_recv(((http_tls_t *)(http->tls))->session, buf, len);
|
||||
+ pthread_mutex_unlock(&gnutls_lock);
|
||||
|
||||
if (result < 0 && !errno)
|
||||
{
|
||||
@@ -3085,6 +3100,7 @@ http_setup_ssl(http_t *http) /* I - Con
|
||||
return (-1);
|
||||
}
|
||||
|
||||
+ pthread_mutex_lock(&gnutls_lock);
|
||||
gnutls_certificate_allocate_credentials(credentials);
|
||||
|
||||
gnutls_init(&(conn->session), GNUTLS_CLIENT);
|
||||
@@ -3104,9 +3120,11 @@ http_setup_ssl(http_t *http) /* I - Con
|
||||
free(credentials);
|
||||
free(conn);
|
||||
|
||||
+ pthread_mutex_unlock(&gnutls_lock);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
+ pthread_mutex_unlock(&gnutls_lock);
|
||||
conn->credentials = credentials;
|
||||
|
||||
# elif defined(HAVE_CDSASSL)
|
||||
@@ -3196,9 +3214,11 @@ http_shutdown_ssl(http_t *http) /* I -
|
||||
conn = (http_tls_t *)(http->tls);
|
||||
credentials = (gnutls_certificate_client_credentials *)(conn->credentials);
|
||||
|
||||
+ pthread_mutex_lock(&gnutls_lock);
|
||||
gnutls_bye(conn->session, GNUTLS_SHUT_RDWR);
|
||||
gnutls_deinit(conn->session);
|
||||
gnutls_certificate_free_credentials(*credentials);
|
||||
+ pthread_mutex_unlock(&gnutls_lock);
|
||||
free(credentials);
|
||||
free(conn);
|
||||
|
||||
@@ -3445,7 +3465,9 @@ http_write_ssl(http_t *http, /* I -
|
||||
# elif defined(HAVE_GNUTLS)
|
||||
ssize_t result; /* Return value */
|
||||
|
||||
+ pthread_mutex_lock(&gnutls_lock);
|
||||
result = gnutls_record_send(((http_tls_t *)(http->tls))->session, buf, len);
|
||||
+ pthread_mutex_unlock(&gnutls_lock);
|
||||
|
||||
if (result < 0 && !errno)
|
||||
{
|
@ -0,0 +1,54 @@
|
||||
Index: cgi-bin/html.c
|
||||
===================================================================
|
||||
--- cgi-bin/html.c (revision 9428)
|
||||
+++ cgi-bin/html.c (working copy)
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
* "$Id: cups-1.4.6-web-hang.patch,v 1.1 2011/04/30 15:39:45 scarabeus Exp $"
|
||||
*
|
||||
- * HTML support functions for the Common UNIX Printing System (CUPS).
|
||||
+ * HTML support functions for CUPS.
|
||||
*
|
||||
- * Copyright 2007-2009 by Apple Inc.
|
||||
+ * Copyright 2007-2011 by Apple Inc.
|
||||
* Copyright 1997-2006 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
@@ -208,31 +208,13 @@
|
||||
int /* O - 1 if multi-part supported, 0 otherwise */
|
||||
cgiSupportsMultipart(void)
|
||||
{
|
||||
- const char *user_agent; /* User-Agent string */
|
||||
- static int supports_multipart = -1;/* Cached value */
|
||||
+ /*
|
||||
+ * Too many bug reports for browsers that don't support it, and too much pain
|
||||
+ * to whitelist known-good browsers, so for now we just punt on multi-part
|
||||
+ * support... :(
|
||||
+ */
|
||||
|
||||
-
|
||||
- if (supports_multipart < 0)
|
||||
- {
|
||||
- /*
|
||||
- * CUPS STR #3049: Apparently some browsers don't support multi-part
|
||||
- * documents, which makes them useless for many web sites. Rather than
|
||||
- * abandoning those users, we'll offer a degraded single-part mode...
|
||||
- *
|
||||
- * Currently we know that anything based on Gecko, MSIE, and Safari all
|
||||
- * work. We'll add more as they are reported/tested.
|
||||
- */
|
||||
-
|
||||
- if ((user_agent = getenv("HTTP_USER_AGENT")) != NULL &&
|
||||
- (strstr(user_agent, " Gecko/") != NULL ||
|
||||
- strstr(user_agent, " MSIE ") != NULL ||
|
||||
- strstr(user_agent, " Safari/") != NULL))
|
||||
- supports_multipart = 1;
|
||||
- else
|
||||
- supports_multipart = 0;
|
||||
- }
|
||||
-
|
||||
- return (supports_multipart);
|
||||
+ return (0);
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,20 @@
|
||||
#!/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 $?
|
||||
}
|
@ -0,0 +1,340 @@
|
||||
#!/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;
|
Loading…
Reference in new issue