| 1 |
# Copyright 1999-2012 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.5.2-r21.ebuild,v 1.5 2012/06/01 04:19:51 zmedico Exp $
|
| 4 |
|
| 5 |
EAPI=4
|
| 6 |
|
| 7 |
PYTHON_DEPEND="python? 2:2.5"
|
| 8 |
|
| 9 |
inherit autotools base fdo-mime gnome2-utils flag-o-matic linux-info multilib pam perl-module python user versionator java-pkg-opt-2 systemd
|
| 10 |
|
| 11 |
MY_P=${P/_}
|
| 12 |
MY_PV=${PV/_}
|
| 13 |
|
| 14 |
if [[ "${PV}" != "9999" ]]; then
|
| 15 |
SRC_URI="mirror://easysw/${PN}/${MY_PV}/${MY_P}-source.tar.bz2
|
| 16 |
http://dev.gentoo.org/~dilfridge/distfiles/${P}-ipp-r8950.patch.bz2
|
| 17 |
http://dev.gentoo.org/~dilfridge/distfiles/${P}-avahi.patch.bz2
|
| 18 |
http://dev.gentoo.org/~dilfridge/distfiles/${P}-locales.patch.xz
|
| 19 |
"
|
| 20 |
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~ppc ~s390 ~sh ~sparc ~x86 ~amd64-fbsd"
|
| 21 |
else
|
| 22 |
inherit subversion
|
| 23 |
ESVN_REPO_URI="http://svn.easysw.com/public/cups/trunk"
|
| 24 |
KEYWORDS=""
|
| 25 |
fi
|
| 26 |
|
| 27 |
DESCRIPTION="The Common Unix Printing System"
|
| 28 |
HOMEPAGE="http://www.cups.org/"
|
| 29 |
|
| 30 |
LICENSE="GPL-2"
|
| 31 |
SLOT="0"
|
| 32 |
IUSE="acl avahi dbus debug +filters gnutls java +jpeg kerberos ldap pam perl
|
| 33 |
+png python slp +ssl static-libs systemd +threads +tiff usb X xinetd"
|
| 34 |
|
| 35 |
LANGS="da de es eu fi fr id it ja ko nl no pl pt pt_BR ru sv zh zh_TW"
|
| 36 |
for X in ${LANGS} ; do
|
| 37 |
IUSE="${IUSE} linguas_${X}"
|
| 38 |
done
|
| 39 |
|
| 40 |
RDEPEND="
|
| 41 |
app-text/libpaper
|
| 42 |
acl? (
|
| 43 |
kernel_linux? (
|
| 44 |
sys-apps/acl
|
| 45 |
sys-apps/attr
|
| 46 |
)
|
| 47 |
)
|
| 48 |
avahi? ( net-dns/avahi )
|
| 49 |
dbus? ( sys-apps/dbus )
|
| 50 |
java? ( >=virtual/jre-1.6 )
|
| 51 |
jpeg? ( virtual/jpeg:0 )
|
| 52 |
kerberos? ( virtual/krb5 )
|
| 53 |
ldap? ( net-nds/openldap[ssl?,gnutls?] )
|
| 54 |
pam? ( virtual/pam )
|
| 55 |
perl? ( dev-lang/perl )
|
| 56 |
png? ( >=media-libs/libpng-1.4.3:0 )
|
| 57 |
slp? ( >=net-libs/openslp-1.0.4 )
|
| 58 |
ssl? (
|
| 59 |
gnutls? (
|
| 60 |
dev-libs/libgcrypt
|
| 61 |
net-libs/gnutls
|
| 62 |
)
|
| 63 |
!gnutls? ( >=dev-libs/openssl-0.9.8g )
|
| 64 |
)
|
| 65 |
systemd? ( sys-apps/systemd )
|
| 66 |
tiff? ( >=media-libs/tiff-3.5.5:0 )
|
| 67 |
usb? ( virtual/libusb:0 )
|
| 68 |
X? ( x11-misc/xdg-utils )
|
| 69 |
xinetd? ( sys-apps/xinetd )
|
| 70 |
"
|
| 71 |
|
| 72 |
DEPEND="${RDEPEND}
|
| 73 |
virtual/pkgconfig
|
| 74 |
"
|
| 75 |
|
| 76 |
PDEPEND="
|
| 77 |
app-text/ghostscript-gpl[cups]
|
| 78 |
>=app-text/poppler-0.12.3-r3[utils]
|
| 79 |
filters? ( net-print/foomatic-filters )
|
| 80 |
"
|
| 81 |
|
| 82 |
REQUIRED_USE="gnutls? ( ssl )"
|
| 83 |
|
| 84 |
# upstream includes an interactive test which is a nono for gentoo
|
| 85 |
RESTRICT="test"
|
| 86 |
|
| 87 |
S="${WORKDIR}/${MY_P}"
|
| 88 |
|
| 89 |
PATCHES=(
|
| 90 |
"${FILESDIR}/${PN}-1.4.4-dont-compress-manpages.patch"
|
| 91 |
"${FILESDIR}/${PN}-1.4.4-fix-install-perms.patch"
|
| 92 |
"${FILESDIR}/${PN}-1.4.4-nostrip.patch"
|
| 93 |
"${FILESDIR}/${PN}-1.4.4-php-destdir.patch"
|
| 94 |
"${FILESDIR}/${PN}-1.4.4-perl-includes.patch"
|
| 95 |
"${FILESDIR}/${PN}-1.5.2-linkperl.patch"
|
| 96 |
"${FILESDIR}/${PN}-1.5.2-threads.patch"
|
| 97 |
"${FILESDIR}/${PN}-1.5.2-threads2.patch"
|
| 98 |
"${FILESDIR}/${PN}-1.5.0-systemd-socket.patch" # systemd support
|
| 99 |
"${WORKDIR}/${PN}-1.5.2-ipp-r8950.patch" # revert ipp backend to 1.4 state
|
| 100 |
"${WORKDIR}/${PN}-1.5.2-avahi.patch" # avahi support from debian
|
| 101 |
"${FILESDIR}/${PN}-1.5.2-browsing.patch" # browsing off by default
|
| 102 |
"${WORKDIR}/${PN}-1.5.2-locales.patch" # patch locales back into existence
|
| 103 |
)
|
| 104 |
|
| 105 |
pkg_setup() {
|
| 106 |
enewgroup lp
|
| 107 |
enewuser lp -1 -1 -1 lp
|
| 108 |
enewgroup lpadmin 106
|
| 109 |
|
| 110 |
# python 3 is no-go
|
| 111 |
if use python; then
|
| 112 |
python_set_active_version 2
|
| 113 |
python_pkg_setup
|
| 114 |
fi
|
| 115 |
|
| 116 |
if use kernel_linux; then
|
| 117 |
linux-info_pkg_setup
|
| 118 |
if ! linux_config_exists; then
|
| 119 |
ewarn "Can't check the linux kernel configuration."
|
| 120 |
ewarn "You might have some incompatible options enabled."
|
| 121 |
else
|
| 122 |
# recheck that we don't have usblp to collide with libusb
|
| 123 |
if use usb; then
|
| 124 |
if linux_chkconfig_present USB_PRINTER; then
|
| 125 |
eerror "Your usb printers will be managed via libusb. In this case, "
|
| 126 |
eerror "${P} requires the USB_PRINTER support disabled."
|
| 127 |
eerror "Please disable it:"
|
| 128 |
eerror " CONFIG_USB_PRINTER=n"
|
| 129 |
eerror "in /usr/src/linux/.config or"
|
| 130 |
eerror " Device Drivers --->"
|
| 131 |
eerror " USB support --->"
|
| 132 |
eerror " [ ] USB Printer support"
|
| 133 |
eerror "Alternatively, just disable the usb useflag for cups (your printer will still work)."
|
| 134 |
fi
|
| 135 |
else
|
| 136 |
#here we should warn user that he should enable it so he can print
|
| 137 |
if ! linux_chkconfig_present USB_PRINTER; then
|
| 138 |
ewarn "If you plan to use USB printers you should enable the USB_PRINTER"
|
| 139 |
ewarn "support in your kernel."
|
| 140 |
ewarn "Please enable it:"
|
| 141 |
ewarn " CONFIG_USB_PRINTER=y"
|
| 142 |
ewarn "in /usr/src/linux/.config or"
|
| 143 |
ewarn " Device Drivers --->"
|
| 144 |
ewarn " USB support --->"
|
| 145 |
ewarn " [*] USB Printer support"
|
| 146 |
ewarn "Alternatively, enable the usb useflag for cups and use the libusb code."
|
| 147 |
fi
|
| 148 |
fi
|
| 149 |
fi
|
| 150 |
fi
|
| 151 |
}
|
| 152 |
|
| 153 |
src_prepare() {
|
| 154 |
base_src_prepare
|
| 155 |
AT_M4DIR=config-scripts eaclocal
|
| 156 |
eautoconf
|
| 157 |
}
|
| 158 |
|
| 159 |
src_configure() {
|
| 160 |
export DSOFLAGS="${LDFLAGS}"
|
| 161 |
|
| 162 |
# locale support
|
| 163 |
strip-linguas ${LANGS}
|
| 164 |
if [ -z "${LINGUAS}" ] ; then
|
| 165 |
export LINGUAS=none
|
| 166 |
fi
|
| 167 |
|
| 168 |
local myconf
|
| 169 |
if use ssl ; then
|
| 170 |
myconf+="
|
| 171 |
$(use_enable gnutls)
|
| 172 |
$(use_enable !gnutls openssl)
|
| 173 |
"
|
| 174 |
else
|
| 175 |
myconf+="
|
| 176 |
--disable-gnutls
|
| 177 |
--disable-openssl
|
| 178 |
"
|
| 179 |
fi
|
| 180 |
|
| 181 |
econf \
|
| 182 |
--libdir=/usr/$(get_libdir) \
|
| 183 |
--localstatedir=/var \
|
| 184 |
--with-cups-user=lp \
|
| 185 |
--with-cups-group=lp \
|
| 186 |
--with-docdir=/usr/share/cups/html \
|
| 187 |
--with-languages="${LINGUAS}" \
|
| 188 |
--with-pdftops=/usr/bin/pdftops \
|
| 189 |
--with-system-groups=lpadmin \
|
| 190 |
$(use_enable acl) \
|
| 191 |
$(use_enable avahi) \
|
| 192 |
$(use_enable dbus) \
|
| 193 |
$(use_enable debug) \
|
| 194 |
$(use_enable debug debug-guards) \
|
| 195 |
$(use_enable jpeg) \
|
| 196 |
$(use_enable kerberos gssapi) \
|
| 197 |
$(use_enable ldap) \
|
| 198 |
$(use_enable pam) \
|
| 199 |
$(use_enable png) \
|
| 200 |
$(use_enable slp) \
|
| 201 |
$(use_enable static-libs static) \
|
| 202 |
$(use_enable threads) \
|
| 203 |
$(use_enable tiff) \
|
| 204 |
$(use_enable usb libusb) \
|
| 205 |
$(use_with java) \
|
| 206 |
$(use_with perl) \
|
| 207 |
--without-php \
|
| 208 |
$(use_with python) \
|
| 209 |
$(use_with xinetd xinetd /etc/xinetd.d) \
|
| 210 |
--enable-libpaper \
|
| 211 |
--disable-dnssd \
|
| 212 |
$(use_with systemd systemdsystemunitdir "$(systemd_get_unitdir)") \
|
| 213 |
${myconf}
|
| 214 |
|
| 215 |
# install in /usr/libexec always, instead of using /usr/lib/cups, as that
|
| 216 |
# makes more sense when facing multilib support.
|
| 217 |
sed -i -e 's:SERVERBIN.*:SERVERBIN = "$(BUILDROOT)"/usr/libexec/cups:' Makedefs || die
|
| 218 |
sed -i -e 's:#define CUPS_SERVERBIN.*:#define CUPS_SERVERBIN "/usr/libexec/cups":' config.h || die
|
| 219 |
sed -i -e 's:cups_serverbin=.*:cups_serverbin=/usr/libexec/cups:' cups-config || die
|
| 220 |
}
|
| 221 |
|
| 222 |
src_compile() {
|
| 223 |
emake
|
| 224 |
|
| 225 |
if use perl ; then
|
| 226 |
cd "${S}"/scripting/perl
|
| 227 |
perl-module_src_prep
|
| 228 |
perl-module_src_compile
|
| 229 |
fi
|
| 230 |
}
|
| 231 |
|
| 232 |
src_install() {
|
| 233 |
emake BUILDROOT="${D}" install
|
| 234 |
dodoc {CHANGES,CREDITS,README}.txt
|
| 235 |
|
| 236 |
if use perl ; then
|
| 237 |
pushd scripting/perl > /dev/null
|
| 238 |
perl-module_src_install
|
| 239 |
fixlocalpod
|
| 240 |
popd > /dev/null
|
| 241 |
fi
|
| 242 |
|
| 243 |
# move the default config file to docs
|
| 244 |
dodoc "${ED}"/etc/cups/cupsd.conf.default
|
| 245 |
rm -f "${ED}"/etc/cups/cupsd.conf.default
|
| 246 |
|
| 247 |
# clean out cups init scripts
|
| 248 |
rm -rf "${ED}"/etc/{init.d/cups,rc*,pam.d/cups}
|
| 249 |
|
| 250 |
# install our init script
|
| 251 |
local neededservices
|
| 252 |
use avahi && neededservices+=" avahi-daemon"
|
| 253 |
use dbus && neededservices+=" dbus"
|
| 254 |
[[ -n ${neededservices} ]] && neededservices="need${neededservices}"
|
| 255 |
cp "${FILESDIR}"/cupsd.init.d "${T}"/cupsd || die
|
| 256 |
sed -i \
|
| 257 |
-e "s/@neededservices@/$neededservices/" \
|
| 258 |
"${T}"/cupsd || die
|
| 259 |
doinitd "${T}"/cupsd
|
| 260 |
|
| 261 |
# install our pam script
|
| 262 |
pamd_mimic_system cups auth account
|
| 263 |
|
| 264 |
if use xinetd ; then
|
| 265 |
# correct path
|
| 266 |
sed -i \
|
| 267 |
-e "s:server = .*:server = /usr/libexec/cups/daemon/cups-lpd:" \
|
| 268 |
"${ED}"/etc/xinetd.d/cups-lpd || die
|
| 269 |
# it is safer to disable this by default, bug #137130
|
| 270 |
grep -w 'disable' "${ED}"/etc/xinetd.d/cups-lpd || \
|
| 271 |
{ sed -i -e "s:}:\tdisable = yes\n}:" "${ED}"/etc/xinetd.d/cups-lpd || die ; }
|
| 272 |
# write permission for file owner (root), bug #296221
|
| 273 |
fperms u+w /etc/xinetd.d/cups-lpd || die "fperms failed"
|
| 274 |
else
|
| 275 |
rm -rf "${ED}"/etc/xinetd.d
|
| 276 |
fi
|
| 277 |
|
| 278 |
keepdir /usr/libexec/cups/driver /usr/share/cups/{model,profiles} \
|
| 279 |
/var/cache/cups /var/cache/cups/rss /var/log/cups \
|
| 280 |
/var/spool/cups/tmp
|
| 281 |
|
| 282 |
keepdir /etc/cups/{interfaces,ppd,ssl}
|
| 283 |
|
| 284 |
use X || rm -r "${ED}"/usr/share/applications
|
| 285 |
|
| 286 |
# create /etc/cups/client.conf, bug #196967 and #266678
|
| 287 |
echo "ServerName /var/run/cups/cups.sock" >> "${ED}"/etc/cups/client.conf
|
| 288 |
}
|
| 289 |
|
| 290 |
pkg_preinst() {
|
| 291 |
gnome2_icon_savelist
|
| 292 |
}
|
| 293 |
|
| 294 |
pkg_postinst() {
|
| 295 |
# Update desktop file database and gtk icon cache (bug 370059)
|
| 296 |
gnome2_icon_cache_update
|
| 297 |
fdo-mime_desktop_database_update
|
| 298 |
|
| 299 |
echo
|
| 300 |
elog "For information about installing a printer and general cups setup"
|
| 301 |
elog "take a look at: http://www.gentoo.org/doc/en/printing-howto.xml"
|
| 302 |
echo
|
| 303 |
elog "Network browsing for printers is now switched off by default in the config file."
|
| 304 |
elog "To (re-)enable it, edit /etc/cups/cupsd.conf and set \"Browsing On\", "
|
| 305 |
elog "afterwards re-start or reload cups."
|
| 306 |
echo
|
| 307 |
}
|
| 308 |
|
| 309 |
pkg_postrm() {
|
| 310 |
# Update desktop file database and gtk icon cache (bug 370059)
|
| 311 |
gnome2_icon_cache_update
|
| 312 |
fdo-mime_desktop_database_update
|
| 313 |
}
|