1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
7 inherit autotools eutils linux-info readme.gentoo systemd user udev
9 #MY_P="${PN}-${PV%.*}-${PV##*.}"
11 DESCRIPTION="An open-source TCG Software Stack (TSS) v1.1 implementation"
12 HOMEPAGE="http://trousers.sf.net"
13 SRC_URI="mirror://sourceforge/trousers/${P}.tar.gz"
15 LICENSE="CPL-1.0 GPL-2"
17 KEYWORDS="~amd64 ~arm ~arm64 ~m68k ~ppc ~ppc64 ~s390 ~sh ~x86"
18 IUSE="doc libressl selinux" # gtk
20 # gtk support presently does NOT compile.
21 # gtk? ( >=x11-libs/gtk+-2 )
23 CDEPEND=">=dev-libs/glib-2
24 !libressl? ( >=dev-libs/openssl-0.9.7:0 )
25 libressl? ( dev-libs/libressl )
30 selinux? ( sec-policy/selinux-tcsd )"
31 # S="${WORKDIR}/${P}git"
33 DOCS="AUTHORS ChangeLog NICETOHAVES README TODO"
36 If you have problems starting tcsd, please check permissions and
37 ownership on /dev/tpm* and ~tss/system.data
41 # Check for driver (not sure it can be an rdep, because ot depends on the
42 # version of virtual/linux-sources... Is that supported by portage?)
44 local tpm_kernel_version tpm_kernel_present tpm_module
45 kernel_is ge 2 6 12 && tpm_kernel_version="yes"
46 if linux_config_exists; then
47 linux_chkconfig_present TCG_TPM && tpm_kernel_present="yes"
49 ewarn "No kernel configuration could be found."
51 has_version app-crypt/tpm-emulator && tpm_module="yes"
52 if [[ -n "${tpm_kernel_present}" ]]; then
53 einfo "Good, you seem to have in-kernel TPM support."
54 elif [[ -n "${tpm_module}" ]]; then
55 einfo "Good, you seem to have TPM support with the external module."
56 if [[ -n "${tpm_kernel_version}" ]]; then
58 elog "Note that since you have a >=2.6.12 kernel, you could use"
59 elog "the in-kernel driver instead of (CONFIG_TCG_TPM)."
61 elif [[ -n "${tpm_kernel_version}" ]]; then
63 eerror "To use this package, you will have to activate TPM support"
64 eerror "in your kernel configuration. That's at least CONFIG_TCG_TPM,"
65 eerror "plus probably a chip specific driver (like CONFIG_TCG_ATMEL)."
69 eerror "To use this package, you should install a TPM driver."
70 eerror "You can have the following options:"
71 eerror " - install app-crypt/tpm-emulator"
72 eerror " - switch to a >=2.6.12 kernel and compile the kernel module"
76 # New user/group for the daemon
78 enewuser tss -1 -1 /var/lib/tpm tss
82 epatch "${FILESDIR}"/${P}-nouseradd.patch
83 epatch "${FILESDIR}"/${P}-build.patch
84 epatch "${FILESDIR}"/${P}-musl-fixes.patch
85 mv configure.in configure.ac || die
90 # econf --with-gui=$(usex gtk gtk openssl)
91 econf --with-gui=openssl
97 use doc && dodoc doc/*
98 newinitd "${FILESDIR}"/tcsd.initd tcsd
99 newconfd "${FILESDIR}"/tcsd.confd tcsd
100 systemd_dounit "${FILESDIR}"/tcsd.service
101 udev_dorules "${FILESDIR}"/61-trousers.rules
102 fowners tss:tss /var/lib/tpm
104 readme.gentoo_create_doc