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.6.ebuild,v 1.1 2015/06/14 08:41:22 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.15.6-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}]
65 >=dev-python/PyQt4-4.9.6-r2[dbus,X,${PYTHON_USEDEP}]
67 >=dev-python/notify-python-0.1.1-r3[${PYTHON_USEDEP}]
72 REQUIRED_USE="!minimal? ( ${PYTHON_REQUIRED_USE} )"
74 CONFIG_CHECK="~PARPORT ~PPDEV"
75 ERROR_PARPORT="Please make sure kernel parallel port support is enabled (PARPORT and PPDEV)."
78 use !minimal && python-single-r1_pkg_setup
80 ! use qt4 && ewarn "You need USE=qt4 for the hplip GUI."
82 use scanner && ! use X && ewarn "You need USE=X for the scanner GUI."
84 if ! use hpcups && ! use hpijs ; then
85 ewarn "Installing neither hpcups (USE=-hpcups) nor hpijs (USE=-hpijs) driver,"
86 ewarn "which is probably not what you want."
87 ewarn "You will almost certainly not be able to print."
91 ewarn "Installing driver portions only, make sure you know what you are doing."
92 ewarn "Depending on the USE flags set for hpcups or hpijs the appropiate driver"
93 ewarn "is installed. If both USE flags are set hpijs overrides hpcups."
95 use parport && linux-info_pkg_setup
100 if use !minimal ; then
101 python_export EPYTHON PYTHON
105 EPATCH_SUFFIX="patch" \
109 # Make desktop files follow the specification
110 # Gentoo bug: https://bugs.gentoo.org/show_bug.cgi?id=443680
111 # Upstream bug: https://bugs.launchpad.net/hplip/+bug/1080324
112 sed -i -e '/^Categories=/s/Application;//' \
113 -e '/^Encoding=.*/d' hplip.desktop.in || die
114 sed -i -e '/^Categories=/s/Application;//' \
115 -e '/^Version=.*/d' \
116 -e '/^Comment=.*/d' hplip-systray.desktop.in || die
118 # Fix for Gentoo bug https://bugs.gentoo.org/show_bug.cgi?id=345725
119 # Upstream bug: https://bugs.launchpad.net/hplip/+bug/880847,
120 # https://bugs.launchpad.net/hplip/+bug/500086
121 local udevdir=$(get_udevdir)
122 sed -i -e "s|/etc/udev|${udevdir}|g" \
123 $(find . -type f -exec grep -l /etc/udev {} +) || die
125 # Force recognition of Gentoo distro by hp-check
127 -e "s:file('/etc/issue', 'r').read():'Gentoo':" \
128 installer/core_install.py || die
130 # Use system foomatic-rip for hpijs driver instead of foomatic-rip-hplip
131 # The hpcups driver does not use foomatic-rip
133 for i in ppd/hpijs/*.ppd.gz ; do
134 rm -f ${i}.temp || die
135 gunzip -c ${i} | sed 's/foomatic-rip-hplip/foomatic-rip/g' | \
136 gzip > ${i}.temp || die
137 mv ${i}.temp ${i} || die
144 local myconf drv_build minimal_build
146 if use fax || use qt4 ; then
147 myconf="${myconf} --enable-dbus-build"
149 myconf="${myconf} --disable-dbus-build"
152 if use libusb0 ; then
153 myconf="${myconf} --enable-libusb01_build"
155 myconf="${myconf} --disable-libusb01_build"
159 drv_build="$(use_enable hpcups hpcups-install)"
160 if use static-ppds ; then
161 drv_build="${drv_build} --enable-cups-ppd-install"
162 drv_build="${drv_build} --disable-cups-drv-install"
164 drv_build="${drv_build} --enable-cups-drv-install"
165 drv_build="${drv_build} --disable-cups-ppd-install"
168 drv_build="--disable-hpcups-install"
169 drv_build="${drv_build} --disable-cups-drv-install"
170 drv_build="${drv_build} --disable-cups-ppd-install"
174 drv_build="${drv_build} $(use_enable hpijs hpijs-install)"
175 if use static-ppds ; then
176 drv_build="${drv_build} --enable-foomatic-ppd-install"
177 drv_build="${drv_build} --disable-foomatic-drv-install"
179 drv_build="${drv_build} --enable-foomatic-drv-install"
180 drv_build="${drv_build} --disable-foomatic-ppd-install"
183 drv_build="${drv_build} --disable-hpijs-install"
184 drv_build="${drv_build} --disable-foomatic-drv-install"
185 drv_build="${drv_build} --disable-foomatic-ppd-install"
188 if use minimal ; then
190 minimal_build="--enable-hpijs-only-build"
192 minimal_build="--disable-hpijs-only-build"
195 minimal_build="${minimal_build} --enable-hpcups-only-build"
197 minimal_build="${minimal_build} --disable-hpcups-only-build"
202 --disable-cups11-build \
203 --disable-lite-build \
204 --disable-foomatic-rip-hplip-install \
205 --disable-shadow-build \
207 --disable-udev_sysfs_rules \
208 --with-cupsbackenddir=$(cups-config --serverbin)/backend \
209 --with-cupsfilterdir=$(cups-config --serverbin)/filter \
210 --with-docdir=/usr/share/doc/${PF} \
211 --with-htmldir=/usr/share/doc/${PF}/html \
215 $(use_enable doc doc-build) \
216 $(use_enable fax fax-build) \
217 $(use_enable parport pp-build) \
218 $(use_enable scanner scan-build) \
219 $(use_enable snmp network-build) \
220 $(use_enable qt4 gui-build) \
222 $(use_enable policykit)
228 # Installed by sane-backends
229 # Gentoo Bug: https://bugs.gentoo.org/show_bug.cgi?id=201023
230 rm -f "${D}"/etc/sane.d/dll.conf || die
232 rm -f "${D}"/usr/share/doc/${PF}/{copyright,README_LIBJPG,COPYING} || die
233 rmdir --ignore-fail-on-non-empty "${D}"/usr/share/doc/${PF}/ || die
235 # Remove hal fdi files
236 rm -rf "${D}"/usr/share/hal || die
238 prune_libtool_files --all
240 if use !minimal ; then
241 python_export EPYTHON PYTHON
242 python_optimize "${D}"/usr/share/hplip
247 if [[ -z "${REPLACING_VERSIONS}" ]]; then
248 elog "For more information on setting up your printer please take"
249 elog "a look at the hplip section of the gentoo printing guide:"
250 elog "https://wiki.gentoo.org/wiki/Printing"
252 elog "Any user who wants to print must be in the lp group."
254 elog "Please note: Printers requiring a binary plugin are currently"
255 elog "not supported. All bugs regarding the plugin are most likely"
256 elog "closed. A bug about including the plugin package to gentoo is"
257 elog "available here: https://bugs.gentoo.org/352439"