]>
Commit | Line | Data |
---|---|---|
e09fc276 SB |
1 | # --- swtpm rpm-spec --- |
2 | ||
3 | %define name @PACKAGE@ | |
4 | %define version @VERSION@ | |
5 | %define release 1 | |
6 | ||
7 | Summary: TPM Emulator | |
8 | Name: %{name} | |
9 | Version: %{version} | |
10 | Release: %{release}%{?dist} | |
11 | License: BSD | |
12 | Group: Applications/Emulators | |
13 | Source: %{name}-%{version}.tar.gz | |
14 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root | |
15 | ||
16 | # due to gnutls backlevel API: | |
17 | %if 0%{?rhel} >= 7 || 0%{?fedora} >= 19 | |
18 | %define with_gnutls 1 | |
19 | %else | |
20 | %define with_gnutls 0 | |
21 | %endif | |
22 | ||
23 | BuildRequires: automake autoconf bash coreutils libtool sed | |
24 | BuildRequires: libtpms-devel fuse-devel glib2-devel gmp-devel | |
09516897 | 25 | BuildRequires: expect bash net-tools nss-devel |
e09fc276 SB |
26 | %if %{with_gnutls} |
27 | BuildRequires: gnutls >= 3.1.0 gnutls-devel | |
cb5dc4e9 | 28 | BuildRequires: libtasn1-devel libtasn1 kernel-modules-extra |
ba2f0af6 SB |
29 | %if 0%{?fedora} |
30 | BuildRequires: libtasn1-tools | |
31 | %endif | |
e09fc276 | 32 | %endif |
cb5dc4e9 | 33 | Requires: fuse expect kernel-modules-extra |
e09fc276 SB |
34 | |
35 | %description | |
36 | TPM emulator built on libtpms providing TPM functionality for QEMU VMs | |
37 | ||
38 | %package libs | |
39 | Summary: Common libraries for TPM emulators | |
40 | Group: System Environment/Libraries | |
41 | License: BSD | |
42 | ||
43 | %description libs | |
44 | A library with callback functions for libtpms based TPM emulator | |
45 | ||
46 | %package cuse | |
47 | Summary: TPM emulator with CUSE interface | |
48 | Group: Applications/Emulators | |
49 | License: GPL | |
50 | BuildRequires: selinux-policy-devel | |
51 | ||
52 | %description cuse | |
53 | TPM Emulator with CUSE interface | |
54 | ||
55 | %package devel | |
56 | Summary: Include files for the TPM emulator's CUSE interface for usage by clients | |
57 | Group: Development/Libraries | |
58 | Requires: %{name}%{?_isa} = %{version}-%{release} | |
59 | ||
60 | %description devel | |
61 | Include files for the TPM emulator's CUSE interface. | |
62 | ||
63 | %package tools | |
64 | Summary: Tools for the TPM emulator | |
65 | License: BSD | |
66 | Group: Applications/Emulators | |
67 | Requires: swtpm fuse | |
68 | Requires: trousers >= 0.3.9 tpm-tools >= 1.3.7 expect bash net-tools | |
69 | ||
70 | %description tools | |
71 | Tools for the TPM emulator from the swtpm package | |
72 | ||
73 | %files | |
74 | %defattr(-,root,root,-) | |
75 | %attr( 755, root, root) %{_bindir}/swtpm | |
76 | %{_mandir}/man8/swtpm.8* | |
77 | ||
78 | %files cuse | |
79 | %defattr(-,root,root,-) | |
80 | %attr( 755, root, root) %{_bindir}/swtpm_cuse | |
81 | %{_mandir}/man8/swtpm_cuse.8* | |
82 | %attr( 755, root, root) %{_datadir}/swtpm/*.pp | |
83 | ||
84 | %files libs | |
85 | %{_libdir}/libswtpm_libtpms.so.* | |
86 | ||
87 | %files devel | |
88 | %defattr(-, root, root, -) | |
89 | %{_libdir}/libswtpm_libtpms.so | |
90 | ||
91 | %dir %{_includedir}/%{name} | |
92 | %attr(644, root, root) %{_includedir}/%{name}/*.h | |
93 | ||
94 | %files tools | |
95 | %defattr(-,root,root,-) | |
96 | %attr( 755, root, root) %{_bindir}/swtpm_bios | |
97 | %if %{with_gnutls} | |
98 | %attr( 755, root, root) %{_bindir}/swtpm_cert | |
99 | %endif | |
100 | %attr( 755, root, root) %{_bindir}/swtpm_setup | |
101 | %attr( 755, tss , tss) %{_bindir}/swtpm_setup.sh | |
102 | %attr( 755, root, root) %{_bindir}/swtpm_ioctl | |
103 | %{_mandir}/man8/swtpm_bios.8* | |
104 | %{_mandir}/man8/swtpm_cert.8* | |
105 | %{_mandir}/man8/swtpm_ioctl.8* | |
106 | %{_mandir}/man8/swtpm-localca.conf.8* | |
107 | %{_mandir}/man8/swtpm-localca.options.8* | |
108 | %{_mandir}/man8/swtpm-localca.sh.8* | |
109 | %{_mandir}/man8/swtpm_setup.8* | |
110 | %{_mandir}/man8/swtpm_setup.conf.8* | |
111 | %{_mandir}/man8/swtpm_setup.sh.8* | |
112 | %config(noreplace) %{_sysconfdir}/swtpm_setup.conf | |
113 | %config(noreplace) %{_sysconfdir}/swtpm-localca.options | |
114 | %config(noreplace) %{_sysconfdir}/swtpm-localca.conf | |
115 | %attr( 755, root, root) %{_datadir}/@PACKAGE@/swtpm-localca.sh | |
116 | ||
117 | ||
118 | %prep | |
119 | %setup -q | |
120 | ||
121 | %build | |
122 | ||
123 | ./bootstrap.sh | |
124 | %configure \ | |
125 | --prefix=/usr \ | |
126 | %if %{with_gnutls} | |
127 | --with-gnutls | |
128 | %endif | |
129 | ||
130 | make %{?_smp_mflags} | |
131 | ||
132 | %check | |
7d0fec4f | 133 | make %{?_smp_mflags} check |
e09fc276 SB |
134 | |
135 | %install | |
136 | ||
137 | make %{?_smp_mflags} install DESTDIR=${RPM_BUILD_ROOT} | |
138 | rm -f ${RPM_BUILD_ROOT}%{_libdir}/*.a ${RPM_BUILD_ROOT}%{_libdir}/*.la | |
139 | ||
140 | %post cuse | |
141 | if [ -n "$(type -p semodule)" ]; then | |
142 | for pp in /usr/share/swtpm/*.pp ; do | |
143 | echo "Activating SELinux policy $pp" | |
144 | semodule -i $pp | |
145 | done | |
146 | fi | |
147 | ||
148 | if [ -n "$(type -p restorecon)" ]; then | |
149 | restorecon /usr/bin/swtpm_cuse | |
150 | fi | |
151 | ||
152 | %postun cuse | |
153 | if [ -n "$(type -p semodule)" ]; then | |
154 | for p in swtpmcuse_svirt swtpmcuse ; do | |
155 | echo "Removing SELinux policy $p" | |
156 | semodule -r $p | |
157 | done | |
158 | fi | |
159 | ||
160 | %post libs -p /sbin/ldconfig | |
161 | %postun libs -p /sbin/ldconfig | |
162 | ||
163 | %changelog |