source: LFS/lfs.xsl@ b515be7

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

Commit fix for glibc localedata installation regression.

  • Property mode set to 100644
File size: 20.4 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'">
179 <xsl:copy-of select="//userinput[@remap='locale-test']"/>
180 <xsl:text>&#xA;</xsl:text>
181 </xsl:if>
182 <xsl:if test="@id='ch-system-glibc'">
183 <xsl:copy-of select="//userinput[@remap='locale-full']"/>
184 <xsl:text>&#xA;</xsl:text>
185 </xsl:if>
186 <xsl:apply-templates
187 select=".//screen[
188 not(@role) or
189 @role != 'nodump'
190 ]/userinput[
191 not(@remap) or
192 @remap='adjust' or
193 @remap='test' and current()/@id='ch-tools-dejagnu'
194 ]"/>
195 <xsl:if test="@id='ch-system-creatingdirs'">
196 <xsl:apply-templates
197 select="document('packageManager.xml')//sect1[
198 @id='ch-system-pkgmngt-creatingdirs'
199 ]//userinput"/>
200 </xsl:if>
201 <xsl:if test="@id='ch-system-createfiles'">
202 <xsl:apply-templates
203 select="document('packageManager.xml')//sect1[
204 @id='ch-system-pkgmngt-createfiles'
205 ]//userinput"/>
206 </xsl:if>
207 <xsl:if test="not(@id='ch-system-chroot') and
208 not(@id='ch-system-revisedchroot')">
209 <xsl:text>echo -e "\n\nTotalseconds: $SECONDS\n"&#xA;</xsl:text>
210 </xsl:if>
211 <xsl:text>exit&#xA;</xsl:text>
212 </exsl:document>
213 </xsl:if>
214 </xsl:template>
215
216<xsl:template match="sect1" mode="pkgmngt">
217 <xsl:param name="dirname" select="chapter05"/>
218 <!-- The build order -->
219 <xsl:param name="order" select="062-1"/>
220<!-- The file names -->
221 <xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/>
222 <xsl:variable name="pi-file-value" select="substring-after($pi-file,'filename=')"/>
223 <xsl:variable name="filename" select="substring-before(substring($pi-file-value,2),'.html')"/>
224 <!-- Creating dirs and files -->
225 <exsl:document href="{$dirname}/{$order}-{$filename}" method="text">
226 <xsl:text>#!/bin/bash
227set +h
228set -e
229
230cd $PKGDIR
231</xsl:text>
232 <xsl:apply-templates
233 select=".//screen[not(@role) or @role != 'nodump']/userinput[@remap != 'adjust']"
234 mode="pkgmngt"/>
235 <xsl:if test="@id = 'ch-system-pkgmngt'">
236 <xsl:text>packInstall
237rm -rf $PKG_DEST
238</xsl:text>
239 </xsl:if>
240 <xsl:apply-templates
241 select=".//screen[
242 not(@role) or
243 @role != 'nodump'
244 ]/userinput[
245 not(@remap) or
246 @remap='adjust'
247 ]"
248 mode="pkgmngt"/>
249 <xsl:text>
250echo -e "\n\nTotalseconds: $SECONDS\n"
251exit
252</xsl:text>
253 </exsl:document>
254 </xsl:template>
255
256 <xsl:template match="userinput" mode="pkgmngt">
257 <xsl:apply-templates/>
258 <xsl:text>&#xA;</xsl:text>
259 </xsl:template>
260
261 <xsl:template match="userinput">
262 <xsl:choose>
263 <!-- Copying the kernel config file -->
264 <xsl:when test="string() = 'make mrproper'">
265 <xsl:text>make mrproper&#xA;</xsl:text>
266 <xsl:if test="ancestor::sect1[@id='ch-bootable-kernel']">
267 <xsl:text>cp -v ../kernel-config .config&#xA;</xsl:text>
268 </xsl:if>
269 </xsl:when>
270<!-- test instructions -->
271 <xsl:when test="@remap = 'test'">
272 <xsl:choose>
273 <xsl:when test="$testsuite = '0'"/>
274 <xsl:when test="$testsuite = '1' and
275 not(ancestor::sect1[@id='ch-system-gcc']) and
276 not(ancestor::sect1[@id='ch-system-glibc']) and
277 not(ancestor::sect1[@id='ch-system-gmp']) and
278 not(ancestor::sect1[@id='ch-system-mpfr']) and
279 not(ancestor::sect1[@id='ch-system-binutils'])"/>
280 <xsl:when test="$testsuite = '2' and
281 ancestor::chapter[@id='chapter-temporary-tools']"/>
282 <xsl:otherwise>
283 <xsl:choose>
284 <xsl:when test="$bomb-testsuite = 'n'">
285 <xsl:choose>
286 <!-- special case for glibc -->
287 <xsl:when test="contains(string(), 'glibc-check-log')">
288 <xsl:value-of
289 select="substring-before(string(),'2&gt;&amp;1')"/>
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 -k')">
293 <xsl:apply-templates/>
294 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
295 </xsl:when>
296 <xsl:when test="contains(string(), 'make')">
297 <xsl:value-of select="substring-before(string(),'make')"/>
298 <xsl:text>make -k</xsl:text>
299 <xsl:value-of select="substring-after(string(),'make')"/>
300 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
301 </xsl:when>
302 <xsl:otherwise>
303 <xsl:apply-templates/>
304 <xsl:if test="not(contains(string(), '&gt;&gt;'))">
305 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
306 </xsl:if>
307 <xsl:text>&#xA;</xsl:text>
308 </xsl:otherwise>
309 </xsl:choose>
310 </xsl:when>
311 <xsl:otherwise>
312 <!-- bomb-testsuite != 'n'-->
313 <xsl:choose>
314 <!-- special case for glibc -->
315 <xsl:when test="contains(string(), 'glibc-check-log')">
316 <xsl:value-of
317 select="substring-before(string(),'2&gt;&amp;1')"/>
318 <xsl:text>&gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
319 </xsl:when>
320 <xsl:when test="contains(string(), 'make -k')">
321 <xsl:apply-templates/>
322 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
323 </xsl:when>
324 <xsl:otherwise>
325 <xsl:apply-templates/>
326 <xsl:if test="not(contains(string(), '&gt;&gt;'))">
327 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
328 </xsl:if>
329 <xsl:text>&#xA;</xsl:text>
330 </xsl:otherwise>
331 </xsl:choose>
332 </xsl:otherwise>
333 </xsl:choose>
334 </xsl:otherwise>
335 </xsl:choose>
336 </xsl:when>
337<!-- End of test instructions -->
338 <!-- Don't stop on strip run -->
339 <xsl:when test="contains(string(),'strip ')">
340 <xsl:apply-templates/>
341 <xsl:text> || true&#xA;</xsl:text>
342 </xsl:when>
343<!-- Package management -->
344<!-- Add $PKG_DEST to installation commands -->
345 <xsl:when test="@remap='install' and
346 not(ancestor::chapter[
347 @id='chapter-temporary-tools'
348 ])">
349 <xsl:choose>
350 <xsl:when test="$pkgmngt='n'">
351 <xsl:choose>
352 <xsl:when test="contains(string(),'firmware,udev')">
353 <xsl:text>if [[ ! -d /lib/udev/devices ]] ; then&#xA;</xsl:text>
354 <xsl:apply-templates/>
355 <xsl:text>&#xA;fi&#xA;</xsl:text>
356 </xsl:when>
357 <xsl:otherwise>
358 <xsl:apply-templates/>
359 <xsl:text>&#xA;</xsl:text>
360 </xsl:otherwise>
361 </xsl:choose>
362 </xsl:when>
363 <xsl:otherwise><!--pkgmngt = 'y'-->
364 <xsl:choose>
365 <xsl:when test="./literal">
366 <xsl:call-template name="outputpkgdest">
367 <xsl:with-param name="outputstring"
368 select="text()[1]"/>
369 </xsl:call-template>
370 <xsl:apply-templates select="literal"/>
371 <xsl:call-template name="outputpkgdest">
372 <xsl:with-param name="outputstring"
373 select="text()[2]"/>
374 </xsl:call-template>
375 </xsl:when>
376 <xsl:otherwise>
377 <xsl:call-template name="outputpkgdest">
378 <xsl:with-param name="outputstring" select="string()"/>
379 </xsl:call-template>
380 </xsl:otherwise>
381 </xsl:choose>
382 </xsl:otherwise>
383 </xsl:choose>
384 </xsl:when>
385 <!-- End addition for package management -->
386 <!-- The rest of commands -->
387 <xsl:otherwise>
388 <xsl:apply-templates/>
389 <xsl:text>&#xA;</xsl:text>
390 </xsl:otherwise>
391 </xsl:choose>
392 </xsl:template>
393
394 <xsl:template match="replaceable">
395 <xsl:choose>
396 <xsl:when test="ancestor::sect1[@id='ch-system-glibc']">
397 <xsl:value-of select="$timezone"/>
398 </xsl:when>
399 <xsl:when test="ancestor::sect1[@id='ch-system-groff']">
400 <xsl:value-of select="$page"/>
401 </xsl:when>
402 <xsl:when test="contains(string(.),'&lt;ll&gt;_&lt;CC&gt;')">
403 <xsl:value-of select="$lang"/>
404 </xsl:when>
405 <xsl:otherwise>
406 <xsl:text>**EDITME</xsl:text>
407 <xsl:apply-templates/>
408 <xsl:text>EDITME**</xsl:text>
409 </xsl:otherwise>
410 </xsl:choose>
411 </xsl:template>
412
413 <xsl:template name="outputpkgdest">
414 <xsl:param name="outputstring" select="foo"/>
415 <xsl:choose>
416 <xsl:when test="contains($outputstring,'make ')">
417 <xsl:choose>
418 <xsl:when test="not(starts-with($outputstring,'make'))">
419 <xsl:call-template name="outputpkgdest">
420 <xsl:with-param name="outputstring"
421 select="substring-before($outputstring,'make')"/>
422 </xsl:call-template>
423 <xsl:call-template name="outputpkgdest">
424 <xsl:with-param
425 name="outputstring"
426 select="substring-after($outputstring,
427 substring-before($outputstring,'make'))"/>
428 </xsl:call-template>
429 </xsl:when>
430 <xsl:otherwise>
431 <xsl:choose>
432<!-- special cases (no DESTDIR) here -->
433 <xsl:when test="ancestor::sect1[@id='ch-system-glibc']">
434 <xsl:text>make install_root=$PKG_DEST -j1</xsl:text>
435 <xsl:value-of
436 select="substring-before(substring-after(string(),'make'),
437 'install')"/>
438 <xsl:text>install&#xA;</xsl:text>
439 </xsl:when>
440 <xsl:when test="ancestor::sect1[@id='ch-system-bzip2']">
441 <xsl:text>make PREFIX=$PKG_DEST/usr install&#xA;</xsl:text>
442 </xsl:when>
443 <xsl:when test="ancestor::sect1[@id='ch-system-sysklogd']">
444 <xsl:text>make BINDIR=$PKG_DEST/sbin prefix=$PKG_DEST install&#xA;</xsl:text>
445 </xsl:when>
446 <xsl:when test="ancestor::sect1[@id='ch-system-iproute2']">
447 <xsl:text>make DESTDIR=$PKG_DEST</xsl:text>
448 <xsl:value-of
449 select="substring-before(substring-after(string(),'DESTDIR='),
450 'install')"/>
451 <xsl:text>install&#xA;</xsl:text>
452 </xsl:when>
453 <xsl:when test="ancestor::sect1[@id='ch-system-sysvinit']">
454 <xsl:text>make ROOT=$PKG_DEST</xsl:text>
455 <xsl:value-of
456 select="substring-before(substring-after(string(),'make'),
457 'install')"/>
458 <xsl:text>install&#xA;</xsl:text>
459 </xsl:when>
460 <xsl:when test="ancestor::sect1[@id='ch-bootable-kernel']">
461 <xsl:text>make INSTALL_MOD_PATH=$PKG_DEST</xsl:text>
462 <xsl:value-of
463 select="substring-before(substring-after(string(),'make'),
464 'install')"/>
465 <xsl:text>install&#xA;</xsl:text>
466 </xsl:when>
467 <xsl:otherwise>
468 <xsl:text>make DESTDIR=$PKG_DEST</xsl:text>
469 <xsl:call-template name="outputpkgdest">
470 <xsl:with-param
471 name="outputstring"
472 select="substring-after($outputstring,'make')"/>
473 </xsl:call-template>
474 </xsl:otherwise>
475 </xsl:choose>
476 </xsl:otherwise>
477 </xsl:choose>
478 </xsl:when>
479 <xsl:otherwise> <!-- no make in this string -->
480 <xsl:choose>
481 <xsl:when test="contains($outputstring,'&gt;/') and
482 not(contains(substring-before($outputstring,'&gt;/'),' /'))">
483 <xsl:value-of select="substring-before($outputstring,'&gt;/')"/>
484 <xsl:text>&gt;$PKG_DEST/</xsl:text>
485 <xsl:call-template name="outputpkgdest">
486 <xsl:with-param name="outputstring" select="substring-after($outputstring,'&gt;/')"/>
487 </xsl:call-template>
488 </xsl:when>
489 <xsl:when test="contains($outputstring,' /')">
490 <xsl:value-of select="substring-before($outputstring,' /')"/>
491 <xsl:text> $PKG_DEST/</xsl:text>
492 <xsl:call-template name="outputpkgdest">
493 <xsl:with-param name="outputstring" select="substring-after($outputstring,' /')"/>
494 </xsl:call-template>
495 </xsl:when>
496 <xsl:otherwise>
497 <xsl:value-of select="$outputstring"/>
498 <xsl:text>&#xA;</xsl:text>
499 </xsl:otherwise>
500 </xsl:choose>
501 </xsl:otherwise>
502 </xsl:choose>
503 </xsl:template>
504</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.