1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/net-print/hplip/hplip-3.15.4.ebuild,v 1.1 2015/04/19 15:29:03 billie Exp $
7 PYTHON_COMPAT=( python2_7 )
8 PYTHON_REQ_USE="threads,xml"
10 inherit eutils fdo-mime linux-info python-single-r1 udev autotools toolchain-funcs
12 DESCRIPTION="HP Linux Imaging and Printing. Includes printer, scanner, fax drivers and service tools"
13 HOMEPAGE="http://hplipopensource.com/hplip-web/index.html"
14 SRC_URI="mirror://sourceforge/hplip/${P}.tar.gz
15 http://dev.gentoo.org/~billie/distfiles/${PN}-3.14.10-patches-1.tar.xz"
19 KEYWORDS="~amd64 ~arm ~ppc ~ppc64 ~x86"
21 IUSE="doc fax +hpcups hpijs kde libnotify -libusb0 minimal parport policykit qt4 scanner snmp static-ppds X"
26 || ( >=net-print/cups-filters-1.0.43-r1[foomatic] >=net-print/foomatic-filters-3.0.20080507[cups] )
30 >=net-print/cups-1.4.0
31 !libusb0? ( virtual/libusb:1 )
32 libusb0? ( virtual/libusb:0 )
33 scanner? ( >=media-gfx/sane-backends-1.0.19-r1 )
34 fax? ( >=sys-apps/dbus-1.6.8-r1 )
41 DEPEND="${COMMON_DEPEND}
44 RDEPEND="${COMMON_DEPEND}
45 >=app-text/ghostscript-gpl-8.71-r3
50 >=dev-python/pygobject-2.28.6-r53:2[${PYTHON_USEDEP}]
51 kernel_linux? ( virtual/udev )
53 >=dev-python/reportlab-2.6[${PYTHON_USEDEP}]
54 >=virtual/python-imaging-1[${PYTHON_USEDEP}]
56 kde? ( kde-misc/skanlite )
58 media-gfx/sane-frontends
62 >=dev-python/reportlab-2.6[${PYTHON_USEDEP}]
63 >=dev-python/dbus-python-1.1.1-r1[${PYTHON_USEDEP}]
66 >=dev-python/PyQt4-4.9.6-r2[dbus,X,${PYTHON_USEDEP}]
68 >=dev-python/notify-python-0.1.1-r3[${PYTHON_USEDEP}]
73 REQUIRED_USE="!minimal? ( ${PYTHON_REQUIRED_USE} )"
75 CONFIG_CHECK="~PARPORT ~PPDEV"
76 ERROR_PARPORT="Please make sure kernel parallel port support is enabled (PARPORT and PPDEV)."
79 use !minimal && python-single-r1_pkg_setup
81 ! use qt4 && ewarn "You need USE=qt4 for the hplip GUI."
83 use scanner && ! use X && ewarn "You need USE=X for the scanner GUI."
85 if ! use hpcups && ! use hpijs ; then
86 ewarn "Installing neither hpcups (USE=-hpcups) nor hpijs (USE=-hpijs) driver,"
87 ewarn "which is probably not what you want."
88 ewarn "You will almost certainly not be able to print."
92 ewarn "Installing driver portions only, make sure you know what you are doing."
93 ewarn "Depending on the USE flags set for hpcups or hpijs the appropiate driver"
94 ewarn "is installed. If both USE flags are set hpijs overrides hpcups."
96 use parport && linux-info_pkg_setup
101 if use !minimal ; then
102 python_export EPYTHON PYTHON
106 EPATCH_SUFFIX="patch" \
110 # Make desktop files follow the specification
111 # Gentoo bug: https://bugs.gentoo.org/show_bug.cgi?id=443680
112 # Upstream bug: https://bugs.launchpad.net/hplip/+bug/1080324
113 sed -i -e '/^Categories=/s/Application;//' \
114 -e '/^Encoding=.*/d' hplip.desktop.in || die
115 sed -i -e '/^Categories=/s/Application;//' \
116 -e '/^Version=.*/d' \
117 -e '/^Comment=.*/d' hplip-systray.desktop.in || die
119 # Fix for Gentoo bug https://bugs.gentoo.org/show_bug.cgi?id=345725
120 # Upstream bug: https://bugs.launchpad.net/hplip/+bug/880847,
121 # https://bugs.launchpad.net/hplip/+bug/500086
122 local udevdir=$(get_udevdir)
123 sed -i -e "s|/etc/udev|${udevdir}|g" \
124 $(find . -type f -exec grep -l /etc/udev {} +) || die
126 # Force recognition of Gentoo distro by hp-check
128 -e "s:file('/etc/issue', 'r').read():'Gentoo':" \
129 installer/core_install.py || die
131 # Use system foomatic-rip for hpijs driver instead of foomatic-rip-hplip
132 # The hpcups driver does not use foomatic-rip
134 for i in ppd/hpijs/*.ppd.gz ; do
135 rm -f ${i}.temp || die
136 gunzip -c ${i} | sed 's/foomatic-rip-hplip/foomatic-rip/g' | \
137 gzip > ${i}.temp || die
138 mv ${i}.temp ${i} || die
145 local myconf drv_build minimal_build
147 if use fax || use qt4 ; then
148 myconf="${myconf} --enable-dbus-build"
150 myconf="${myconf} --disable-dbus-build"
153 if use libusb0 ; then
154 myconf="${myconf} --enable-libusb01_build"
156 myconf="${myconf} --disable-libusb01_build"
160 drv_build="$(use_enable hpcups hpcups-install)"
161 if use static-ppds ; then
162 drv_build="${drv_build} --enable-cups-ppd-install"
163 drv_build="${drv_build} --disable-cups-drv-install"
165 drv_build="${drv_build} --enable-cups-drv-install"
166 drv_build="${drv_build} --disable-cups-ppd-install"
169 drv_build="--disable-hpcups-install"
170 drv_build="${drv_build} --disable-cups-drv-install"
171 drv_build="${drv_build} --disable-cups-ppd-install"
175 drv_build="${drv_build} $(use_enable hpijs hpijs-install)"
176 if use static-ppds ; then
177 drv_build="${drv_build} --enable-foomatic-ppd-install"
178 drv_build="${drv_build} --disable-foomatic-drv-install"
180 drv_build="${drv_build} --enable-foomatic-drv-install"
181 drv_build="${drv_build} --disable-foomatic-ppd-install"
184 drv_build="${drv_build} --disable-hpijs-install"
185 drv_build="${drv_build} --disable-foomatic-drv-install"
186 drv_build="${drv_build} --disable-foomatic-ppd-install"
189 if use minimal ; then
191 minimal_build="--enable-hpijs-only-build"
193 minimal_build="--disable-hpijs-only-build"
196 minimal_build="${minimal_build} --enable-hpcups-only-build"
198 minimal_build="${minimal_build} --disable-hpcups-only-build"
203 --disable-cups11-build \
204 --disable-lite-build \
205 --disable-foomatic-rip-hplip-install \
206 --disable-shadow-build \
208 --disable-udev_sysfs_rules \
209 --with-cupsbackenddir=$(cups-config --serverbin)/backend \
210 --with-cupsfilterdir=$(cups-config --serverbin)/filter \
211 --with-docdir=/usr/share/doc/${PF} \
212 --with-htmldir=/usr/share/doc/${PF}/html \
216 $(use_enable doc doc-build) \
217 $(use_enable fax fax-build) \
218 $(use_enable parport pp-build) \
219 $(use_enable scanner scan-build) \
220 $(use_enable snmp network-build) \
221 $(use_enable qt4 gui-build) \
223 $(use_enable policykit)
229 # Installed by sane-backends
230 # Gentoo Bug: https://bugs.gentoo.org/show_bug.cgi?id=201023
231 rm -f "${D}"/etc/sane.d/dll.conf || die
233 rm -f "${D}"/usr/share/doc/${PF}/{copyright,README_LIBJPG,COPYING} || die
234 rmdir --ignore-fail-on-non-empty "${D}"/usr/share/doc/${PF}/ || die
236 # Remove hal fdi files
237 rm -rf "${D}"/usr/share/hal || die
239 prune_libtool_files --all
241 if use !minimal ; then
242 python_export EPYTHON PYTHON
243 python_optimize "${D}"/usr/share/hplip
248 if [[ -z "${REPLACING_VERSIONS}" ]]; then
249 elog "For more information on setting up your printer please take"
250 elog "a look at the hplip section of the gentoo printing guide:"
251 elog "https://wiki.gentoo.org/wiki/Printing"
253 elog "Any user who wants to print must be in the lp group."
255 elog "Please note: Printers requiring a binary plugin are currently"
256 elog "not supported. All bugs regarding the plugin are most likely"
257 elog "closed. A bug about including the plugin package to gentoo is"
258 elog "available here: https://bugs.gentoo.org/352439"