summaryrefslogtreecommitdiff
blob: 6ede7d5e055caad0d3a53f97e0257188473c8929 (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-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

PYTHON_COMPAT=( python3_{8,9} )
inherit autotools bash-completion-r1 python-single-r1

DESCRIPTION="Tools for the TPM 2.0 TSS"
HOMEPAGE="https://github.com/tpm2-software/tpm2-tools"
SRC_URI="https://github.com/tpm2-software/${PN}/releases/download/${PV}/${P}.tar.gz"

LICENSE="BSD"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="+fapi test"

RDEPEND=">=app-crypt/tpm2-tss-3.0.1[fapi?]
	dev-libs/openssl:=
	net-misc/curl
	sys-libs/efivar:=
	${PYTHON_DEPS}"
DEPEND="${RDEPEND}
	test? (
		app-crypt/swtpm
		app-crypt/tpm2-abrmd
		app-editors/vim-core
		dev-tcltk/expect
		dev-util/cmocka
		dev-python/pyyaml
	)"
BDEPEND="virtual/pkgconfig
	sys-devel/autoconf-archive"

RESTRICT="!test? ( test )"
REQUIRED_USE=" ${PYTHON_REQUIRED_USE} "

# One of the tests fails without this patch. See
# https://github.com/tpm2-software/tpm2-tools/issues/2767
PATCHES=(
	"${FILESDIR}/${PN}-5.1.1-fix-tpm-checkquote.patch"
	"${FILESDIR}/${PN}-5.1.1-no-efivar-automagic.patch"
)

src_prepare() {
	sed -i \
	"s/m4_esyscmd_s(\[git describe --tags --always --dirty\])/${PV}/" \
	"${S}/configure.ac" || die
	"${S}/scripts/utils/man_to_bashcompletion.sh"
	default
	eautoreconf
}

src_configure() {
	econf \
		$(use_enable fapi) \
		$(use_enable test unit) \
		--with-bashcompdir=$(get_bashcompdir) \
		--enable-hardening
}

src_install() {
	default

	mv "${D}/$(get_bashcompdir)/tpm2_completion.bash" \
	   "${D}/$(get_bashcompdir)/tpm2" || die
	for B in "${D}"/usr/bin/tpm2_*
	do
		TPM2_UTILS="${TPM2_UTILS} $(basename ${B})"
	done
	bashcomp_alias tpm2 ${TPM2_UTILS}
}