source: LFS/lfs.xsl@ 2c9a16b

2.4 ablfs ablfs-more legacy new_features trunk
Last change on this file since 2c9a16b was 2c9a16b, checked in by Thomas Pegg <thomasp@…>, 13 years ago

Fix for glibc test, forgot to add this in previous commit.

  • Property mode set to 100644
File size: 20.3 KB
Line 
1<?xml version="1.0" encoding="ISO-8859-1"?>
2
3<!-- $Id$ -->
4
5<xsl:stylesheet
6 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
7 xmlns:exsl="http://exslt.org/common"
8 extension-element-prefixes="exsl"
9 version="1.0">
10
11 <!-- use package management ?
12 n = no, original behavior
13 y = yes, add PKG_DEST to scripts in install commands of chapter06-08
14 -->
15 <xsl:param name="pkgmngt" select="n"/>
16
17 <!-- Run test suites?
18 0 = none
19 1 = only chapter06 Glibc, GCC and Binutils testsuites
20 2 = all chapter06 testsuites
21 3 = all chapter05 and chapter06 testsuites
22 -->
23 <xsl:param name="testsuite" select="1"/>
24
25 <!-- Bomb on test suites failures?
26 n = no, I want to build the full system and review the logs
27 y = yes, bomb at the first test suite failure to can review the build dir
28 -->
29 <xsl:param name="bomb-testsuite" select="n"/>
30
31 <!-- Install vim-lang package? OBSOLETE should always be 'n'-->
32 <xsl:param name="vim-lang" select="n"/>
33
34 <!-- Time zone -->
35 <xsl:param name="timezone" select="GMT"/>
36
37 <!-- Page size -->
38 <xsl:param name="page" select="letter"/>
39
40 <!-- Locale settings -->
41 <xsl:param name="lang" select="C"/>
42
43 <xsl:template match="/">
44 <xsl:apply-templates select="//sect1"/>
45 </xsl:template>
46
47 <xsl:template match="sect1">
48 <xsl:if test="(../@id='chapter-temporary-tools' or
49 ../@id='chapter-building-system' or
50 ../@id='chapter-bootscripts' or
51 ../@id='chapter-bootable') and
52 count(descendant::screen/userinput) &gt; 0 and
53 count(descendant::screen/userinput) &gt;
54 count(descendant::screen[@role='nodump'])">
55 <!-- The dirs names -->
56 <xsl:variable name="pi-dir" select="../processing-instruction('dbhtml')"/>
57 <xsl:variable name="pi-dir-value" select="substring-after($pi-dir,'dir=')"/>
58 <xsl:variable name="quote-dir" select="substring($pi-dir-value,1,1)"/>
59 <xsl:variable name="dirname" select="substring-before(substring($pi-dir-value,2),$quote-dir)"/>
60 <!-- The file names -->
61 <xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/>
62 <xsl:variable name="pi-file-value" select="substring-after($pi-file,'filename=')"/>
63 <xsl:variable name="filename" select="substring-before(substring($pi-file-value,2),'.html')"/>
64 <!-- The build order -->
65 <xsl:variable name="position" select="position()"/>
66 <xsl:variable name="order">
67 <xsl:choose>
68 <xsl:when test="string-length($position) = 1">
69 <xsl:text>00</xsl:text>
70 <xsl:value-of select="$position"/>
71 </xsl:when>
72 <xsl:when test="string-length($position) = 2">
73 <xsl:text>0</xsl:text>
74 <xsl:value-of select="$position"/>
75 </xsl:when>
76 <xsl:otherwise>
77 <xsl:value-of select="$position"/>
78 </xsl:otherwise>
79 </xsl:choose>
80 </xsl:variable>
81 <!-- Inclusion of package manager scriptlets -->
82 <xsl:if test="@id='ch-tools-stripping' and $pkgmngt='y'">
83 <xsl:apply-templates
84 select="document('packageManager.xml')//sect1[@id='ch-tools-pkgmngt']"
85 mode="pkgmngt">
86 <xsl:with-param name="order" select="concat($order,'-1')"/>
87 <xsl:with-param name="dirname" select="$dirname"/>
88 </xsl:apply-templates>
89 </xsl:if>
90 <xsl:if test="@id='ch-system-strippingagain' and $pkgmngt='y'">
91 <xsl:apply-templates
92 select="document('packageManager.xml')//sect1[@id='ch-system-pkgmngt']"
93 mode="pkgmngt">
94 <xsl:with-param name="order" select="concat($order,'-1')"/>
95 <xsl:with-param name="dirname" select="$dirname"/>
96 </xsl:apply-templates>
97 </xsl:if>
98 <!-- Creating dirs and files -->
99 <exsl:document href="{$dirname}/{$order}-{$filename}" method="text">
100 <xsl:choose>
101 <xsl:when test="@id='ch-system-creatingdirs' or
102 @id='ch-system-createfiles' or
103 @id='ch-system-strippingagain'">
104 <xsl:text>#!/tools/bin/bash&#xA;set +h&#xA;</xsl:text>
105 </xsl:when>
106 <xsl:otherwise>
107 <xsl:text>#!/bin/bash&#xA;set +h&#xA;</xsl:text>
108 </xsl:otherwise>
109 </xsl:choose>
110 <xsl:if test="not(@id='ch-tools-stripping') and
111 not(@id='ch-system-strippingagain')">
112 <xsl:text>set -e&#xA;</xsl:text>
113 </xsl:if>
114 <xsl:text>&#xA;</xsl:text>
115 <xsl:if test="sect2[@role='installation']">
116 <xsl:text>cd $PKGDIR&#xA;</xsl:text>
117 </xsl:if>
118 <xsl:apply-templates
119 select=".//screen[not(@role) or
120 @role != 'nodump']/userinput[
121 @remap = 'pre' or
122 @remap = 'configure' or
123 @remap = 'make' or
124 @remap = 'test' and
125 not(current()/@id='ch-tools-dejagnu')]"/>
126 <xsl:if
127 test="ancestor::chapter[@id != 'chapter-temporary-tools'] and
128 $pkgmngt = 'y' and
129 descendant::screen[not(@role) or
130 @role != 'nodump']/userinput[
131 @remap='install']">
132 <xsl:text>mkdir -pv $PKG_DEST/{boot,etc,lib,bin,sbin}
133mkdir -pv $PKG_DEST/usr/{lib,bin,sbin,include}
134mkdir -pv $PKG_DEST/usr/share/{doc,info,man}
135mkdir -pv $PKG_DEST/usr/share/man/man{1..8}
136ln -sv share/{man,doc,info} $PKG_DEST/usr
137case $(uname -m) in
138 x86_64) ln -sv lib $PKG_DEST/lib64 &amp;&amp; ln -sv lib $PKG_DEST/usr/lib64 ;;
139esac
140</xsl:text>
141 </xsl:if>
142 <xsl:if test="@id = 'ch-system-glibc' and
143 $pkgmngt = 'y'">
144 <xsl:text>mkdir -pv $PKG_DEST/usr/include/{rpc,rpcsvc}
145</xsl:text>
146 </xsl:if>
147 <xsl:apply-templates
148 select=".//screen[not(@role) or
149 @role != 'nodump']/userinput[@remap = 'install']"/>
150 <xsl:if test="ancestor::chapter[@id != 'chapter-temporary-tools'] and
151 $pkgmngt = 'y' and
152 descendant::screen[not(@role) or
153 @role != 'nodump']/userinput[
154 @remap='install']">
155 <xsl:if test="@id = 'ch-system-man-pages'">
156<!-- those files are provided by the shadow package -->
157 <xsl:text>rm -fv $PKG_DEST/usr/share/man/{man3/getspnam.3,man5/passwd.5}
158</xsl:text>
159 </xsl:if>
160 <xsl:text>rm -fv $PKG_DEST/{,usr/}lib64
161rm -fv $PKG_DEST/usr/{man,doc,info}
162for dir in $PKG_DEST/usr/share/man/man{1..8}; do
163 [[ -z $(ls $dir) ]] &amp;&amp; rmdir -v $dir
164done
165for dir in $PKG_DEST/usr/share/{doc,info,man}; do
166 [[ -z $(ls $dir) ]] &amp;&amp; rmdir -v $dir
167done
168for dir in $PKG_DEST/usr/{lib,bin,sbin,include}; do
169 [[ -z $(ls $dir) ]] &amp;&amp; rmdir -v $dir
170done
171for dir in $PKG_DEST/{boot,etc,lib,bin,sbin}; do
172 [[ -z $(ls $dir) ]] &amp;&amp; rmdir -v $dir
173done
174packInstall
175rm -rf $PKG_DEST
176</xsl:text>
177 </xsl:if>
178 <xsl:if test="$testsuite='3' and @id='ch-tools-glibc' or @id='ch-system-glibc'">
179 <xsl:copy-of select="//userinput[@remap='locale-test']"/>
180 <xsl:text>&#xA;</xsl:text>
181 </xsl:if>
182 <xsl:apply-templates
183 select=".//screen[
184 not(@role) or
185 @role != 'nodump'
186 ]/userinput[
187 not(@remap) or
188 @remap='adjust' or
189 @remap='test' and current()/@id='ch-tools-dejagnu'
190 ]"/>
191 <xsl:if test="@id='ch-system-creatingdirs'">
192 <xsl:apply-templates
193 select="document('packageManager.xml')//sect1[
194 @id='ch-system-pkgmngt-creatingdirs'
195 ]//userinput"/>
196 </xsl:if>
197 <xsl:if test="@id='ch-system-createfiles'">
198 <xsl:apply-templates
199 select="document('packageManager.xml')//sect1[
200 @id='ch-system-pkgmngt-createfiles'
201 ]//userinput"/>
202 </xsl:if>
203 <xsl:if test="not(@id='ch-system-chroot') and
204 not(@id='ch-system-revisedchroot')">
205 <xsl:text>echo -e "\n\nTotalseconds: $SECONDS\n"&#xA;</xsl:text>
206 </xsl:if>
207 <xsl:text>exit&#xA;</xsl:text>
208 </exsl:document>
209 </xsl:if>
210 </xsl:template>
211
212<xsl:template match="sect1" mode="pkgmngt">
213 <xsl:param name="dirname" select="chapter05"/>
214 <!-- The build order -->
215 <xsl:param name="order" select="062-1"/>
216<!-- The file names -->
217 <xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/>
218 <xsl:variable name="pi-file-value" select="substring-after($pi-file,'filename=')"/>
219 <xsl:variable name="filename" select="substring-before(substring($pi-file-value,2),'.html')"/>
220 <!-- Creating dirs and files -->
221 <exsl:document href="{$dirname}/{$order}-{$filename}" method="text">
222 <xsl:text>#!/bin/bash
223set +h
224set -e
225
226cd $PKGDIR
227</xsl:text>
228 <xsl:apply-templates
229 select=".//screen[not(@role) or @role != 'nodump']/userinput[@remap != 'adjust']"
230 mode="pkgmngt"/>
231 <xsl:if test="@id = 'ch-system-pkgmngt'">
232 <xsl:text>packInstall
233rm -rf $PKG_DEST
234</xsl:text>
235 </xsl:if>
236 <xsl:apply-templates
237 select=".//screen[
238 not(@role) or
239 @role != 'nodump'
240 ]/userinput[
241 not(@remap) or
242 @remap='adjust'
243 ]"
244 mode="pkgmngt"/>
245 <xsl:text>
246echo -e "\n\nTotalseconds: $SECONDS\n"
247exit
248</xsl:text>
249 </exsl:document>
250 </xsl:template>
251
252 <xsl:template match="userinput" mode="pkgmngt">
253 <xsl:apply-templates/>
254 <xsl:text>&#xA;</xsl:text>
255 </xsl:template>
256
257 <xsl:template match="userinput">
258 <xsl:choose>
259 <!-- Copying the kernel config file -->
260 <xsl:when test="string() = 'make mrproper'">
261 <xsl:text>make mrproper&#xA;</xsl:text>
262 <xsl:if test="ancestor::sect1[@id='ch-bootable-kernel']">
263 <xsl:text>cp -v ../kernel-config .config&#xA;</xsl:text>
264 </xsl:if>
265 </xsl:when>
266<!-- test instructions -->
267 <xsl:when test="@remap = 'test'">
268 <xsl:choose>
269 <xsl:when test="$testsuite = '0'"/>
270 <xsl:when test="$testsuite = '1' and
271 not(ancestor::sect1[@id='ch-system-gcc']) and
272 not(ancestor::sect1[@id='ch-system-glibc']) and
273 not(ancestor::sect1[@id='ch-system-gmp']) and
274 not(ancestor::sect1[@id='ch-system-mpfr']) and
275 not(ancestor::sect1[@id='ch-system-binutils'])"/>
276 <xsl:when test="$testsuite = '2' and
277 ancestor::chapter[@id='chapter-temporary-tools']"/>
278 <xsl:otherwise>
279 <xsl:choose>
280 <xsl:when test="$bomb-testsuite = 'n'">
281 <xsl:choose>
282 <!-- special case for glibc -->
283 <xsl:when test="contains(string(), 'glibc-check-log')">
284 <xsl:value-of
285 select="substring-before(string(),'2&gt;&amp;1')"/>
286 <xsl:text>&gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
287 </xsl:when>
288 <xsl:when test="contains(string(), 'make -k')">
289 <xsl:apply-templates/>
290 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
291 </xsl:when>
292 <xsl:when test="contains(string(), 'make')">
293 <xsl:value-of select="substring-before(string(),'make')"/>
294 <xsl:text>make -k</xsl:text>
295 <xsl:value-of select="substring-after(string(),'make')"/>
296 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
297 </xsl:when>
298 <xsl:otherwise>
299 <xsl:apply-templates/>
300 <xsl:if test="not(contains(string(), '&gt;&gt;'))">
301 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
302 </xsl:if>
303 <xsl:text>&#xA;</xsl:text>
304 </xsl:otherwise>
305 </xsl:choose>
306 </xsl:when>
307 <xsl:otherwise>
308 <!-- bomb-testsuite != 'n'-->
309 <xsl:choose>
310 <!-- special case for glibc -->
311 <xsl:when test="contains(string(), 'glibc-check-log')">
312 <xsl:value-of
313 select="substring-before(string(),'2&gt;&amp;1')"/>
314 <xsl:text>&gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
315 </xsl:when>
316 <xsl:when test="contains(string(), 'make -k')">
317 <xsl:apply-templates/>
318 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
319 </xsl:when>
320 <xsl:otherwise>
321 <xsl:apply-templates/>
322 <xsl:if test="not(contains(string(), '&gt;&gt;'))">
323 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
324 </xsl:if>
325 <xsl:text>&#xA;</xsl:text>
326 </xsl:otherwise>
327 </xsl:choose>
328 </xsl:otherwise>
329 </xsl:choose>
330 </xsl:otherwise>
331 </xsl:choose>
332 </xsl:when>
333<!-- End of test instructions -->
334 <!-- Don't stop on strip run -->
335 <xsl:when test="contains(string(),'strip ')">
336 <xsl:apply-templates/>
337 <xsl:text> || true&#xA;</xsl:text>
338 </xsl:when>
339<!-- Package management -->
340<!-- Add $PKG_DEST to installation commands -->
341 <xsl:when test="@remap='install' and
342 not(ancestor::chapter[
343 @id='chapter-temporary-tools'
344 ])">
345 <xsl:choose>
346 <xsl:when test="$pkgmngt='n'">
347 <xsl:choose>
348 <xsl:when test="contains(string(),'firmware,udev')">
349 <xsl:text>if [[ ! -d /lib/udev/devices ]] ; then&#xA;</xsl:text>
350 <xsl:apply-templates/>
351 <xsl:text>&#xA;fi&#xA;</xsl:text>
352 </xsl:when>
353 <xsl:otherwise>
354 <xsl:apply-templates/>
355 <xsl:text>&#xA;</xsl:text>
356 </xsl:otherwise>
357 </xsl:choose>
358 </xsl:when>
359 <xsl:otherwise><!--pkgmngt = 'y'-->
360 <xsl:choose>
361 <xsl:when test="./literal">
362 <xsl:call-template name="outputpkgdest">
363 <xsl:with-param name="outputstring"
364 select="text()[1]"/>
365 </xsl:call-template>
366 <xsl:apply-templates select="literal"/>
367 <xsl:call-template name="outputpkgdest">
368 <xsl:with-param name="outputstring"
369 select="text()[2]"/>
370 </xsl:call-template>
371 </xsl:when>
372 <xsl:otherwise>
373 <xsl:call-template name="outputpkgdest">
374 <xsl:with-param name="outputstring" select="string()"/>
375 </xsl:call-template>
376 </xsl:otherwise>
377 </xsl:choose>
378 </xsl:otherwise>
379 </xsl:choose>
380 </xsl:when>
381 <!-- End addition for package management -->
382 <!-- The rest of commands -->
383 <xsl:otherwise>
384 <xsl:apply-templates/>
385 <xsl:text>&#xA;</xsl:text>
386 </xsl:otherwise>
387 </xsl:choose>
388 </xsl:template>
389
390 <xsl:template match="replaceable">
391 <xsl:choose>
392 <xsl:when test="ancestor::sect1[@id='ch-system-glibc']">
393 <xsl:value-of select="$timezone"/>
394 </xsl:when>
395 <xsl:when test="ancestor::sect1[@id='ch-system-groff']">
396 <xsl:value-of select="$page"/>
397 </xsl:when>
398 <xsl:when test="contains(string(.),'&lt;ll&gt;_&lt;CC&gt;')">
399 <xsl:value-of select="$lang"/>
400 </xsl:when>
401 <xsl:otherwise>
402 <xsl:text>**EDITME</xsl:text>
403 <xsl:apply-templates/>
404 <xsl:text>EDITME**</xsl:text>
405 </xsl:otherwise>
406 </xsl:choose>
407 </xsl:template>
408
409 <xsl:template name="outputpkgdest">
410 <xsl:param name="outputstring" select="foo"/>
411 <xsl:choose>
412 <xsl:when test="contains($outputstring,'make ')">
413 <xsl:choose>
414 <xsl:when test="not(starts-with($outputstring,'make'))">
415 <xsl:call-template name="outputpkgdest">
416 <xsl:with-param name="outputstring"
417 select="substring-before($outputstring,'make')"/>
418 </xsl:call-template>
419 <xsl:call-template name="outputpkgdest">
420 <xsl:with-param
421 name="outputstring"
422 select="substring-after($outputstring,
423 substring-before($outputstring,'make'))"/>
424 </xsl:call-template>
425 </xsl:when>
426 <xsl:otherwise>
427 <xsl:choose>
428<!-- special cases (no DESTDIR) here -->
429 <xsl:when test="ancestor::sect1[@id='ch-system-glibc']">
430 <xsl:text>make install_root=$PKG_DEST -j1</xsl:text>
431 <xsl:value-of
432 select="substring-before(substring-after(string(),'make'),
433 'install')"/>
434 <xsl:text>install&#xA;</xsl:text>
435 </xsl:when>
436 <xsl:when test="ancestor::sect1[@id='ch-system-bzip2']">
437 <xsl:text>make PREFIX=$PKG_DEST/usr install&#xA;</xsl:text>
438 </xsl:when>
439 <xsl:when test="ancestor::sect1[@id='ch-system-sysklogd']">
440 <xsl:text>make BINDIR=$PKG_DEST/sbin prefix=$PKG_DEST install&#xA;</xsl:text>
441 </xsl:when>
442 <xsl:when test="ancestor::sect1[@id='ch-system-iproute2']">
443 <xsl:text>make DESTDIR=$PKG_DEST</xsl:text>
444 <xsl:value-of
445 select="substring-before(substring-after(string(),'DESTDIR='),
446 'install')"/>
447 <xsl:text>install&#xA;</xsl:text>
448 </xsl:when>
449 <xsl:when test="ancestor::sect1[@id='ch-system-sysvinit']">
450 <xsl:text>make ROOT=$PKG_DEST</xsl:text>
451 <xsl:value-of
452 select="substring-before(substring-after(string(),'make'),
453 'install')"/>
454 <xsl:text>install&#xA;</xsl:text>
455 </xsl:when>
456 <xsl:when test="ancestor::sect1[@id='ch-bootable-kernel']">
457 <xsl:text>make INSTALL_MOD_PATH=$PKG_DEST</xsl:text>
458 <xsl:value-of
459 select="substring-before(substring-after(string(),'make'),
460 'install')"/>
461 <xsl:text>install&#xA;</xsl:text>
462 </xsl:when>
463 <xsl:otherwise>
464 <xsl:text>make DESTDIR=$PKG_DEST</xsl:text>
465 <xsl:call-template name="outputpkgdest">
466 <xsl:with-param
467 name="outputstring"
468 select="substring-after($outputstring,'make')"/>
469 </xsl:call-template>
470 </xsl:otherwise>
471 </xsl:choose>
472 </xsl:otherwise>
473 </xsl:choose>
474 </xsl:when>
475 <xsl:otherwise> <!-- no make in this string -->
476 <xsl:choose>
477 <xsl:when test="contains($outputstring,'&gt;/') and
478 not(contains(substring-before($outputstring,'&gt;/'),' /'))">
479 <xsl:value-of select="substring-before($outputstring,'&gt;/')"/>
480 <xsl:text>&gt;$PKG_DEST/</xsl:text>
481 <xsl:call-template name="outputpkgdest">
482 <xsl:with-param name="outputstring" select="substring-after($outputstring,'&gt;/')"/>
483 </xsl:call-template>
484 </xsl:when>
485 <xsl:when test="contains($outputstring,' /')">
486 <xsl:value-of select="substring-before($outputstring,' /')"/>
487 <xsl:text> $PKG_DEST/</xsl:text>
488 <xsl:call-template name="outputpkgdest">
489 <xsl:with-param name="outputstring" select="substring-after($outputstring,' /')"/>
490 </xsl:call-template>
491 </xsl:when>
492 <xsl:otherwise>
493 <xsl:value-of select="$outputstring"/>
494 <xsl:text>&#xA;</xsl:text>
495 </xsl:otherwise>
496 </xsl:choose>
497 </xsl:otherwise>
498 </xsl:choose>
499 </xsl:template>
500</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.