1SUMMARY = "TrouSerS - An open-source TCG Software Stack implementation."
2LICENSE = "BSD-3-Clause"
3HOMEPAGE = "http://sourceforge.net/projects/trousers/"
4LIC_FILES_CHKSUM = "file://README;startline=3;endline=4;md5=2af28fbed0832e4d83a9e6dd68bb4413"
5SECTION = "security/tpm"
6
7DEPENDS = "openssl"
8
9SRCREV = "94144b0a1dcef6e31845d6c319e9bd7357208eb9"
10PV = "0.3.15+git${SRCPV}"
11
12SRC_URI = " \
13	git://git.code.sf.net/p/trousers/trousers;branch=master \
14    	file://trousers.init.sh \
15    	file://trousers-udev.rules \
16    	file://tcsd.service \
17        file://get-user-ps-path-use-POSIX-getpwent-instead-of-getpwe.patch \
18        file://0001-build-don-t-override-localstatedir-mandir-sysconfdir.patch \
19    	"
20
21S = "${WORKDIR}/git"
22
23inherit autotools pkgconfig useradd update-rc.d ${@bb.utils.contains('VIRTUAL-RUNTIME_init_manager','systemd','systemd','', d)}
24
25PACKAGECONFIG ?= "gmp "
26PACKAGECONFIG[gmp] = "--with-gmp, --with-gmp=no, gmp"
27PACKAGECONFIG[gtk] = "--with-gui=gtk, --with-gui=none, gtk+"
28
29do_install () {
30    oe_runmake DESTDIR=${D} install
31}
32
33do_install:append() {
34    install -d ${D}${sysconfdir}/init.d
35    install -m 0755 ${WORKDIR}/trousers.init.sh ${D}${sysconfdir}/init.d/trousers
36    install -d ${D}${sysconfdir}/udev/rules.d
37    install -m 0644 ${WORKDIR}/trousers-udev.rules ${D}${sysconfdir}/udev/rules.d/45-trousers.rules
38
39    if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
40        install -d ${D}${systemd_unitdir}/system
41        install -m 0644 ${WORKDIR}/tcsd.service ${D}${systemd_unitdir}/system/
42        sed -i -e 's#@SBINDIR@#${sbindir}#g' ${D}${systemd_unitdir}/system/tcsd.service
43    fi
44}
45
46CONFFILES:${PN} += "${sysconfig}/tcsd.conf"
47
48PROVIDES = "${PACKAGES}"
49PACKAGES = " \
50	libtspi \
51	libtspi-dbg \
52	libtspi-dev \
53	libtspi-doc \
54	libtspi-staticdev \
55	trousers \
56	trousers-dbg \
57	trousers-doc \
58	"
59
60# libtspi needs tcsd for most (all?) operations, so suggest to
61# install that.
62RRECOMMENDS:libtspi = "${PN}"
63
64FILES:libtspi = " \
65	${libdir}/*.so.1 \
66	${libdir}/*.so.1.2.0 \
67	"
68FILES:libtspi-dbg = " \
69	${libdir}/.debug \
70	${prefix}/src/debug/${PN}/${PV}-${PR}/git/src/tspi \
71	${prefix}/src/debug/${PN}/${PV}-${PR}/git/src/trspi \
72	${prefix}/src/debug/${PN}/${PV}-${PR}/git/src/include/*.h \
73	${prefix}/src/debug/${PN}/${PV}-${PR}/git/src/include/tss \
74	"
75FILES:libtspi-dev = " \
76	${includedir} \
77	${libdir}/*.so \
78	"
79FILES:libtspi-doc = " \
80	${mandir}/man3 \
81	"
82FILES:libtspi-staticdev = " \
83	${libdir}/*.la \
84	${libdir}/*.a \
85	"
86FILES:${PN} = " \
87	${sbindir}/tcsd \
88	${sysconfdir} \
89	${localstatedir} \
90	"
91
92FILES:${PN}-dev += "${libdir}/trousers"
93
94FILES:${PN}-dbg = " \
95	${sbindir}/.debug \
96	${prefix}/src/debug/${PN}/${PV}-${PR}/git/src/tcs \
97	${prefix}/src/debug/${PN}/${PV}-${PR}/git/src/tcsd \
98	${prefix}/src/debug/${PN}/${PV}-${PR}/git/src/tddl \
99	${prefix}/src/debug/${PN}/${PV}-${PR}/git/src/trousers \
100	${prefix}/src/debug/${PN}/${PV}-${PR}/git/src/include/trousers \
101	"
102FILES:${PN}-doc = " \
103	${mandir}/man5 \
104	${mandir}/man8 \
105	"
106
107FILES:${PN} += "${systemd_unitdir}/*"
108
109INITSCRIPT_NAME = "trousers"
110INITSCRIPT_PARAMS = "start 99 2 3 4 5 . stop 19 0 1 6 ."
111
112USERADD_PACKAGES = "${PN}"
113GROUPADD_PARAM:${PN} = "--system tss"
114USERADD_PARAM:${PN} = "--system -M -d /var/lib/tpm -s /bin/false -g tss tss"
115
116SYSTEMD_PACKAGES = "${PN}"
117SYSTEMD_SERVICE:${PN} = "tcsd.service"
118SYSTEMD_AUTO_ENABLE = "disable"
119
120BBCLASSEXTEND = "native"
121