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