Re: [Hyperbola] Going the way and packaging, the roadmap after 0.4
The lite hplip build does not work with scanning as too many libraries are removed. This PKGBUILD works - I removed the /usr/bin and /usr/share/applications/ directories.
# 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: André Silva <emulatorman@hyperbola.info>
# Contributor: Jorge López <jorginho@hyperbola.info>
# Contributor: Márcio Silva <coadde@hyperbola.info>
# Contributor: Tobias Dausend <throgh@hyperbola.info>
pkgname=hplip
pkgver=3.21.2
_debver=3.21.2+dfsg1
_debrel=2
pkgrel=1
pkgdesc="Drivers for HP DeskJet, OfficeJet, Photosmart, Business Inkjet and some LaserJet"
arch=('i686' 'x86_64')
url="https://developers.hp.com/hp-linux-imaging-and-printing"
license=('GPL-2')
depends=('ghostscript' 'net-snmp' 'foomatic-db-engine')
makedepends=('sane' 'rpcbind' 'cups' 'libusb' 'quilt')
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'
'libusb: for advanced usb support'
'wget: for network support')
backup=('etc/hp/hplip.conf'
'etc/sane.d/dll.d/hpaio')
source=(https://downloads.sourceforge.net/${pkgname}/$pkgname-$pkgver.tar.gz{,.asc}
https://deb.debian.org/debian/pool/main/h/hplip/hplip_$_debver-$_debrel.debian.tar.xz
disable_upgrade.patch
0022-Add-include-cups-ppd.h-in-various-places-as-CUPS-2.2.patch
remove-systemd-support.patch)
sha512sums=('73ba37275cfe34a58b81c9656514e15da67c1a69af5471ad132a1538d324efe640879cb7e60c359915607e41b63e653e7ae757661e553235f6e83e378ab46474'
'SKIP'
'771bfae13f452f637696ef7947e95c21e5cb514cd613fb15d182f0e0fbb02ce60684c75a7cb8245423bbcffe2c7d1a155f4109fe1769b0badb7d006bb9406ff2'
'd6a6b1de0fb6a0d6af6badd81088bc2b493d894057a520ccd70abee0adc7e1b019aae641600c10d4d2053c8677b14897b40a0a306374a5702a7cd7bdeabd736e'
'22aeb5b851f78bc6bc62e0bc3da99fecaf42d7604af41e2f3343f8d3666541f7b06b7d1a7d0ddf24f1731ac7b12dfe582375a98e3b94dfa323d6ce954549ca67'
'abd64e02965190cdfb7f7fd65d1875da4420594b627cd85b7f1da1f69a823b55358146e02d81e50e90000e21ba6e69d25fbb785dd489f1f3f461e50ce16f11e7')
validpgpkeys=('4ABA2F66DBD5A95894910E0673D770CDA59047B9') # HPLIP (HP Linux Imaging and Printing) <hplip@hp.com>
prepare() {
cd $pkgname-$pkgver
if [[ ${pkgver%.*} = ${_debver%.*} ]]; then
# Debian patches
export QUILT_PATCHES=debian/patches
export QUILT_REFRESH_ARGS='-p ab --no-timestamps --no-index'
export QUILT_DIFF_ARGS='--no-timestamps'
mv "$srcdir"/debian .
# Doesn't apply
rm -v debian/patches/0022-LaserJet-PostScript-4000-PPD-bugfix.patch || true
rm -v debian/patches/0052-IEEE1284-Device-ID-for-HP-LaserJet-4000.patch || true
rm -v debian/patches/0053-Fix-ImageableArea-for-Laserjet-8150-9000.patch || true
quilt push -av
else
# 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
fi
# 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 systemd support
patch -p1 -i ../remove-systemd-support.patch
# remove nonfree software recommendation - https://labs.parabola.nu/issues/893
sed -i 's/\, requires proprietary plugin//' $(grep -rlI '[,] requires proprietary plugin')
# disable insecure update
patch -Np0 -i ${srcdir}/disable_upgrade.patch
export AUTOMAKE='automake --foreign'
autoreconf --force --install
}
build() {
cd $pkgname-$pkgver
# disable dbus for build including fax
# avahi is needed for network, also disabled
./configure --prefix=/usr \
--with-cupsbackenddir=/usr/libexec/cups/backend \
--with-cupsfilterdir=/usr/libexec/cups/filter \
--enable-lite-build=no \
--disable-network-build \
--disable-qt4 \
--disable-fax-build \
--disable-dbus-build \
--disable-gui-build \
--enable-hpcups-install=yes \
--enable-new-hpcups=yes \
--disable-network-build \
--enable-hpps-install=yes \
--disable-doc-build \
--enable-pp-build=yes \
--enable-cups-ppd-install=yes \
--enable-foomatic-drv-install=yes \
--enable-foomatic-ppd-install=yes
make
}
package() {
cd $pkgname-$pkgver
make -j1 rulesdir=/lib/udev/rules.d DESTDIR="$pkgdir/" install
# install license
install -Dm644 COPYING "$pkgdir"/usr/share/licenses/$pkgname/COPYING
# 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
# cleanup
rm -rf "$pkgdir"/usr/share/applications
rm -rf "$pkgdir"/usr/bin
}