1 # Copyright 1999-2009 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/net-print/cups/cups-1.4.2-r1.ebuild,v 1.1 2009/11/30 22:00:56 tgurr Exp $
7 inherit eutils flag-o-matic multilib pam versionator
11 DESCRIPTION="The Common Unix Printing System."
12 HOMEPAGE="http://www.cups.org/"
13 SRC_URI="mirror://easysw/${PN}/${PV}/${MY_P}-source.tar.bz2"
17 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~sparc-fbsd ~x86 ~x86-fbsd"
18 IUSE="acl dbus debug gnutls java +jpeg kerberos ldap pam perl php +png python samba slp +ssl static +tiff X xinetd"
20 COMMON_DEPEND="acl? ( kernel_linux? ( sys-apps/acl sys-apps/attr ) )
21 dbus? ( sys-apps/dbus )
22 gnutls? ( net-libs/gnutls )
23 java? ( >=virtual/jre-1.4 )
24 jpeg? ( >=media-libs/jpeg-6b )
25 kerberos? ( virtual/krb5 )
26 ldap? ( net-nds/openldap )
28 perl? ( dev-lang/perl )
30 png? ( >=media-libs/libpng-1.2.1 )
31 python? ( dev-lang/python )
32 slp? ( >=net-libs/openslp-1.0.4 )
33 ssl? ( !gnutls? ( >=dev-libs/openssl-0.9.8g ) )
34 tiff? ( >=media-libs/tiff-3.5.5 )
35 xinetd? ( sys-apps/xinetd )
42 DEPEND="${COMMON_DEPEND}"
44 RDEPEND="${COMMON_DEPEND}
46 X? ( x11-misc/xdg-utils )"
48 PDEPEND="|| ( app-text/ghostscript-gpl[cups] app-text/ghostscript-gnu[cups] )"
52 # upstream includes an interactive test which is a nono for gentoo.
53 # therefore, since the printing herd has bigger fish to fry, for now,
54 # we just leave it out, even if FEATURES=test
57 S="${WORKDIR}/${MY_P}"
59 LANGS="da de es eu fi fr it ja ko nl no pl pt pt_BR ru sv zh zh_TW"
60 for X in ${LANGS} ; do
61 IUSE="${IUSE} linguas_${X}"
66 enewuser lp -1 -1 -1 lp
71 # create a missing symlink to allow https printing via IPP, bug #217293
72 epatch "${FILESDIR}/${PN}-1.4.0-backend-https.patch"
74 # CVE-2009-3553: Use-after-free (crash) due improper reference counting
75 # in abstract file descriptors handling interface
76 # upstream bug STR #3200
77 epatch "${FILESDIR}/${PN}-1.4.2-str3200.patch"
82 strip-linguas ${LANGS}
83 if [ -z "${LINGUAS}" ] ; then
88 if use ssl || use gnutls ; then
90 $(use_enable gnutls) \
91 $(use_enable !gnutls openssl)"
99 --libdir=/usr/$(get_libdir) \
100 --localstatedir=/var \
101 --with-cups-user=lp \
102 --with-cups-group=lp \
103 --with-docdir=/usr/share/cups/html \
104 --with-languages="${LINGUAS}" \
105 --with-pdftops=pdftops \
106 --with-system-groups=lpadmin \
109 $(use_enable debug) \
110 $(use_enable debug debug-guards) \
112 $(use_enable kerberos gssapi) \
117 $(use_enable static) \
119 $(use_enable xinetd xinetd /etc/xinetd.d) \
131 # install in /usr/libexec always, instead of using /usr/lib/cups, as that
132 # makes more sense when facing multilib support.
133 sed -i -e 's:SERVERBIN.*:SERVERBIN = "$(BUILDROOT)"/usr/libexec/cups:' Makedefs
134 sed -i -e 's:#define CUPS_SERVERBIN.*:#define CUPS_SERVERBIN "/usr/libexec/cups":' config.h
135 sed -i -e 's:cups_serverbin=.*:cups_serverbin=/usr/libexec/cups:' cups-config
139 emake BUILDROOT="${D}" install || die "emake install failed"
140 dodoc {CHANGES,CREDITS,README}.txt || die "dodoc install failed"
142 # clean out cups init scripts
143 rm -rf "${D}"/etc/{init.d/cups,rc*,pam.d/cups}
145 # install our init script
147 use dbus && neededservices="$neededservices dbus"
148 [[ -n ${neededservices} ]] && neededservices="need${neededservices}"
149 sed -e "s/@neededservices@/$neededservices/" "${FILESDIR}"/cupsd.init.d > "${T}"/cupsd
150 doinitd "${T}"/cupsd || die "doinitd failed"
152 # install our pam script
153 pamd_mimic_system cups auth account
157 sed -i -e "s:server = .*:server = /usr/libexec/cups/daemon/cups-lpd:" "${D}"/etc/xinetd.d/cups-lpd
158 # it is safer to disable this by default, bug #137130
159 grep -w 'disable' "${D}"/etc/xinetd.d/cups-lpd || \
160 sed -i -e "s:}:\tdisable = yes\n}:" "${D}"/etc/xinetd.d/cups-lpd
162 rm -rf "${D}"/etc/xinetd.d
165 keepdir /usr/libexec/cups/driver /usr/share/cups/{model,profiles} \
166 /var/cache/cups /var/cache/cups/rss /var/log/cups /var/run/cups/certs \
169 keepdir /etc/cups/{interfaces,ppd,ssl}
171 use X || rm -r "${D}"/usr/share/applications
173 # create /etc/cups/client.conf, bug #196967 and #266678
174 echo "ServerName /var/run/cups/cups.sock" >> "${D}"/etc/cups/client.conf
179 elog "For information about installing a printer and general cups setup"
180 elog "take a look at: http://www.gentoo.org/doc/en/printing-howto.xml"