hplip-3.16.11-r3.ebuild 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. # Copyright 1999-2017 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=6
  4. PYTHON_COMPAT=( python{2_7,3_4,3_5} )
  5. PYTHON_REQ_USE="threads,xml"
  6. inherit autotools linux-info python-single-r1 readme.gentoo-r1 udev
  7. DESCRIPTION="HP Linux Imaging and Printing - Print, scan, fax drivers and service tools"
  8. HOMEPAGE="http://hplipopensource.com/hplip-web/index.html"
  9. SRC_URI="mirror://sourceforge/hplip/${P}.tar.gz
  10. https://dev.gentoo.org/~billie/distfiles/${PN}-3.16.5-patches-1.tar.xz"
  11. LICENSE="GPL-2"
  12. SLOT="0"
  13. KEYWORDS="~amd64 ~arm ~ppc ~ppc64 ~x86"
  14. IUSE="doc fax +hpcups hpijs kde libressl -libusb0 minimal parport policykit qt5 scanner +snmp static-ppds X"
  15. # dependency on dev-python/notify-python dropped due to python 3 incompatibility
  16. # possible replacement notify2 (https://pypi.python.org/pypi/notify2/0.3) not in tree
  17. COMMON_DEPEND="
  18. net-print/cups
  19. virtual/jpeg:0
  20. hpijs? ( net-print/cups-filters[foomatic] )
  21. !minimal? (
  22. ${PYTHON_DEPS}
  23. sys-apps/dbus
  24. !libusb0? ( virtual/libusb:1 )
  25. libusb0? ( virtual/libusb:0 )
  26. scanner? ( media-gfx/sane-backends )
  27. snmp? (
  28. !libressl? ( dev-libs/openssl:0= )
  29. libressl? ( dev-libs/libressl:= )
  30. net-analyzer/net-snmp
  31. )
  32. )
  33. "
  34. DEPEND="${COMMON_DEPEND}
  35. virtual/pkgconfig
  36. "
  37. RDEPEND="${COMMON_DEPEND}
  38. app-text/ghostscript-gpl
  39. !minimal? (
  40. >=dev-python/dbus-python-1.2.0-r1[${PYTHON_USEDEP}]
  41. $(python_gen_cond_dep 'dev-python/pygobject:2[${PYTHON_USEDEP}]' 'python2*')
  42. $(python_gen_cond_dep 'dev-python/pygobject:3[${PYTHON_USEDEP}]' 'python3*')
  43. fax? ( dev-python/reportlab[${PYTHON_USEDEP}] )
  44. kernel_linux? ( virtual/udev )
  45. qt5? ( >=dev-python/PyQt5-5.5.1[dbus,gui,widgets,${PYTHON_USEDEP}] )
  46. scanner? (
  47. >=dev-python/reportlab-3.2[${PYTHON_USEDEP}]
  48. >=dev-python/pillow-3.1.1[${PYTHON_USEDEP}]
  49. X? ( || (
  50. kde? ( kde-misc/skanlite )
  51. media-gfx/xsane
  52. media-gfx/sane-frontends
  53. ) )
  54. )
  55. )
  56. policykit? ( sys-auth/polkit )
  57. "
  58. REQUIRED_USE="!minimal? ( ${PYTHON_REQUIRED_USE} )"
  59. PATCHES=(
  60. "${WORKDIR}/patches"
  61. "${FILESDIR}/${PN}-3.16.9-hpps-indent.patch"
  62. )
  63. CONFIG_CHECK="~PARPORT ~PPDEV"
  64. ERROR_PARPORT="Please make sure kernel parallel port support is enabled (PARPORT and PPDEV)."
  65. #DISABLE_AUTOFORMATTING="yes"
  66. DOC_CONTENTS="
  67. For more information on setting up your printer please take
  68. a look at the hplip section of the gentoo printing guide:
  69. https://wiki.gentoo.org/wiki/Printing
  70. Any user who wants to print must be in the lp group.
  71. "
  72. pkg_setup() {
  73. use !minimal && python-single-r1_pkg_setup
  74. use scanner && ! use X && ewarn "You need USE=X for the scanner GUI."
  75. if ! use hpcups && ! use hpijs ; then
  76. ewarn "Installing neither hpcups (USE=-hpcups) nor hpijs (USE=-hpijs) driver,"
  77. ewarn "which is probably not what you want."
  78. ewarn "You will almost certainly not be able to print."
  79. fi
  80. if use minimal ; then
  81. ewarn "Installing driver portions only, make sure you know what you are doing."
  82. ewarn "Depending on the USE flags set for hpcups or hpijs the appropiate driver"
  83. ewarn "is installed. If both USE flags are set hpijs overrides hpcups."
  84. else
  85. use parport && linux-info_pkg_setup
  86. fi
  87. }
  88. src_prepare() {
  89. default
  90. if use !minimal ; then
  91. python_export EPYTHON PYTHON
  92. python_fix_shebang .
  93. fi
  94. # Make desktop files follow the specification
  95. # Gentoo bug: https://bugs.gentoo.org/show_bug.cgi?id=443680
  96. # Upstream bug: https://bugs.launchpad.net/hplip/+bug/1080324
  97. sed -i -e '/^Categories=/s/Application;//' \
  98. -e '/^Encoding=.*/d' hplip.desktop.in || die
  99. sed -i -e '/^Categories=/s/Application;//' \
  100. -e '/^Version=.*/d' \
  101. -e '/^Comment=.*/d' hplip-systray.desktop.in || die
  102. # Fix for Gentoo bug https://bugs.gentoo.org/show_bug.cgi?id=345725
  103. # Upstream bug: https://bugs.launchpad.net/hplip/+bug/880847,
  104. # https://bugs.launchpad.net/hplip/+bug/500086
  105. local udevdir=$(get_udevdir)
  106. sed -i -e "s|/etc/udev|${udevdir}|g" \
  107. $(find . -type f -exec grep -l /etc/udev {} +) || die
  108. # Force recognition of Gentoo distro by hp-check
  109. sed -i \
  110. -e "s:file('/etc/issue', 'r').read():'Gentoo':" \
  111. installer/core_install.py || die
  112. # Use system foomatic-rip for hpijs driver instead of foomatic-rip-hplip
  113. # The hpcups driver does not use foomatic-rip
  114. local i
  115. for i in ppd/hpijs/*.ppd.gz ; do
  116. rm -f ${i}.temp || die
  117. gunzip -c ${i} | sed 's/foomatic-rip-hplip/foomatic-rip/g' | \
  118. gzip > ${i}.temp || die
  119. mv ${i}.temp ${i} || die
  120. done
  121. eautoreconf
  122. }
  123. src_configure() {
  124. local myconf drv_build minimal_build
  125. if use libusb0 ; then
  126. myconf="${myconf} --enable-libusb01_build"
  127. else
  128. myconf="${myconf} --disable-libusb01_build"
  129. fi
  130. if use hpcups ; then
  131. drv_build="$(use_enable hpcups hpcups-install)"
  132. if use static-ppds ; then
  133. drv_build="${drv_build} --enable-cups-ppd-install"
  134. drv_build="${drv_build} --disable-cups-drv-install"
  135. else
  136. drv_build="${drv_build} --enable-cups-drv-install"
  137. drv_build="${drv_build} --disable-cups-ppd-install"
  138. fi
  139. else
  140. drv_build="--disable-hpcups-install"
  141. drv_build="${drv_build} --disable-cups-drv-install"
  142. drv_build="${drv_build} --disable-cups-ppd-install"
  143. fi
  144. if use hpijs ; then
  145. drv_build="${drv_build} $(use_enable hpijs hpijs-install)"
  146. if use static-ppds ; then
  147. drv_build="${drv_build} --enable-foomatic-ppd-install"
  148. drv_build="${drv_build} --disable-foomatic-drv-install"
  149. else
  150. drv_build="${drv_build} --enable-foomatic-drv-install"
  151. drv_build="${drv_build} --disable-foomatic-ppd-install"
  152. fi
  153. else
  154. drv_build="${drv_build} --disable-hpijs-install"
  155. drv_build="${drv_build} --disable-foomatic-drv-install"
  156. drv_build="${drv_build} --disable-foomatic-ppd-install"
  157. fi
  158. if use minimal ; then
  159. if use hpijs ; then
  160. minimal_build="--enable-hpijs-only-build"
  161. else
  162. minimal_build="--disable-hpijs-only-build"
  163. fi
  164. if use hpcups ; then
  165. minimal_build="${minimal_build} --enable-hpcups-only-build"
  166. else
  167. minimal_build="${minimal_build} --disable-hpcups-only-build"
  168. fi
  169. fi
  170. econf \
  171. --disable-cups11-build \
  172. --disable-lite-build \
  173. --disable-foomatic-rip-hplip-install \
  174. --disable-shadow-build \
  175. --disable-qt3 \
  176. --disable-qt4 \
  177. --disable-udev_sysfs_rules \
  178. --with-cupsbackenddir=$(cups-config --serverbin)/backend \
  179. --with-cupsfilterdir=$(cups-config --serverbin)/filter \
  180. --with-docdir=/usr/share/doc/${PF} \
  181. --with-htmldir=/usr/share/doc/${PF}/html \
  182. ${myconf} \
  183. ${drv_build} \
  184. ${minimal_build} \
  185. $(use_enable doc doc-build) \
  186. $(use_enable fax fax-build) \
  187. $(use_enable !minimal gui-build) \
  188. $(use_enable !minimal dbus-build) \
  189. $(use_enable parport pp-build) \
  190. $(use_enable policykit) \
  191. $(use_enable qt5) \
  192. $(use_enable scanner scan-build) \
  193. $(use_enable snmp network-build)
  194. }
  195. src_install() {
  196. # disable parallel install
  197. # Gentoo Bug: https://bugs.gentoo.org/show_bug.cgi?id=578018
  198. emake -j1 DESTDIR="${D}" install
  199. einstalldocs
  200. # default
  201. # Installed by sane-backends
  202. # Gentoo Bug: https://bugs.gentoo.org/show_bug.cgi?id=201023
  203. rm -f "${ED%/}"/etc/sane.d/dll.conf || die
  204. rm -f "${ED%/}"/usr/share/doc/${PF}/{copyright,README_LIBJPG,COPYING} || die
  205. rmdir --ignore-fail-on-non-empty "${ED%/}"/usr/share/doc/${PF}/ || die
  206. # Remove hal fdi files
  207. rm -rf "${ED%/}"/usr/share/hal || die
  208. find "${D}" -name '*.la' -delete || die
  209. if use !minimal ; then
  210. python_export EPYTHON PYTHON
  211. python_optimize "${ED%/}"/usr/share/hplip
  212. fi
  213. readme.gentoo_create_doc
  214. }
  215. pkg_postinst() {
  216. readme.gentoo_print_elog
  217. }