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