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

EAPI=8

inherit autotools flag-o-matic systemd

DESCRIPTION="TPM2 Access Broker & Resource Manager"
HOMEPAGE="https://github.com/tpm2-software/tpm2-abrmd"
SRC_URI="https://github.com/tpm2-software/${PN}/releases/download/${PV}/${P}.tar.gz"

LICENSE="BSD"
SLOT="0"
KEYWORDS="amd64 arm arm64 ppc64 ~riscv x86"
IUSE="static-libs test"

RESTRICT="!test? ( test )"

RDEPEND="acct-group/tss
	acct-user/tss
	sys-apps/dbus
	dev-libs/glib:=
	app-crypt/tpm2-tss:="
DEPEND="${RDEPEND}
	test? (
		app-crypt/swtpm
		>=app-crypt/tpm2-tss-3.0.0:=
		dev-util/cmocka
	)"
BDEPEND="virtual/pkgconfig
	dev-util/gdbus-codegen"

src_prepare() {
	default
	eautoreconf
}

src_configure() {
	# tests fail with LTO enabbled. See bug 865275
	filter-lto
	econf \
		$(use_enable static-libs static) \
		$(use_enable test unit) \
		$(use_enable test integration) \
		--disable-defaultflags \
		--with-dbuspolicydir="${EPREFIX}/etc/dbus-1/system.d" \
		--with-systemdpresetdir="$(systemd_get_systemunitdir)/../system-preset" \
		--with-systemdpresetdisable \
		--with-systemdsystemunitdir="$(systemd_get_systemunitdir)"
}

src_install() {
	default

	if [[ ${PV} != $(sed -n -e 's/^Version: //p' "${ED}/usr/$(get_libdir)/pkgconfig/tss2-tcti-tabrmd.pc" || die) ]] ; then
		# Safeguard for bug #833887
		die "pkg-config file version doesn't match ${PV}! Please report a bug!"
	fi

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

	newinitd "${FILESDIR}"/${PN}.initd ${PN}
	newconfd "${FILESDIR}"/${PN}.confd ${PN}
}