summaryrefslogtreecommitdiff
blob: fa8335f3ab188c00979618fd8bc5afb35889c417 (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
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

inherit unpacker

DESCRIPTION="Proprietary plugins and firmware for HPLIP"
HOMEPAGE="https://developers.hp.com/hp-linux-imaging-and-printing/plugins"
SRC_URI="https://developers.hp.com/sites/default/files/hplip-${PV}-plugin.run"
LICENSE="hplip-plugin"
SLOT="0"
KEYWORDS="~amd64 ~arm ~x86"
IUSE="orblite"

RDEPEND="
	~net-print/hplip-${PV}
	virtual/udev
	orblite? (
		media-gfx/sane-backends
		>=sys-libs/glibc-2.26
		virtual/libusb:0
	)
"
DEPEND=""

S=${WORKDIR}

HPLIP_HOME=/usr/share/hplip

# Binary prebuilt package
QA_PREBUILT="${HPLIP_HOME}/*.so"

# License does not allow us to redistribute the "source" package
RESTRICT="mirror"

src_install() {
	local hplip_arch
	case "${ARCH}" in
		amd64) hplip_arch="x86_64" ;;
		arm)   hplip_arch="arm32"  ;;
		x86)   hplip_arch="x86_32" ;;
		*)     die "Unsupported architecture." ;;
	esac

	insinto "${HPLIP_HOME}"/data/firmware
	doins *.fw.gz

	for plugin in *-${hplip_arch}.so; do
		local plugin_type=prnt
		case "${plugin}" in
			bb_orblite-*)
				use orblite || continue
				plugin_type=scan ;;
			bb_*)
				plugin_type=scan ;;
			fax_*)
				plugin_type=fax ;;
		esac

		exeinto "${HPLIP_HOME}"/${plugin_type}/plugins
		newexe ${plugin} ${plugin/-${hplip_arch}}
	done

	insinto /var/lib/hp
	newins - hplip.state <<-_EOF_
		[plugin]
		installed = 1
		eula = 1
		version = ${PV}
	_EOF_
}