app-text/enchant: bump
[sgilles-overlay.git] / net-print / hplip / hplip-3.15.4.ebuild
blob5437dd76a0a55b904e5810f828ea5701cb666224
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 $
5 EAPI=5
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"
17 LICENSE="GPL-2"
18 SLOT="0"
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"
23 COMMON_DEPEND="
24         virtual/jpeg:0
25         hpijs? (
26                 || ( >=net-print/cups-filters-1.0.43-r1[foomatic] >=net-print/foomatic-filters-3.0.20080507[cups] )
27         )
28         !minimal? (
29                 ${PYTHON_DEPS}
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 )
35                 snmp? (
36                         net-analyzer/net-snmp
37                         dev-libs/openssl:0
38                 )
39         )"
41 DEPEND="${COMMON_DEPEND}
42         virtual/pkgconfig"
44 RDEPEND="${COMMON_DEPEND}
45         >=app-text/ghostscript-gpl-8.71-r3
46         policykit? (
47                 sys-auth/polkit
48         )
49         !minimal? (
50                 >=dev-python/pygobject-2.28.6-r53:2[${PYTHON_USEDEP}]
51                 kernel_linux? ( virtual/udev )
52                 scanner? (
53                         >=dev-python/reportlab-2.6[${PYTHON_USEDEP}]
54                         >=virtual/python-imaging-1[${PYTHON_USEDEP}]
55                         X? ( || (
56                                 kde? ( kde-misc/skanlite )
57                                 media-gfx/xsane
58                                 media-gfx/sane-frontends
59                         ) )
60                 )
61                 fax? (
62                         >=dev-python/reportlab-2.6[${PYTHON_USEDEP}]
63                         >=dev-python/dbus-python-1.1.1-r1[${PYTHON_USEDEP}]
64                 )
65                 qt4? (
66                         >=dev-python/PyQt4-4.9.6-r2[dbus,X,${PYTHON_USEDEP}]
67                         libnotify? (
68                                 >=dev-python/notify-python-0.1.1-r3[${PYTHON_USEDEP}]
69                         )
70                 )
71         )"
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)."
78 pkg_setup() {
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."
89         fi
91         if use minimal ; then
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."
95         else
96                 use parport && linux-info_pkg_setup
97         fi
100 src_prepare() {
101         if use !minimal ; then
102                 python_export EPYTHON PYTHON
103                 python_fix_shebang .
104         fi
106         EPATCH_SUFFIX="patch" \
107         EPATCH_FORCE="yes" \
108         epatch "${WORKDIR}"
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
127         sed -i \
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
133         local i
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
139         done
141         eautoreconf
144 src_configure() {
145         local myconf drv_build minimal_build
147         if use fax || use qt4 ; then
148                 myconf="${myconf} --enable-dbus-build"
149         else
150                 myconf="${myconf} --disable-dbus-build"
151         fi
153         if use libusb0 ; then
154                 myconf="${myconf} --enable-libusb01_build"
155         else
156                 myconf="${myconf} --disable-libusb01_build"
157         fi
159         if use hpcups ; then
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"
164                 else
165                         drv_build="${drv_build} --enable-cups-drv-install"
166                         drv_build="${drv_build} --disable-cups-ppd-install"
167                 fi
168         else
169                 drv_build="--disable-hpcups-install"
170                 drv_build="${drv_build} --disable-cups-drv-install"
171                 drv_build="${drv_build} --disable-cups-ppd-install"
172         fi
174         if use hpijs ; then
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"
179                 else
180                         drv_build="${drv_build} --enable-foomatic-drv-install"
181                         drv_build="${drv_build} --disable-foomatic-ppd-install"
182                 fi
183         else
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"
187         fi
189         if use minimal ; then
190                 if use hpijs ; then
191                         minimal_build="--enable-hpijs-only-build"
192                 else
193                         minimal_build="--disable-hpijs-only-build"
194                 fi
195                 if use hpcups ; then
196                         minimal_build="${minimal_build} --enable-hpcups-only-build"
197                 else
198                         minimal_build="${minimal_build} --disable-hpcups-only-build"
199                 fi
200         fi
202         econf \
203                 --disable-cups11-build \
204                 --disable-lite-build \
205                 --disable-foomatic-rip-hplip-install \
206                 --disable-shadow-build \
207                 --disable-qt3 \
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 \
213                 ${myconf} \
214                 ${drv_build} \
215                 ${minimal_build} \
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) \
222                 $(use_enable qt4) \
223                 $(use_enable policykit)
226 src_install() {
227         default
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
244         fi
247 pkg_postinst() {
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"
252                 elog
253                 elog "Any user who wants to print must be in the lp group."
254                 elog
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"
259         fi