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