]>
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 |
d2539c8b | 43 | %define rel 8 |
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\ | |
107 | Group: Base/Kernel\ | |
108 | %if %{with dist_kernel}\ | |
109 | %requires_releq_kernel\ | |
110 | Requires(postun): %releq_kernel\ | |
111 | %endif\ | |
112 | \ | |
113 | %description -n kernel%{_alt_kernel}-char-tpmd\ | |
114 | Kernel module that provides /dev/tpm device for backward compatibility\ | |
115 | and forwards the received commands to tpmd.\ | |
116 | \ | |
117 | %description -n kernel%{_alt_kernel}-char-tpmd -l pl.UTF-8\ | |
118 | Moduł jądra udostępniający dla kompatybilności urządzenie /dev/tpm i\ | |
119 | przekazujący odebrane polecenia do tpmd.\ | |
120 | \ | |
121 | %if %{with kernel}\ | |
122 | %files -n kernel%{_alt_kernel}-char-tpmd\ | |
123 | %defattr(644,root,root,755)\ | |
124 | /lib/modules/%{_kernel_ver}/misc/tpmd_dev.ko*\ | |
125 | /lib/udev/rules.d/80-tpmd_dev.rules\ | |
126 | %endif\ | |
127 | \ | |
128 | %post -n kernel%{_alt_kernel}-char-tpmd\ | |
129 | %depmod %{_kernel_ver}\ | |
130 | \ | |
131 | %postun -n kernel%{_alt_kernel}-char-tpmd\ | |
132 | %depmod %{_kernel_ver}\ | |
133 | %{nil} | |
134 | ||
135 | %define build_kernel_pkg()\ | |
136 | %build_kernel_modules -m tpmd_dev -C tpmd_dev/linux\ | |
137 | %install_kernel_modules -D installed -m tpmd_dev/linux/tpmd_dev -d misc\ | |
138 | %{nil} | |
139 | ||
140 | %{?with_kernel:%{expand:%kpkg}} | |
bc65ae11 JB |
141 | |
142 | %prep | |
143 | %setup -q -n %{pname}-%{version} | |
f47ff032 | 144 | %patch0 -p1 |
bc65ae11 JB |
145 | |
146 | # separate kernel module from userspace build | |
147 | echo > tpmd_dev/CMakeLists.txt | |
148 | ||
149 | %build | |
150 | mkdir build | |
151 | cd build | |
152 | %cmake .. | |
153 | %if %{with userspace} | |
154 | %{__make} | |
155 | %endif | |
156 | cd .. | |
157 | %if %{with kernel} | |
158 | ln -sf ../../build/config.h tpmd_dev/linux/config.h | |
bc65ae11 | 159 | %{__make} -C tpmd_dev/linux tpmd_dev.rules |
d2539c8b | 160 | %{expand:%bkpkg} |
bc65ae11 JB |
161 | %endif |
162 | ||
163 | %install | |
164 | rm -rf $RPM_BUILD_ROOT | |
165 | ||
166 | %if %{with userspace} | |
167 | %{__make} -C build install \ | |
168 | DESTDIR=$RPM_BUILD_ROOT | |
169 | %endif | |
170 | ||
171 | %if %{with kernel} | |
172 | install -d $RPM_BUILD_ROOT/lib/udev/rules.d | |
d2539c8b JR |
173 | cp -p tpmd_dev/linux/tpmd_dev.rules $RPM_BUILD_ROOT/lib/udev/rules.d/80-tpmd_dev.rules |
174 | cp -a installed/* $RPM_BUILD_ROOT | |
bc65ae11 JB |
175 | %endif |
176 | ||
177 | %clean | |
178 | rm -rf $RPM_BUILD_ROOT | |
179 | ||
180 | %post libs -p /sbin/ldconfig | |
181 | %postun libs -p /sbin/ldconfig | |
182 | ||
183 | %if %{with userspace} | |
184 | %files | |
185 | %defattr(644,root,root,755) | |
186 | %doc AUTHORS ChangeLog README | |
187 | %attr(755,root,root) %{_bindir}/tpmd | |
188 | ||
189 | %files libs | |
190 | %defattr(644,root,root,755) | |
191 | %attr(755,root,root) %{_libdir}/libtddl.so.*.*.*.* | |
192 | %attr(755,root,root) %ghost %{_libdir}/libtddl.so.1.2 | |
193 | ||
194 | %files devel | |
195 | %defattr(644,root,root,755) | |
196 | %attr(755,root,root) %{_libdir}/libtddl.so | |
197 | %{_includedir}/tddl.h | |
198 | ||
199 | %files static | |
200 | %defattr(644,root,root,755) | |
201 | %{_libdir}/libtddl.a | |
202 | %endif |