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