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

EAPI=8

PYTHON_COMPAT=( python3_1{0..2} )
inherit linux-info python-any-r1 meson udev

DESCRIPTION="Userspace system daemon to enable security levels for Thunderbolt 3"
HOMEPAGE="https://gitlab.freedesktop.org/bolt/bolt"
SRC_URI="https://gitlab.freedesktop.org/${PN}/${PN}/-/archive/${PV}/${P}.tar.bz2"

LICENSE="LGPL-2.1 GPL-2+"
SLOT="0"
KEYWORDS="~amd64 ~loong ~riscv ~x86"
IUSE="selinux test"
RESTRICT="!test? ( test )"

RDEPEND="
	>=dev-libs/glib-2.56.0:2
	virtual/libudev:=
	virtual/udev
	sys-auth/polkit[introspection]
	selinux? ( sec-policy/selinux-thunderbolt )
"
DEPEND="
	${RDEPEND}
	test? (
		dev-util/umockdev
	)
"
BDEPEND="
	app-text/asciidoc
	dev-util/glib-utils
	virtual/pkgconfig
	test? (
		dev-util/umockdev
		${PYTHON_DEPS}
		$(python_gen_any_dep \
			'dev-python/pygobject[${PYTHON_USEDEP}]' \
			'dev-python/dbus-python[${PYTHON_USEDEP}]' \
			'dev-python/python-dbusmock[${PYTHON_USEDEP}]'
		)
	)
"

pkg_setup() {
	if use kernel_linux && kernel_is lt 5 6; then
		CONFIG_CHECK="~THUNDERBOLT"
		ERROR_THUNDERBOLT="This package requires the thunderbolt kernel driver."
	else
		CONFIG_CHECK="~USB4"
		ERROR_USB4="This package requires the USB4 kernel driver for Thunderbolt support."
	fi
	CONFIG_CHECK+=" ~HOTPLUG_PCI"
	ERROR_HOTPLUG_PCI="Thunderbolt requires PCI hotplug support."

	linux-info_pkg_setup
	python-any-r1_pkg_setup
}

src_configure() {
	local emesonargs=(
		-Dman=true
		--sysconfdir="${EPREFIX}"/etc
		--localstatedir="${EPREFIX}"/var
		--sharedstatedir="${EPREFIX}"/var/lib
	)
	meson_src_configure
}

src_install() {
	meson_src_install
	newinitd "${FILESDIR}"/${PN}.openrc-r1 boltd
	keepdir /var/lib/boltd
}

pkg_postinst() {
	udev_reload
}

pkg_postrm() {
	udev_reload
}