]>
Commit | Line | Data |
---|---|---|
bc65ae11 JB |
1 | # |
2 | # Conditional build: | |
bc65ae11 JB |
3 | %bcond_without kernel # don't build kernel modules |
4 | %bcond_without userspace # don't build userspace packages | |
5 | %bcond_with verbose # verbose kernel module build | |
6 | # | |
d2539c8b JR |
7 | # The goal here is to have main, userspace, package built once with |
8 | # simple release number, and only rebuild kernel packages with kernel | |
9 | # version as part of release number, without the need to bump release | |
10 | # with every kernel change. | |
11 | %if 0%{?_pld_builder:1} && %{with kernel} && %{with userspace} | |
12 | %{error:kernel and userspace cannot be built at the same time on PLD builders} | |
13 | exit 1 | |
14 | %endif | |
15 | ||
d2539c8b JR |
16 | %if %{without userspace} |
17 | # nothing to be placed to debuginfo package | |
18 | %define _enable_debug_packages 0 | |
bc65ae11 | 19 | %endif |
87c325d0 | 20 | |
d2539c8b JR |
21 | %define _duplicate_files_terminate_build 0 |
22 | ||
87c325d0 | 23 | %define pname tpm_emulator |
9799b8e2 | 24 | %define rel 11 |
bc65ae11 JB |
25 | Summary: Software-based TPM and MTM Emulator |
26 | Summary(pl.UTF-8): Programowy emulator TPM i MTM | |
89bab1a7 | 27 | Name: %{pname}%{?_pld_builder:%{?with_kernel:-kernel}}%{_alt_kernel} |
bc65ae11 | 28 | Version: 0.7.4 |
89bab1a7 | 29 | Release: %{rel}%{?_pld_builder:%{?with_kernel:@%{_kernel_ver_str}}} |
bc65ae11 JB |
30 | License: GPL v2+ |
31 | Group: Applications/System | |
32 | Source0: http://downloads.sourceforge.net/tpm-emulator.berlios/%{pname}-%{version}.tar.gz | |
33 | # Source0-md5: e26becb8a6a2b6695f6b3e8097593db8 | |
f47ff032 | 34 | Patch0: %{pname}-libdir.patch |
bc65ae11 JB |
35 | URL: http://tpm-emulator.berlios.de/ |
36 | BuildRequires: cmake >= 2.4 | |
37 | BuildRequires: gmp-devel | |
0b135ccf JR |
38 | BuildRequires: rpmbuild(macros) >= 1.701 |
39 | %{?with_kernel:%{expand:%buildrequires_kernel kernel%%{_alt_kernel}-module-build >= 3:2.6.20.2}} | |
bc65ae11 JB |
40 | Requires: %{name}-libs = %{version}-%{rel} |
41 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
42 | ||
43 | %description | |
44 | Software-based TPM and MTM Emulator. | |
45 | ||
46 | %description -l pl.UTF-8 | |
47 | Programowy emulator TPM i MTM. | |
48 | ||
49 | %package libs | |
50 | Summary: TSS-conformant device driver library for the emulator | |
51 | Summary(pl.UTF-8): Biblioteka sterownika urządzenia zgodnego z TSS dla emulatora | |
52 | Group: Libraries | |
53 | ||
54 | %description libs | |
55 | TSS-conformant device driver library for the emulator. | |
56 | ||
57 | %description libs -l pl.UTF-8 | |
58 | Biblioteka sterownika urządzenia zgodnego z TSS dla emulatora. | |
59 | ||
60 | %package devel | |
61 | Summary: Header file for TDDL library | |
62 | Summary(pl.UTF-8): Plik nagłówkowy biblioteki TDDL | |
63 | Group: Development/Libraries | |
64 | Requires: %{name}-libs = %{version}-%{rel} | |
65 | ||
66 | %description devel | |
67 | Header file for TDDL library. | |
68 | ||
69 | %description devel -l pl.UTF-8 | |
70 | Plik nagłówkowy biblioteki TDDL. | |
71 | ||
72 | %package static | |
73 | Summary: Static TDDL library | |
74 | Summary(pl.UTF-8): Statyczna biblioteka TDDL | |
75 | Group: Development/Libraries | |
76 | Requires: %{name}-devel = %{version}-%{rel} | |
77 | ||
78 | %description static | |
79 | Static TDDL library. | |
80 | ||
81 | %description static -l pl.UTF-8 | |
82 | Statyczna biblioteka TDDL. | |
83 | ||
d2539c8b JR |
84 | %define kernel_pkg()\ |
85 | %package -n kernel%{_alt_kernel}-char-tpmd\ | |
86 | Summary: Kernel module that provides /dev/tpm device\ | |
87 | Summary(pl.UTF-8): Moduł jądra udostępniający urządzenie /dev/tpm\ | |
e6071562 | 88 | Release: %{rel}@%{_kernel_ver_str}\ |
d2539c8b | 89 | Group: Base/Kernel\ |
d2539c8b JR |
90 | %requires_releq_kernel\ |
91 | Requires(postun): %releq_kernel\ | |
d2539c8b JR |
92 | \ |
93 | %description -n kernel%{_alt_kernel}-char-tpmd\ | |
94 | Kernel module that provides /dev/tpm device for backward compatibility\ | |
95 | and forwards the received commands to tpmd.\ | |
96 | \ | |
97 | %description -n kernel%{_alt_kernel}-char-tpmd -l pl.UTF-8\ | |
98 | Moduł jądra udostępniający dla kompatybilności urządzenie /dev/tpm i\ | |
99 | przekazujący odebrane polecenia do tpmd.\ | |
100 | \ | |
101 | %if %{with kernel}\ | |
102 | %files -n kernel%{_alt_kernel}-char-tpmd\ | |
103 | %defattr(644,root,root,755)\ | |
104 | /lib/modules/%{_kernel_ver}/misc/tpmd_dev.ko*\ | |
105 | /lib/udev/rules.d/80-tpmd_dev.rules\ | |
106 | %endif\ | |
107 | \ | |
108 | %post -n kernel%{_alt_kernel}-char-tpmd\ | |
109 | %depmod %{_kernel_ver}\ | |
110 | \ | |
111 | %postun -n kernel%{_alt_kernel}-char-tpmd\ | |
112 | %depmod %{_kernel_ver}\ | |
113 | %{nil} | |
114 | ||
115 | %define build_kernel_pkg()\ | |
116 | %build_kernel_modules -m tpmd_dev -C tpmd_dev/linux\ | |
117 | %install_kernel_modules -D installed -m tpmd_dev/linux/tpmd_dev -d misc\ | |
118 | %{nil} | |
119 | ||
0b135ccf | 120 | %{?with_kernel:%{expand:%create_kernel_packages}} |
bc65ae11 JB |
121 | |
122 | %prep | |
123 | %setup -q -n %{pname}-%{version} | |
f47ff032 | 124 | %patch0 -p1 |
bc65ae11 JB |
125 | |
126 | # separate kernel module from userspace build | |
127 | echo > tpmd_dev/CMakeLists.txt | |
128 | ||
129 | %build | |
130 | mkdir build | |
131 | cd build | |
132 | %cmake .. | |
133 | %if %{with userspace} | |
134 | %{__make} | |
135 | %endif | |
136 | cd .. | |
137 | %if %{with kernel} | |
138 | ln -sf ../../build/config.h tpmd_dev/linux/config.h | |
bc65ae11 | 139 | %{__make} -C tpmd_dev/linux tpmd_dev.rules |
0b135ccf | 140 | %{expand:%build_kernel_packages} |
bc65ae11 JB |
141 | %endif |
142 | ||
143 | %install | |
144 | rm -rf $RPM_BUILD_ROOT | |
145 | ||
146 | %if %{with userspace} | |
147 | %{__make} -C build install \ | |
148 | DESTDIR=$RPM_BUILD_ROOT | |
149 | %endif | |
150 | ||
151 | %if %{with kernel} | |
152 | install -d $RPM_BUILD_ROOT/lib/udev/rules.d | |
d2539c8b JR |
153 | cp -p tpmd_dev/linux/tpmd_dev.rules $RPM_BUILD_ROOT/lib/udev/rules.d/80-tpmd_dev.rules |
154 | cp -a installed/* $RPM_BUILD_ROOT | |
bc65ae11 JB |
155 | %endif |
156 | ||
157 | %clean | |
158 | rm -rf $RPM_BUILD_ROOT | |
159 | ||
160 | %post libs -p /sbin/ldconfig | |
161 | %postun libs -p /sbin/ldconfig | |
162 | ||
163 | %if %{with userspace} | |
164 | %files | |
165 | %defattr(644,root,root,755) | |
166 | %doc AUTHORS ChangeLog README | |
167 | %attr(755,root,root) %{_bindir}/tpmd | |
168 | ||
169 | %files libs | |
170 | %defattr(644,root,root,755) | |
171 | %attr(755,root,root) %{_libdir}/libtddl.so.*.*.*.* | |
172 | %attr(755,root,root) %ghost %{_libdir}/libtddl.so.1.2 | |
173 | ||
174 | %files devel | |
175 | %defattr(644,root,root,755) | |
176 | %attr(755,root,root) %{_libdir}/libtddl.so | |
177 | %{_includedir}/tddl.h | |
178 | ||
179 | %files static | |
180 | %defattr(644,root,root,755) | |
181 | %{_libdir}/libtddl.a | |
182 | %endif |