summaryrefslogtreecommitdiff
blob: daaad636e88aaeda400a6b9df80feeb5a39ac526 (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
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/app-crypt/tpm-emulator/tpm-emulator-0.5.ebuild,v 1.1 2007/06/23 20:00:20 alonbl Exp $

inherit toolchain-funcs linux-mod eutils

MY_P=${P/-/_}
DESCRIPTION="Emulator driver for tpm"
HOMEPAGE="https://developer.berlios.de/projects/tpm-emulator"

SRC_URI="http://download.berlios.de/tpm-emulator/${MY_P}.tar.gz"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~x86"
IUSE=""
DEPEND="dev-libs/gmp"
RDEPEND=""
S=${WORKDIR}/${P/-/_}

#fixups at:
#https://developer.berlios.de/feature/index.php?func=detailfeature&feature_id=3304&group_id=2491

pkg_setup() {
	linux-mod_pkg_setup
	MODULE_NAMES="tpmd_dev(crypt::${S}/tpmd_dev)"
	BUILD_TARGETS="all"
	BUILD_PARAMS="CC=$(tc-getCC)"
	enewuser tss
}

src_unpack() {
	unpack ${A}
	cd "${S}"
	sed -i 's/LDFLAGS :=/override LDFLAGS +=/g' tpmd/Makefile
	sed -i 's#/var/tpm#/var/run/tpm#g' tpmd/tpmd.c tddl/tddl.c tpm_dev/linux_module.c
}

src_install() {
	if [ -x /usr/bin/scanelf ]; then
		[ -z "$(/usr/bin/scanelf -qs __guard tpm_emulator.ko)" ] || \
			die 'cannot have gmp compiled with hardened flags'
		[ -z "$(/usr/bin/scanelf -qs __stack_smash_handler tpm_emulator.ko)" ] || \
			die 'cannot have gmp compiled with hardened flags'
	fi

	linux-mod_src_install
	dodoc README
	dosbin tpmd/tpmd
	dolib.so tddl/libtddl.so
	insinto /usr/include
	doins tddl/tddl.h
	newinitd "${FILESDIR}/${PN}.initd" "${PN}"
	insinto /etc/udev/rules.d
	newins "${FILESDIR}/${PN}.udev" "60-${PN}.rules"
	keepdir /var/run/tpm
	fowners tss /var/run/tpm
}