| 1 |
# Copyright 1999-2012 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.12.6-r1.ebuild,v 1.3 2012/09/18 18:10:42 billie Exp $
|
| 4 |
|
| 5 |
EAPI=4
|
| 6 |
|
| 7 |
PYTHON_DEPEND="!minimal? 2"
|
| 8 |
PYTHON_USE_WITH="threads xml"
|
| 9 |
PYTHON_USE_WITH_OPT="!minimal"
|
| 10 |
|
| 11 |
inherit fdo-mime linux-info python autotools toolchain-funcs
|
| 12 |
|
| 13 |
DESCRIPTION="HP Linux Imaging and Printing. Includes printer, scanner, fax drivers and service tools."
|
| 14 |
HOMEPAGE="http://hplipopensource.com/hplip-web/index.html"
|
| 15 |
SRC_URI="mirror://sourceforge/hplip/${P}.tar.gz
|
| 16 |
http://dev.gentoo.org/~billie/distfiles/${P}-patches-2.tar.xz"
|
| 17 |
|
| 18 |
LICENSE="GPL-2"
|
| 19 |
SLOT="0"
|
| 20 |
KEYWORDS="~amd64 ~arm ~ppc ~ppc64 ~x86"
|
| 21 |
|
| 22 |
# zeroconf does not work properly with >=cups-1.4.
|
| 23 |
# Thus support for it is also disabled in hplip.
|
| 24 |
IUSE="doc fax +hpcups hpijs kde libnotify minimal parport policykit qt4 scanner snmp static-ppds X"
|
| 25 |
|
| 26 |
COMMON_DEPEND="
|
| 27 |
virtual/jpeg
|
| 28 |
hpijs? ( >=net-print/foomatic-filters-3.0.20080507[cups] )
|
| 29 |
!minimal? (
|
| 30 |
>=net-print/cups-1.4.0
|
| 31 |
virtual/libusb:1
|
| 32 |
scanner? ( >=media-gfx/sane-backends-1.0.19-r1 )
|
| 33 |
fax? ( sys-apps/dbus )
|
| 34 |
snmp? (
|
| 35 |
net-analyzer/net-snmp
|
| 36 |
dev-libs/openssl:0
|
| 37 |
)
|
| 38 |
)"
|
| 39 |
|
| 40 |
DEPEND="${COMMON_DEPEND}
|
| 41 |
virtual/pkgconfig"
|
| 42 |
|
| 43 |
RDEPEND="${COMMON_DEPEND}
|
| 44 |
>=app-text/ghostscript-gpl-8.71-r3
|
| 45 |
dev-python/dbus-python
|
| 46 |
policykit? (
|
| 47 |
sys-auth/polkit
|
| 48 |
)
|
| 49 |
!minimal? (
|
| 50 |
dev-python/pygobject:2
|
| 51 |
kernel_linux? ( >=sys-fs/udev-114 )
|
| 52 |
scanner? (
|
| 53 |
dev-python/imaging
|
| 54 |
X? ( || (
|
| 55 |
kde? ( kde-misc/skanlite )
|
| 56 |
media-gfx/xsane
|
| 57 |
media-gfx/sane-frontends
|
| 58 |
) )
|
| 59 |
)
|
| 60 |
fax? (
|
| 61 |
dev-python/reportlab
|
| 62 |
dev-python/dbus-python
|
| 63 |
)
|
| 64 |
qt4? (
|
| 65 |
dev-python/PyQt4[dbus,X]
|
| 66 |
libnotify? (
|
| 67 |
dev-python/notify-python
|
| 68 |
)
|
| 69 |
)
|
| 70 |
)"
|
| 71 |
|
| 72 |
CONFIG_CHECK="~PARPORT ~PPDEV"
|
| 73 |
ERROR_PARPORT="Please make sure kernel parallel port support is enabled (PARPORT and PPDEV)."
|
| 74 |
|
| 75 |
pkg_setup() {
|
| 76 |
if ! use minimal; then
|
| 77 |
python_set_active_version 2
|
| 78 |
python_pkg_setup
|
| 79 |
fi
|
| 80 |
|
| 81 |
! use qt4 && ewarn "You need USE=qt4 for the hplip GUI."
|
| 82 |
|
| 83 |
use scanner && ! use X && ewarn "You need USE=X for the scanner GUI."
|
| 84 |
|
| 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
|
| 90 |
|
| 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
|
| 98 |
}
|
| 99 |
|
| 100 |
src_prepare() {
|
| 101 |
use !minimal && python_convert_shebangs -q -r 2 .
|
| 102 |
|
| 103 |
EPATCH_SUFFIX="patch" \
|
| 104 |
EPATCH_FORCE="yes" \
|
| 105 |
epatch "${WORKDIR}"
|
| 106 |
|
| 107 |
# Fix for Gentoo bug #345725
|
| 108 |
local udevdir=/lib/udev
|
| 109 |
has_version sys-fs/udev && udevdir="$($(tc-getPKG_CONFIG) --variable=udevdir udev)"
|
| 110 |
sed -i -e "s|/etc/udev|${udevdir}|g" \
|
| 111 |
$(find . -type f -exec grep -l /etc/udev {} +) || die
|
| 112 |
|
| 113 |
# Force recognition of Gentoo distro by hp-check
|
| 114 |
sed -i \
|
| 115 |
-e "s:file('/etc/issue', 'r').read():'Gentoo':" \
|
| 116 |
installer/core_install.py || die
|
| 117 |
|
| 118 |
# Use system foomatic-rip for hpijs driver instead of foomatic-rip-hplip
|
| 119 |
# The hpcups driver does not use foomatic-rip
|
| 120 |
local i
|
| 121 |
for i in ppd/hpijs/*.ppd.gz ; do
|
| 122 |
rm -f ${i}.temp
|
| 123 |
gunzip -c ${i} | sed 's/foomatic-rip-hplip/foomatic-rip/g' | \
|
| 124 |
gzip > ${i}.temp || die
|
| 125 |
mv ${i}.temp ${i}
|
| 126 |
done
|
| 127 |
|
| 128 |
eautoreconf
|
| 129 |
}
|
| 130 |
|
| 131 |
src_configure() {
|
| 132 |
local myconf drv_build minimal_build
|
| 133 |
|
| 134 |
if use fax || use qt4 ; then
|
| 135 |
myconf="${myconf} --enable-dbus-build"
|
| 136 |
else
|
| 137 |
myconf="${myconf} --disable-dbus-build"
|
| 138 |
fi
|
| 139 |
|
| 140 |
if use hpcups ; then
|
| 141 |
drv_build="$(use_enable hpcups hpcups-install)"
|
| 142 |
if use static-ppds ; then
|
| 143 |
drv_build="${drv_build} --enable-cups-ppd-install"
|
| 144 |
drv_build="${drv_build} --disable-cups-drv-install"
|
| 145 |
else
|
| 146 |
drv_build="${drv_build} --enable-cups-drv-install"
|
| 147 |
drv_build="${drv_build} --disable-cups-ppd-install"
|
| 148 |
fi
|
| 149 |
else
|
| 150 |
drv_build="--disable-hpcups-install"
|
| 151 |
drv_build="${drv_build} --disable-cups-drv-install"
|
| 152 |
drv_build="${drv_build} --disable-cups-ppd-install"
|
| 153 |
fi
|
| 154 |
|
| 155 |
if use hpijs ; then
|
| 156 |
drv_build="${drv_build} $(use_enable hpijs hpijs-install)"
|
| 157 |
if use static-ppds ; then
|
| 158 |
drv_build="${drv_build} --enable-foomatic-ppd-install"
|
| 159 |
drv_build="${drv_build} --disable-foomatic-drv-install"
|
| 160 |
else
|
| 161 |
drv_build="${drv_build} --enable-foomatic-drv-install"
|
| 162 |
drv_build="${drv_build} --disable-foomatic-ppd-install"
|
| 163 |
fi
|
| 164 |
else
|
| 165 |
drv_build="${drv_build} --disable-hpijs-install"
|
| 166 |
drv_build="${drv_build} --disable-foomatic-drv-install"
|
| 167 |
drv_build="${drv_build} --disable-foomatic-ppd-install"
|
| 168 |
fi
|
| 169 |
|
| 170 |
if use minimal ; then
|
| 171 |
if use hpijs ; then
|
| 172 |
minimal_build="--enable-hpijs-only-build"
|
| 173 |
else
|
| 174 |
minimal_build="--disable-hpijs-only-build"
|
| 175 |
fi
|
| 176 |
if use hpcups ; then
|
| 177 |
minimal_build="${minimal_build} --enable-hpcups-only-build"
|
| 178 |
else
|
| 179 |
minimal_build="${minimal_build} --disable-hpcups-only-build"
|
| 180 |
fi
|
| 181 |
fi
|
| 182 |
|
| 183 |
econf \
|
| 184 |
--disable-cups11-build \
|
| 185 |
--disable-lite-build \
|
| 186 |
--disable-foomatic-rip-hplip-install \
|
| 187 |
--disable-shadow-build \
|
| 188 |
--disable-qt3 \
|
| 189 |
--disable-libusb01_build \
|
| 190 |
--disable-udev_sysfs_rules \
|
| 191 |
--disable-udev-acl-rules \
|
| 192 |
--with-cupsbackenddir=$(cups-config --serverbin)/backend \
|
| 193 |
--with-cupsfilterdir=$(cups-config --serverbin)/filter \
|
| 194 |
--with-docdir=/usr/share/doc/${PF} \
|
| 195 |
--with-htmldir=/usr/share/doc/${PF}/html \
|
| 196 |
${myconf} \
|
| 197 |
${drv_build} \
|
| 198 |
${minimal_build} \
|
| 199 |
$(use_enable doc doc-build) \
|
| 200 |
$(use_enable fax fax-build) \
|
| 201 |
$(use_enable parport pp-build) \
|
| 202 |
$(use_enable scanner scan-build) \
|
| 203 |
$(use_enable snmp network-build) \
|
| 204 |
$(use_enable qt4 gui-build) \
|
| 205 |
$(use_enable qt4) \
|
| 206 |
$(use_enable policykit)
|
| 207 |
}
|
| 208 |
|
| 209 |
src_install() {
|
| 210 |
default
|
| 211 |
|
| 212 |
# Installed by sane-backends
|
| 213 |
# Gentoo Bug: #201023
|
| 214 |
rm -f "${D}"/etc/sane.d/dll.conf || die
|
| 215 |
|
| 216 |
rm -f "${D}"/usr/share/doc/${PF}/{copyright,README_LIBJPG,COPYING} || die
|
| 217 |
rmdir --ignore-fail-on-non-empty "${D}"/usr/share/doc/${PF}/ || die
|
| 218 |
|
| 219 |
# Remove hal fdi files
|
| 220 |
rm -rf "${D}"/usr/share/hal || die
|
| 221 |
|
| 222 |
find "${D}" -name '*.la' -exec rm -rf {} + || die
|
| 223 |
}
|
| 224 |
|
| 225 |
pkg_postinst() {
|
| 226 |
use !minimal && python_mod_optimize /usr/share/${PN}
|
| 227 |
fdo-mime_desktop_database_update
|
| 228 |
|
| 229 |
elog "For more information on setting up your printer please take"
|
| 230 |
elog "a look at the hplip section of the gentoo printing guide:"
|
| 231 |
elog "http://www.gentoo.org/doc/en/printing-howto.xml"
|
| 232 |
elog
|
| 233 |
elog "Any user who wants to print must be in the lp group."
|
| 234 |
}
|
| 235 |
|
| 236 |
pkg_postrm() {
|
| 237 |
use !minimal && python_mod_cleanup /usr/share/${PN}
|
| 238 |
fdo-mime_desktop_database_update
|
| 239 |
}
|