template 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. # Template file for 'hplip'
  2. pkgname=hplip
  3. version=3.20.9
  4. revision=3
  5. build_style=gnu-configure
  6. pycompile_dirs="usr/share/hplip"
  7. configure_args="
  8. --enable-gui-build
  9. --disable-qt4
  10. --enable-qt5
  11. --disable-foomatic-rip-hplip-install
  12. --enable-foomatic-ppd-install
  13. --enable-hpcups-install
  14. --enable-new-hpcups
  15. --enable-cups-ppd-install
  16. --enable-cups-drv-install
  17. --enable-hpijs-install
  18. --enable-foomatic-drv-install
  19. --enable-pp-build
  20. --with-mimedir=/usr/share/cups/mime"
  21. conf_files="/etc/hp/hplip.conf"
  22. make_dirs="/var/lib/hp 0755 root root"
  23. hostmakedepends="pkg-config automake libtool python3"
  24. makedepends="libressl-devel python3-devel libxml2-python3 cups-devel sane-devel
  25. ghostscript-devel net-snmp-devel libusb-devel libjpeg-turbo-devel dbus-devel
  26. avahi-libs-devel"
  27. depends="python3-gobject python3-dbus desktop-file-utils
  28. foomatic-db foomatic-db-engine python3-distro"
  29. short_desc="HP Linux Imaging and Printing"
  30. maintainer="Orphaned <orphan@voidlinux.org>"
  31. license="GPL-2.0-only, BSD-3-Clause, MIT"
  32. homepage="https://developers.hp.com/hp-linux-imaging-and-printing"
  33. distfiles="${SOURCEFORGE_SITE}/hplip/hplip/${version}/hplip-${version}.tar.gz"
  34. checksum=36251189aa9cc349f6a3eacbb7ac3c4fd26fc9f087c9f75cee051010c85d2ddf
  35. conflicts="hplip-gui"
  36. CFLAGS="-I${XBPS_CROSS_BASE}/usr/include/libusb-1.0 -I${XBPS_CROSS_BASE}/${py3_inc}"
  37. # Liberation
  38. # Some code has been taken from:
  39. # https://git.parabola.nu/abslibre.git/tree/libre/hplip/PKGBUILD
  40. post_patch() {
  41. echo "Removing printers not supported with free drivers from the database"
  42. # based on https://devel.trisquel.info/trisquel/package-helpers/raw/master/helpers/make-hplip
  43. # keep header license
  44. sed '/\[/,99999d' data/models/models.dat > mktemp
  45. for model in $(grep '\[' data/models/models.dat | sed 's/\[//; s/\]//'); do
  46. sed -n "/\[$model\]/,/^$/p;" data/models/models.dat > mktemp1
  47. grep '^download=True' -q mktemp1 && continue
  48. grep '^plugin=1' -q mktemp1 && continue
  49. grep '^support-type=0' -q mktemp1 && continue
  50. cat mktemp1 >> mktemp
  51. done
  52. sed -i 's/plugin=2/plugin=0/g' mktemp
  53. cp mktemp data/models/models.dat
  54. rm -v mktemp{,1}
  55. # remove nonfree software recommendation - https://labs.parabola.nu/issues/893
  56. sed -i 's/\, requires proprietary plugin//' $(grep -rlI '[,] requires proprietary plugin')
  57. }
  58. pre_configure() {
  59. export AUTOMAKE='automake --foreign'
  60. libtoolize -f
  61. autoreconf -fi || true
  62. }
  63. do_install() {
  64. # remove wildcard install of ppd files to avoid errors when overwriting
  65. sed -i Makefile -e "s;ppd/hpcups/\\*.ppd.gz;;g"
  66. make locatedriverdir=/usr/libexec/hplip dat2drvdir=/usr/libexec/hplip \
  67. rulesdir=/usr/lib/udev/rules.d DESTDIR=${DESTDIR} install
  68. # Move sane config to dll.d to avoid conflicts
  69. vmkdir etc/sane.d/dll.d
  70. mv ${DESTDIR}/etc/sane.d/dll.conf ${DESTDIR}/etc/sane.d/dll.d/hplip
  71. # This directory is a hard requirement, prevent its removal
  72. vmkdir usr/share/cups/model
  73. touch ${DESTDIR}/usr/share/cups/model/.hplip
  74. # remove autostart of hp-daemon
  75. rm -rf ${DESTDIR}/etc/xdg
  76. # remove unwanted files
  77. rm -f ${DESTDIR}/usr/share/doc/hplip-${version}/{copyright,README_LIBJPG,COPYING}
  78. # remove HAL .fdi file because HAL is no longer used
  79. rm -rf ${DESTDIR}/usr/share/hal
  80. rm -rf ${DESTDIR}/var
  81. # remove systemd service file
  82. rm -rf ${DESTDIR}/usr/lib/systemd
  83. # save gui-version of hplip.conf
  84. cp -p ${DESTDIR}/etc/hp/hplip.conf /tmp/hplip.conf
  85. # adjust values to non-gui version
  86. sed -i ${PKGDESTDIR}/etc/hp/hplip.conf \
  87. -e "s/\(gui-build=\).*/\1no/" \
  88. -e "s/\(ui-toolkit=\).*/\1no/" \
  89. -e "s/\(qt5=\).*/\1no/"
  90. # licenses
  91. vlicense COPYING
  92. vlicense copyright
  93. }
  94. hplip-gui_package() {
  95. depends="python3-gobject python3-dbus desktop-file-utils
  96. foomatic-db foomatic-db-engine python3-distro python3-PyQt5-dbus"
  97. short_desc+=" (with GUI)"
  98. conflicts="${sourcepkg}"
  99. provides="${sourcepkg}-${version}_${revision}"
  100. pkg_install() {
  101. vmove usr/bin/hp-toolbox
  102. vmove usr/share/applications
  103. vmove usr/share/hplip/ui5
  104. vmove usr/share/hplip/data/images
  105. cp -a ${DESTDIR}/. ${PKGDESTDIR}/
  106. # restore gui-version of hplip.conf
  107. mv /tmp/hplip.conf ${PKGDESTDIR}/etc/hp/
  108. }
  109. }