summaryrefslogtreecommitdiff
path: root/libre/hplip/PKGBUILD
blob: e3f22246420e9eebb543083897e27c40f45647cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# Maintainer (Arch): Andreas Radke <andyrtr@archlinux.org>
# Maintainer (Arch): Tom Gundersen <teg@jklm.no>
# Contributor (Arch): Rémy Oudompheng <remy@archlinux.org>
# Contributor (Arch): Morgan LEFIEUX <comete@archlinuxfr.org>
# Maintainer (Hyperbola): André Silva <emulatorman@hyperbola.info>
# Contributor (Hyperbola): Márcio Silva <coadde@hyperbola.info>
# Contributor (Hyperbola): Jorge López <jorginho@hyperbola.info>
# Maintainer: Omar Vega Ramos <ovruni@gnu.org.pe>

pkgname=hplip
pkgver=3.19.6
pkgrel=1
pkgrel+=.par1
epoch=1
pkgdesc="Drivers for HP DeskJet, OfficeJet, Photosmart, Business Inkjet and some LaserJet"
pkgdesc+=", without printers with nonfree drivers support and hplip-plugin binary blobs recommendation (Parabola rebranded)"
arch=('x86_64')
arch+=('i686' 'armv7h')
url="https://hplipopensource.com"
license=('GPL' 'custom')
depends=('python-dbus' 'ghostscript' 'net-snmp' 'foomatic-db-engine' 'python-gobject')
makedepends=('python-pyqt5' 'sane' 'rpcbind' 'cups' 'libusb')
optdepends=('cups: for printing support'
            'sane: for scanner support'
            'xsane: sane scanner frontend'
            'python-pillow: for commandline scanning support'
            'python-reportlab: for pdf output in hp-scan'
            'rpcbind: for network support'
            'python-pyqt5: for running GUI and hp-toolbox'
            'libusb: for advanced usb support'
            'wget: for network support')
replaces=(${pkgname}-libre)
conflicts=(${pkgname}-libre)
backup=('etc/hp/hplip.conf' 'etc/sane.d/dll.d/hpaio')
source=(https://downloads.sourceforge.net/${pkgname}/$pkgname-$pkgver.tar.gz{,.asc}
        disable_upgrade.patch
        0022-Add-include-cups-ppd.h-in-various-places-as-CUPS-2.2.patch
        0023-Fix-handling-of-unicode-filenames-in-sixext.py.patch
        0025-Remove-all-ImageProcessor-functionality-which-is-clo.patch)
sha512sums=('c99448ad0cef9fc626a0a03147a0d582513cb838ecfbfe29f07c65bbf701dee5c7d02222469b118ccc4e8c230c7a4b4685a72a1e67595ee01150b0472692d654'
            'SKIP'
            'f0cf2774e53070406e89614b748e3c45079be889b83d5854340b92093643f6f8b332d6b6e617884d2bdcbef667a84ee5741b07c5fb080bb04925bb454af448d1'
            '22aeb5b851f78bc6bc62e0bc3da99fecaf42d7604af41e2f3343f8d3666541f7b06b7d1a7d0ddf24f1731ac7b12dfe582375a98e3b94dfa323d6ce954549ca67'
            '763949a0bc460dcc9faefc86f2a91cf342781bfce696ed0c3826758572dd03ac266bbeb7b6a4f9376ac298d7d3c9c4def42d94921a8e1d1695e39396e36d95ff'
            '8710e039626878270b8b7bc1569566274d935c84652d758e25ce8fe01c0f44d911148620bb494489e1238201c01f3ba255c19f7dc5c2ff0d45a5f2a79190286b')
validpgpkeys=('4ABA2F66DBD5A95894910E0673D770CDA59047B9') # HPLIP <hplip@hp.com>

prepare() {
 cd $pkgname-$pkgver

 echo "Removing printers not supported with free drivers from the database"

 # based on https://devel.trisquel.info/trisquel/package-helpers/raw/master/helpers/make-hplip
 # keep header license
 sed '/\[/,99999d' data/models/models.dat > mktemp

 for model in $(grep '\[' data/models/models.dat | sed 's/\[//; s/\]//'); do
   sed -n "/\[$model\]/,/^$/p;" data/models/models.dat > mktemp1
   grep '^download=True' -q mktemp1 && continue
   grep '^plugin=1' -q mktemp1 && continue
   grep '^support-type=0' -q mktemp1 && continue
   cat mktemp1 >> mktemp
 done

 sed -i 's/plugin=2/plugin=0/g' mktemp

 cp mktemp data/models/models.dat

 rm -v mktemp{,1}

 # remove nonfree software recommendation - https://labs.parabola.nu/issues/893
 sed -i 's/\, requires proprietary plugin//' $(grep -rlI '[,] requires proprietary plugin')

 echo "Preparing source"

 # disable insecure update - https://bugs.archlinux.org/task/38083
 patch -Np0 -i ${srcdir}/disable_upgrade.patch

 # add missing 'include <cups/ppd.h>' at various places
 patch -Np1 -i ${srcdir}/0022-Add-include-cups-ppd.h-in-various-places-as-CUPS-2.2.patch
 # fix some handling unicode file names FS#58412
 patch -Np1 -i ${srcdir}/0023-Fix-handling-of-unicode-filenames-in-sixext.py.patch
 # remove binary blob libImageProcessor and all linking - FS#59681
 patch -Np1 -i ${srcdir}/0025-Remove-all-ImageProcessor-functionality-which-is-clo.patch

 export AUTOMAKE='automake --foreign'
 autoreconf --force --install
}

build() {
 cd $pkgname-$pkgver
 ./configure --prefix=/usr \
             --enable-qt5 \
             --disable-qt4 \
             --enable-hpcups-install \
             --enable-cups-drv-install \
             --enable-pp-build #--help
 make
}

package() {
 cd $pkgname-$pkgver
 make -j1 rulesdir=/usr/lib/udev/rules.d DESTDIR="$pkgdir/" install

 # remove config provided by sane and autostart of hp-daemon
 rm -rf "$pkgdir"/etc/{sane.d,xdg}
 install -dm755 ${pkgdir}/etc/sane.d/dll.d
 echo hpaio > ${pkgdir}/etc/sane.d/dll.d/hpaio

 # remove HAL .fdi file because HAL is no longer used
 rm -vrf "$pkgdir"/usr/share/hal

 # remove rc script
 rm -vrf "$pkgdir"/etc/init.d

 # add mixed license file
 install -Dt "${pkgdir}"/usr/share/licenses/${pkgname} -m644 COPYING
}