]> git.proxmox.com Git - swtpm.git/blame - dist/swtpm.spec.in
Allow choice of crypto subsystem via rpmbuild parameter
[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
969edf6f
SB
7# Valid crypto subsystems are 'freebl' and 'openssl'
8%if "%{crypto_subsystem}" == ""
9%define crypto_subsystem freebl
10%endif
11
e09fc276
SB
12Summary: TPM Emulator
13Name: %{name}
14Version: %{version}
83ef6c97 15Release: %{release}.dev2%{?dist}
e09fc276
SB
16License: BSD
17Group: Applications/Emulators
18Source: %{name}-%{version}.tar.gz
19BuildRoot: %{_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
28BuildRequires: automake autoconf bash coreutils libtool sed
29BuildRequires: libtpms-devel fuse-devel glib2-devel gmp-devel
6852f6c8 30BuildRequires: expect bash net-tools nss-devel socat
e09fc276 31%if %{with_gnutls}
95d41f7f 32BuildRequires: gnutls >= 3.1.0 gnutls-devel gnutls-utils
cb5dc4e9 33BuildRequires: libtasn1-devel libtasn1 kernel-modules-extra
ba2f0af6
SB
34%if 0%{?fedora}
35BuildRequires: libtasn1-tools
36%endif
e09fc276 37%endif
cb5dc4e9 38Requires: fuse expect kernel-modules-extra
e09fc276
SB
39
40%description
41TPM emulator built on libtpms providing TPM functionality for QEMU VMs
42
43%package libs
44Summary: Common libraries for TPM emulators
45Group: System Environment/Libraries
46License: BSD
47
48%description libs
49A library with callback functions for libtpms based TPM emulator
50
51%package cuse
52Summary: TPM emulator with CUSE interface
53Group: Applications/Emulators
5f1ef956 54License: BSD
e09fc276
SB
55BuildRequires: selinux-policy-devel
56
57%description cuse
58TPM Emulator with CUSE interface
59
60%package devel
61Summary: Include files for the TPM emulator's CUSE interface for usage by clients
62Group: Development/Libraries
63Requires: %{name}%{?_isa} = %{version}-%{release}
64
65%description devel
66Include files for the TPM emulator's CUSE interface.
67
68%package tools
69Summary: Tools for the TPM emulator
70License: BSD
71Group: Applications/Emulators
72Requires: swtpm fuse
95d41f7f 73Requires: trousers >= 0.3.9 tpm-tools >= 1.3.8-6 expect bash net-tools gnutls-utils
e09fc276
SB
74
75%description tools
76Tools 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
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
150%post cuse
151if [ -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
156fi
157
158if [ -n "$(type -p restorecon)" ]; then
159 restorecon /usr/bin/swtpm_cuse
160fi
161
162%postun cuse
efb0779c
SB
163if [ $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
170fi
171
172%post libs -p /sbin/ldconfig
173%postun libs -p /sbin/ldconfig
174
175%changelog