PKGBUILD 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. # Maintainer: Omar Vega Ramos <ovruni@gnu.org.pe>
  2. # Maintainer: David P. <megver83@parabola.nu>
  3. # Maintainer (arch): Andreas Radke <andyrtr@archlinux.org>
  4. # Contributor: Tom Gundersen <teg@jklm.no>
  5. # Contributor: Rémy Oudompheng <remy@archlinux.org>
  6. # Contributor: Morgan LEFIEUX <comete@archlinuxfr.org>
  7. # Contributor: André Silva <emulatorman@hyperbola.info>
  8. # Contributor: Márcio Silva <coadde@hyperbola.info>
  9. # Contributor: Jorge López <jorginho@hyperbola.info>
  10. # Maintainer (arch): Kevin Mihelich <kevin@archlinuxarm.org>
  11. # Contributor: bill-auger <bill-auger@programmer.net>
  12. # parabola changes and rationale:
  13. # - remove recommendations and downloads of non-free binaries
  14. # - disable auto-upgrade download and other online features
  15. pkgname=hplip
  16. pkgver=3.23.12
  17. pkgrel=2
  18. pkgrel+=.parabola1
  19. epoch=1
  20. pkgdesc="Drivers for HP DeskJet, OfficeJet, Photosmart, Business Inkjet and some LaserJet"
  21. arch=('x86_64')
  22. arch+=('i686' 'armv7h')
  23. url="https://hplipopensource.com"
  24. license=('GPL2' 'GPL3' 'custom:MIT' 'custom:BSD3') # arch license array is incomplete
  25. depends=('python-dbus' 'python-distro' 'ghostscript' 'net-snmp'
  26. 'foomatic-db-engine' 'python-gobject' 'libxcrypt'
  27. 'libjpeg-turbo' 'dbus' 'gcc-libs' 'avahi' 'python'
  28. 'xdg-utils' 'zlib' 'libcups' 'glibc')
  29. makedepends=('python-pyqt5' 'sane' 'rpcbind' 'cups' 'libusb')
  30. optdepends=('cups: for printing support'
  31. 'sane: for scanner support'
  32. 'xsane: sane scanner frontend'
  33. 'python-pillow: for commandline scanning support'
  34. 'python-reportlab: for pdf output in hp-scan'
  35. 'rpcbind: for network support'
  36. 'python-pyqt5: for running GUI and hp-toolbox'
  37. 'libusb: for advanced usb support'
  38. 'wget: for network support')
  39. backup=('etc/hp/hplip.conf' 'etc/sane.d/dll.d/hpaio')
  40. source=(https://downloads.sourceforge.net/${pkgname}/$pkgname-$pkgver.tar.gz{,.asc}
  41. disable_upgrade.patch
  42. 0003-models.dat-Re-add-drivers-missing-from-3.19.1.patch
  43. 0018-Allow-non-JPEG-scanning-on-the-HP-DeskJet-3520-All-i.patch
  44. 0022-Add-include-cups-ppd.h-in-various-places-as-CUPS-2.2.patch
  45. 0023-Fix-handling-of-unicode-filenames-in-sixext.py.patch
  46. # use the one from Fedora
  47. hplip-configure-python.patch
  48. python3.diff
  49. reproducible-gzip.patch)
  50. source_armv7h=(0001-Remove-ImageProcessor.patch) # x86-only
  51. sha512sums=('7461ffec38be68421e4204021f53d2b1641e7a67c14f205390d45f487a1af90956fd221f7e1561635508103ae944f19e04d6052d3f8928f2c9685fdcdcf515df'
  52. 'SKIP'
  53. 'a12aaeece5285ffb86bdbc24871bf512fbc1f29da44ae51ded314378032662074a42b8aca23bebb378bf78ed15bb7f99da59bfb4cd456f3458e7a5ef42a900f8'
  54. 'f79b3f09d022178099f38b9eae1792396e730eb5352a03d088e6610d92b3895f3f65bb92089ce7f5b21d794f9716ceb176d29ca7283e8a48bb04cf6aba305a2f'
  55. '93e29a9ef893636b2b84443e75525c4ed42531d6e68a182dfbb725c3919c77b966b5e7d9381a34d3b5853423995a7b15efb69ce3e500ec72b25b65b2ad6bd64c'
  56. '22aeb5b851f78bc6bc62e0bc3da99fecaf42d7604af41e2f3343f8d3666541f7b06b7d1a7d0ddf24f1731ac7b12dfe582375a98e3b94dfa323d6ce954549ca67'
  57. '763949a0bc460dcc9faefc86f2a91cf342781bfce696ed0c3826758572dd03ac266bbeb7b6a4f9376ac298d7d3c9c4def42d94921a8e1d1695e39396e36d95ff'
  58. '089c102357ea5fd55d81ae76aaff62713f780fd84500c3b92ecd6b2bb11ccdc3a162978548e9a5f9e98a8354a5be3997e416c52daa18eda4621ed79a29d6fea8'
  59. 'b8a4c860e90a52ec566ca5a9c7f3a5ecb7386ae76e17b2c6c878073e60eeaf0cb63883b740b4725794be9914e1ab8fc91313efb288395f3095f599c07f54cf14'
  60. '379fcbe9dc2986da828a174a0ac4e71a1da43a98408894d5e713e09d7d9cba1e9fac30f9602b81d48d992abe6b65b6402b8a07664efe97400c5d839be33cf15f')
  61. sha512sums_armv7h=('7f402ed13341ac9a01f28ecdb97effcd15f5fa9d123e554d4dd78e9f5ed01bcf7b4fe7400c53ddf5e7068f9ffd858d8fefe060e2fcacea0a0524145d78e315cc')
  62. validpgpkeys=('4ABA2F66DBD5A95894910E0673D770CDA59047B9') # HPLIP (HP Linux Imaging and Printing) <hplip@hp.com>
  63. prepare() {
  64. cd "$pkgname"-$pkgver
  65. # disable insecure update - https://bugs.archlinux.org/task/38083
  66. patch -Np0 -i "${srcdir}"/disable_upgrade.patch
  67. # add missing 'include <cups/ppd.h>' at various places
  68. patch -Np1 -i "${srcdir}"/0022-Add-include-cups-ppd.h-in-various-places-as-CUPS-2.2.patch
  69. # fix some handling unicode file names FS#58412
  70. patch -Np1 -i "${srcdir}"/0023-Fix-handling-of-unicode-filenames-in-sixext.py.patch
  71. # Workaround patch for missing Python3 transition of the old
  72. # (pre-USB-storage) photo memory card support (pcardext) - Debian patch
  73. patch -Np1 -i "${srcdir}"/python3.diff
  74. # fix model support / Debian patch / FS#74942
  75. patch -Np1 -i "${srcdir}"/0003-models.dat-Re-add-drivers-missing-from-3.19.1.patch
  76. # https://bugs.launchpad.net/hplip/+bug/1879445
  77. # broken scanning - https://bugs.archlinux.org/task/66704
  78. patch -Np1 -i ../hplip-configure-python.patch
  79. # allow non-jpeg scanning on all-in-one devices - FS#78135
  80. patch -Np1 -i ../0018-Allow-non-JPEG-scanning-on-the-HP-DeskJet-3520-All-i.patch
  81. # make gzip creation reproducible by removing the timestamp
  82. patch -Np1 -i ../reproducible-gzip.patch
  83. # remove imageprocessor
  84. [[ "${CARCH}" != armv7h ]] || patch -Np1 -i "${srcdir}"/0001-Remove-ImageProcessor.patch
  85. ## parabola changes ##
  86. echo "re-wording non-free recommendations/errors and disabling online features"
  87. # Removing printers not supported with free drivers from the database
  88. # from: https://gitlab.trisquel.org/trisquel/package-helpers/raw/aramo/helpers/make-hplip
  89. local tmp=printers.tmp
  90. local output=printers.out
  91. local printers='data/models/models.dat'
  92. # Keep header license
  93. sed '/\[/,99999d' $printers > $output
  94. for model in $(grep '\[' $printers | /bin/sed 's/\[//; s/\]//'); do
  95. sed -n "/\[$model\]/,/^$/p;" $printers > $tmp
  96. grep '^download=True' -q $tmp && continue
  97. grep '^plugin=1' -q $tmp && continue
  98. grep '^support-type=0' -q $tmp && continue
  99. cat $tmp >> $output
  100. done
  101. cp $output $printers
  102. # Set plugin-optional entries to not-required
  103. /bin/sed -i 's/plugin=2/plugin=0/g' $printers
  104. rm $tmp $output
  105. # re-word non-free firmware recommendations and error messages
  106. # and disable online features (phone-home, plugin/firmware downlaoder, etc)
  107. local match_rxs=( # ASSERT: aligns with '$replace_rxs'
  108. ', requires proprietary plugin'
  109. 'Device requires a proprietary binary Plug-in, run hp-plugin'
  110. 'Your HP Device requires to install HP proprietary plugin\\n'
  111. "Device proprietary plug-in is missing. Click 'Next' to continue plug-in installation. In case of plugin download failure, run 'hp-plugin' command from the terminal manually."
  112. "Device requires proprietary plug-in which is missing. Click 'Next' to continue plug-in installation"
  113. "def download(self, pluginPath='',callback = None):"
  114. 'def download_from_network(weburl, outputFile = None, useURLLIB=False):'
  115. 'def download_via_wget(target):'
  116. 'def download_via_curl(target):'
  117. 'def check_network_via_ping(target):'
  118. 'def check_network_connection(url=HTTP_CHECK_TARGET, ping_server=PING_CHECK_TARGET):'
  119. 'def download(mode, passwordObj):'
  120. 'Network connection not detected.'
  121. )
  122. local replace_rxs=( # ASSERT: aligns with '$match_rxs'
  123. ', (non-free/unsupported)'
  124. 'Device is non-free/unsupported'
  125. ''
  126. 'Device is non-free/unsupported./'
  127. 'Device is non-free/unsupported./'
  128. '&\n return 1'
  129. '&\n return -1, ""'
  130. '&\n return -1'
  131. '&\n return -1'
  132. '&\n return -1'
  133. '&\n return -1'
  134. '&\n return ERROR_NO_NETWORK'
  135. 'Parabola has disabled the networking features of this application.'
  136. )
  137. local rx_n
  138. for (( rx_n = 0 ; rx_n < ${#match_rxs[@]} ; ++rx_n ))
  139. do sed -i "s|${match_rxs[$rx_n]}|${replace_rxs[$rx_n]}|" $(grep -rlI "${match_rxs[$rx_n]}")
  140. done
  141. # verify libre patching
  142. local patch_msg='HPLIP upgrade is disabled by Archlinux for security reasons,'
  143. local err_msg="ERROR: 'disable_upgrade.patch' not applied"
  144. grep -A 1 "$patch_msg" upgrade.py | tail -n 1 | grep -q 'clean_exit(1)' ||
  145. ! echo "$err_msg" || return 1
  146. ## END parabola changes ##
  147. export AUTOMAKE='automake --foreign'
  148. autoreconf --force --install
  149. }
  150. build() {
  151. cd "$pkgname"-$pkgver
  152. ./configure --prefix=/usr \
  153. --enable-qt5 \
  154. --disable-qt4 \
  155. --enable-hpcups-install \
  156. --enable-cups-drv-install \
  157. --disable-imageProcessor-build \
  158. --enable-pp-build #--help
  159. sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
  160. make
  161. }
  162. package() {
  163. cd "$pkgname"-$pkgver
  164. make -j1 rulesdir=/usr/lib/udev/rules.d DESTDIR="$pkgdir/" install
  165. # remove config provided by sane and autostart of hp-daemon
  166. rm -rf "$pkgdir"/etc/{sane.d,xdg}
  167. install -dm755 "${pkgdir}"/etc/sane.d/dll.d
  168. echo hpaio > "${pkgdir}"/etc/sane.d/dll.d/hpaio
  169. # remove HAL .fdi file because HAL is no longer used
  170. rm -vrf "$pkgdir"/usr/share/hal
  171. # remove rc script
  172. rm -vrf "$pkgdir"/etc/init.d
  173. # add mixed license file
  174. install -Dt "${pkgdir}"/usr/share/licenses/${pkgname} -m644 COPYING
  175. # Compile Python bytecode:
  176. python -m compileall -d /usr/share "$pkgdir/usr/share"
  177. python -O -m compileall -d /usr/share "$pkgdir/usr/share"
  178. }