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

EAPI=8

inherit linux-info udev

DESCRIPTION="Yubico Universal 2nd Factor (U2F) Host C Library"
HOMEPAGE="https://developers.yubico.com/libu2f-host/"
SRC_URI="https://developers.yubico.com/${PN}/Releases/${P}.tar.xz"

LICENSE="LGPL-2"
SLOT="0"
KEYWORDS="amd64 ~arm64 ~ppc64 x86"
IUSE="systemd"

DEPEND="dev-libs/hidapi
	dev-libs/json-c:="
# The U2F device node will be owned by group 'plugdev'
# in non-systemd configurations
RDEPEND="${DEPEND}
	!systemd? ( acct-group/plugdev )
	systemd? ( sys-apps/systemd[acl] )"
BDEPEND="virtual/pkgconfig"

CONFIG_CHECK="~HIDRAW"

PATCHES=( "${FILESDIR}/${P}-json-boolean.patch" )

src_install() {
	default
	if use kernel_linux; then
		udev_dorules 70-u2f.rules
	fi

	find "${ED}" -name '*.la' -delete || die
}

pkg_postinst() {
	udev_reload

	if ! use systemd; then
		elog "Users must be a member of the 'plugdev' group"
		elog "to be able to access U2F devices"
	fi
}

pkg_postrm() {
	udev_reload
}