app-text/enchant: bump
[sgilles-overlay.git] / net-print / hplip / hplip-3.15.6.ebuild
blob3f1bdab388afcd86ab559b9e6972dd8aab24f6f6
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 $
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.15.6-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                 )
64                 qt4? (
65                         >=dev-python/PyQt4-4.9.6-r2[dbus,X,${PYTHON_USEDEP}]
66                         libnotify? (
67                                 >=dev-python/notify-python-0.1.1-r3[${PYTHON_USEDEP}]
68                         )
69                 )
70         )"
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)."
77 pkg_setup() {
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."
88         fi
90         if use minimal ; then
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."
94         else
95                 use parport && linux-info_pkg_setup
96         fi
99 src_prepare() {
100         if use !minimal ; then
101                 python_export EPYTHON PYTHON
102                 python_fix_shebang .
103         fi
105         EPATCH_SUFFIX="patch" \
106         EPATCH_FORCE="yes" \
107         epatch "${WORKDIR}"
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
126         sed -i \
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
132         local i
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
138         done
140         eautoreconf
143 src_configure() {
144         local myconf drv_build minimal_build
146         if use fax || use qt4 ; then
147                 myconf="${myconf} --enable-dbus-build"
148         else
149                 myconf="${myconf} --disable-dbus-build"
150         fi
152         if use libusb0 ; then
153                 myconf="${myconf} --enable-libusb01_build"
154         else
155                 myconf="${myconf} --disable-libusb01_build"
156         fi
158         if use hpcups ; then
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"
163                 else
164                         drv_build="${drv_build} --enable-cups-drv-install"
165                         drv_build="${drv_build} --disable-cups-ppd-install"
166                 fi
167         else
168                 drv_build="--disable-hpcups-install"
169                 drv_build="${drv_build} --disable-cups-drv-install"
170                 drv_build="${drv_build} --disable-cups-ppd-install"
171         fi
173         if use hpijs ; then
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"
178                 else
179                         drv_build="${drv_build} --enable-foomatic-drv-install"
180                         drv_build="${drv_build} --disable-foomatic-ppd-install"
181                 fi
182         else
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"
186         fi
188         if use minimal ; then
189                 if use hpijs ; then
190                         minimal_build="--enable-hpijs-only-build"
191                 else
192                         minimal_build="--disable-hpijs-only-build"
193                 fi
194                 if use hpcups ; then
195                         minimal_build="${minimal_build} --enable-hpcups-only-build"
196                 else
197                         minimal_build="${minimal_build} --disable-hpcups-only-build"
198                 fi
199         fi
201         econf \
202                 --disable-cups11-build \
203                 --disable-lite-build \
204                 --disable-foomatic-rip-hplip-install \
205                 --disable-shadow-build \
206                 --disable-qt3 \
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 \
212                 ${myconf} \
213                 ${drv_build} \
214                 ${minimal_build} \
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) \
221                 $(use_enable qt4) \
222                 $(use_enable policykit)
225 src_install() {
226         default
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
243         fi
246 pkg_postinst() {
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"
251                 elog
252                 elog "Any user who wants to print must be in the lp group."
253                 elog
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"
258         fi