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