aboutsummaryrefslogtreecommitdiff
path: root/srcpkgs/hplip/template
blob: aea65d01b05362b5bd5bae6a1108613df833f795 (plain) (blame)
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
# Template file for 'hplip'
# When possible, keep this package in sync with hplip-plugin
pkgname=hplip
version=3.24.4
revision=2
build_style=gnu-configure
pycompile_dirs="usr/share/hplip"
configure_args="
 --enable-gui-build
 --disable-qt4
 --enable-qt5
 --disable-foomatic-rip-hplip-install
 --enable-foomatic-ppd-install
 --enable-hpcups-install
 --enable-new-hpcups
 --enable-cups-ppd-install
 --enable-cups-drv-install
 --enable-hpijs-install
 --enable-foomatic-drv-install
 --enable-pp-build
 --disable-imageProcessor-build
 --with-mimedir=/usr/share/cups/mime"
conf_files="/etc/hp/hplip-nogui.conf"
make_dirs="/var/lib/hp 0755 root root"
hostmakedepends="pkg-config automake libtool python3 python3-setuptools"
makedepends="openssl-devel python3-devel libxml2-python3 cups-devel sane-devel
 ghostscript-devel net-snmp-devel libusb-devel libjpeg-turbo-devel dbus-devel
 avahi-libs-devel zlib-devel"
depends="python3-gobject python3-dbus desktop-file-utils
 foomatic-db foomatic-db-engine python3-distro"
short_desc="HP Linux Imaging and Printing"
maintainer="Orphaned <orphan@voidlinux.org>"
license="GPL-2.0-only, BSD-3-Clause, MIT"
homepage="https://developers.hp.com/hp-linux-imaging-and-printing"
changelog="https://developers.hp.com/hp-linux-imaging-and-printing/release_notes"
distfiles="${SOURCEFORGE_SITE}/hplip/hplip/${version}/hplip-${version}.tar.gz"
checksum=5d7643831893a5e2addf9d42d581a5dbfe5aaf023626886b8762c5645da0f1fb

CFLAGS="-I${XBPS_CROSS_BASE}/usr/include/libusb-1.0 -I${XBPS_CROSS_BASE}/${py3_inc}"

pre_configure() {
	export AUTOMAKE='automake --foreign'
	libtoolize -f
	autoreconf -fi || true
}

do_install() {
	# remove wildcard install of ppd files to avoid errors when overwriting
	sed -i Makefile -e "s;ppd/hpcups/\\*.ppd.gz;;g"
	make locatedriverdir=/usr/libexec/hplip dat2drvdir=/usr/libexec/hplip \
		rulesdir=/usr/lib/udev/rules.d DESTDIR=${DESTDIR} install

	# Move sane config to dll.d to avoid conflicts
	vmkdir etc/sane.d/dll.d
	mv ${DESTDIR}/etc/sane.d/dll.conf ${DESTDIR}/etc/sane.d/dll.d/hplip

	# This directory is a hard requirement, prevent its removal
	vmkdir usr/share/cups/model
	touch ${DESTDIR}/usr/share/cups/model/.hplip

	# remove autostart of hp-daemon
	rm -rf ${DESTDIR}/etc/xdg
	# remove unwanted files
	rm -f ${DESTDIR}/usr/share/doc/hplip-${version}/{copyright,README_LIBJPG,COPYING}
	# remove HAL .fdi file because HAL is no longer used
	rm -rf ${DESTDIR}/usr/share/hal
	rm -rf ${DESTDIR}/var
	# remove systemd service file
	rm -rf ${DESTDIR}/usr/lib/systemd
	# save gui-version of hplip.conf
	local _confdir="${DESTDIR}/etc/hp"
	mv "${_confdir}/hplip.conf" "${_confdir}/hplip-gui.conf"
	# adjust values to non-gui version
	sed -e "s/\(gui-build=\).*/\1no/" \
		-e "s/\(ui-toolkit=\).*/\1no/" \
		-e "s/\(qt5=\).*/\1no/" \
		"${_confdir}/hplip-gui.conf" > "${_confdir}/hplip-nogui.conf"
	# licenses
	vlicense COPYING
	vlicense copyright
}

hplip-gui_package() {
	depends="${sourcepkg}>=${version}_${revision} python3-gobject
	 python3-dbus desktop-file-utils foomatic-db foomatic-db-engine
	 python3-distro python3-PyQt5-dbus"
	short_desc+=" (GUI utilities)"
	python_version=3
	conf_files="/etc/hp/hplip-gui.conf"
	pkg_install() {
		local _app _apps

		_apps="devicesettings faxsetup linefeedcal toolbox
		 print printsettings pqdiag uiscan wificonfig"

		for _app in ${_apps}; do
			vmove "usr/bin/hp-${_app}"
			vmove "usr/share/hplip/${_app}.py"
		done

		vmove usr/share/applications
		vmove usr/share/hplip/ui5
		vmove usr/share/hplip/data/images

		vmove etc/hp/hplip-gui.conf
	}
}