summaryrefslogtreecommitdiff
blob: d58b7c4f856a71bd8f6e8a8c4c09952a080faa8d (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
# Copyright 1999-2012 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.7.4-r1.ebuild,v 1.1 2012/12/24 17:13:25 alonbl Exp $

EAPI=2
inherit user linux-mod cmake-utils udev

MY_P=${P/-/_}
DESCRIPTION="Emulator driver for tpm"
HOMEPAGE="https://developer.berlios.de/projects/tpm-emulator"
SRC_URI="mirror://berlios/tpm-emulator/${MY_P}.tar.gz"
LICENSE="GPL-2"

SLOT="0"
KEYWORDS="~amd64 ~x86"

IUSE="ssl modules"
RDEPEND="ssl? ( dev-libs/openssl )"
DEPEND="${RDEPEND}
	!ssl? ( dev-libs/gmp )"

S=${WORKDIR}/${P/-/_}

pkg_setup() {
	enewuser tss -1 -1 /var/lib/tpm tss
	if use modules; then
		CONFIG_CHECK="MODULES"
		linux-mod_pkg_setup
		BUILD_TARGETS="all"
		BUILD_PARAMS="KERNEL_BUILD=${KERNEL_DIR}"
	fi
}

src_prepare() {
	# do not build and install the kernel module
	sed -i 's/COMMAND ${tpmd_dev_BUILD_CMD}//' tpmd_dev/CMakeLists.txt || die
	sed -i 's/install(CODE.*//' tpmd_dev/CMakeLists.txt || die
}

src_configure() {
	mycmakeargs=(
		$(cmake-utils_use_use ssl OPENSSL)
	)
	cmake-utils_src_configure

	# only here we have BUILD_DIR
	MODULE_NAMES="tpmd_dev(misc:${BUILD_DIR}/tpmd_dev/linux)"
}

src_compile() {
	cmake-utils_src_compile
	use modules && linux-mod_src_compile
	emake -C ${BUILD_DIR}/tpmd_dev/linux tpmd_dev.rules
}

src_install() {
	cmake-utils_src_install
	use modules && linux-mod_src_install

	dodoc README

	udev_newrules "${BUILD_DIR}/tpmd_dev/linux/tpmd_dev.rules" 60-tpmd_dev.rules

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

	keepdir /var/log/tpm
	fowners tss:tss /var/log/tpm
}