source: CLFS/clfs.xsl@ 6447575

ablfs-more legacy trunk
Last change on this file since 6447575 was 085435e, checked in by Pierre Labastie <pierre@…>, 5 years ago

Remove the obsolete vim-lang instructions and variable, and add non-wide-
charater ncurses library

  • Property mode set to 100644
File size: 18.2 KB
Line 
1<?xml version="1.0"?>
2<!DOCTYPE xsl:stylesheet [
3 <!ENTITY % general-entities SYSTEM "FAKEDIR/general.ent">
4 %general-entities;
5]>
6
7<!-- $Id$ -->
8
9<xsl:stylesheet
10 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
11 xmlns:exsl="http://exslt.org/common"
12 extension-element-prefixes="exsl"
13 version="1.0">
14
15<!-- XSLT stylesheet to create shell scripts from CLFS books. -->
16
17 <!-- Build method used -->
18 <xsl:param name="method" select="chroot"/>
19
20 <!-- Run test suites?
21 0 = none
22 1 = only Glibc, GCC and Binutils testsuites
23 2 = all testsuites
24 3 = alias to 2
25 -->
26 <xsl:param name="testsuite" select="1"/>
27
28 <!-- Bomb on test suites failures?
29 n = no, I want to build the full system and review the logs
30 y = yes, bomb at the first test suite failure to can review the build dir
31 -->
32 <xsl:param name="bomb-testsuite" 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 <!-- Sparc64 processor type -->
44 <xsl:param name="sparc" select="none"/>
45
46 <!-- x86 32 bit target triplet -->
47 <xsl:param name="x86" select="i686-pc-linux-gnu"/>
48
49 <!-- mips target triplet -->
50 <xsl:param name="mips" select="mips-unknown-linux-gnu"/>
51
52 <xsl:template match="/">
53 <xsl:apply-templates select="//sect1"/>
54 </xsl:template>
55
56 <xsl:template match="sect1">
57 <xsl:choose>
58 <xsl:when test="../@id='chapter-partitioning' or
59 ../@id='chapter-getting-materials'"/>
60 <xsl:when test="../@id='chapter-testsuite-tools' and $testsuite='0'"/>
61 <xsl:when test="../@id='chapter-boot' and $method='chroot'"/>
62 <xsl:when test="../@id='chapter-chroot' and $method='boot'"/>
63 <xsl:otherwise>
64 <xsl:if test="count(descendant::screen/userinput) &gt; 0 and
65 count(descendant::screen/userinput) &gt;
66 count(descendant::screen[@role='nodump'])">
67 <!-- The dirs names -->
68 <xsl:variable name="pi-dir" select="../processing-instruction('dbhtml')"/>
69 <xsl:variable name="pi-dir-value" select="substring-after($pi-dir,'dir=')"/>
70 <xsl:variable name="quote-dir" select="substring($pi-dir-value,1,1)"/>
71 <xsl:variable name="dirname" select="substring-before(substring($pi-dir-value,2),$quote-dir)"/>
72 <!-- The file names -->
73 <xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/>
74 <xsl:variable name="pi-file-value" select="substring-after($pi-file,'filename=')"/>
75 <xsl:variable name="filename" select="substring-before(substring($pi-file-value,2),'.html')"/>
76 <!-- The build order -->
77 <xsl:variable name="position" select="position()"/>
78 <xsl:variable name="order">
79 <xsl:choose>
80 <xsl:when test="string-length($position) = 1">
81 <xsl:text>00</xsl:text>
82 <xsl:value-of select="$position"/>
83 </xsl:when>
84 <xsl:when test="string-length($position) = 2">
85 <xsl:text>0</xsl:text>
86 <xsl:value-of select="$position"/>
87 </xsl:when>
88 <xsl:otherwise>
89 <xsl:value-of select="$position"/>
90 </xsl:otherwise>
91 </xsl:choose>
92 </xsl:variable>
93 <!-- Creating dirs and files -->
94 <exsl:document href="{$dirname}/{$order}-{$filename}" method="text">
95 <xsl:choose>
96 <xsl:when test="@id='ch-chroot-changingowner' or
97 @id='ch-chroot-creatingdirs' or
98 @id='ch-chroot-createfiles' or
99 @id='ch-system-stripping'">
100 <xsl:text>#!/tools/bin/bash&#xA;set +h&#xA;</xsl:text>
101 </xsl:when>
102 <xsl:otherwise>
103 <xsl:text>#!/bin/bash&#xA;set +h&#xA;</xsl:text>
104 </xsl:otherwise>
105 </xsl:choose>
106 <xsl:if test="not(@id='ch-system-stripping')">
107 <xsl:text>set -e</xsl:text>
108 </xsl:if>
109 <xsl:text>&#xA;</xsl:text>
110 <xsl:if test="sect2[@role='installation'] and
111 not(@id='ch-system-multiarch-wrapper')">
112 <xsl:text>cd $PKGDIR&#xA;</xsl:text>
113 </xsl:if>
114 <xsl:apply-templates select=".//para/userinput | .//screen"/>
115 <xsl:if test="not(@id='ch-chroot-chroot')">
116 <xsl:text>echo -e "\n\nTotalseconds: $SECONDS\n"&#xA;</xsl:text>
117 </xsl:if>
118 <xsl:text>exit</xsl:text>
119 </exsl:document>
120 </xsl:if>
121 </xsl:otherwise>
122 </xsl:choose>
123 </xsl:template>
124
125 <xsl:template match="screen">
126 <xsl:if test="child::* = userinput and not(@role = 'nodump')">
127 <xsl:apply-templates select="userinput" mode="screen"/>
128 </xsl:if>
129 </xsl:template>
130
131 <xsl:template match="para/userinput">
132 <xsl:if test="(contains(string(),'test') or
133 contains(string(),'check')) and
134 not($testsuite = '2' or $testsuite = '3')">
135 <xsl:text># </xsl:text>
136 </xsl:if>
137 <xsl:choose>
138 <xsl:when test="$bomb-testsuite = 'n'">
139 <xsl:value-of select="substring-before(string(),'make')"/>
140 <xsl:text>make -k</xsl:text>
141 <xsl:value-of select="substring-after(string(),'make')"/>
142 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
143 </xsl:when>
144 <xsl:otherwise>
145 <xsl:apply-templates/>
146 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
147 <xsl:if test="contains(string(),' -k ')">
148 <xsl:text> || true</xsl:text>
149 </xsl:if>
150 <xsl:text>&#xA;</xsl:text>
151 </xsl:otherwise>
152 </xsl:choose>
153 </xsl:template>
154
155 <xsl:template match="userinput" mode="screen">
156 <xsl:choose>
157 <!-- Estandarized package formats -->
158 <xsl:when test="contains(string(),'tar.gz')">
159 <xsl:value-of select="substring-before(string(),'tar.gz')"/>
160 <xsl:text>tar.*</xsl:text>
161 <xsl:value-of select="substring-after(string(),'tar.gz')"/>
162 <xsl:text>&#xA;</xsl:text>
163 </xsl:when>
164 <!-- Setting $LANG for /etc/profile -->
165 <xsl:when test="ancestor::sect1[@id='ch-scripts-profile'] and
166 contains(string(),'export LANG=')">
167 <xsl:value-of select="substring-before(string(),'export LANG=')"/>
168 <xsl:text>export LANG=</xsl:text>
169 <xsl:value-of select="$lang"/>
170 <xsl:value-of select="substring-after(string(),'charmap]')"/>
171 <xsl:text>&#xA;</xsl:text>
172 </xsl:when>
173 <!-- Compile the keymap into the kernel has been disabled for 1.0 -->
174 <xsl:when test="contains(string(),'defkeymap')"/>
175 <!-- Copying the kernel config file -->
176 <xsl:when test="string() = 'make mrproper'">
177 <xsl:text>make mrproper&#xA;</xsl:text>
178 <xsl:if test="ancestor::sect1[@id='ch-boot-kernel']">
179 <xsl:text>cp -v ../bootkernel-config .config&#xA;</xsl:text>
180 </xsl:if>
181 <xsl:if test="ancestor::sect1[@id='ch-bootable-kernel']">
182 <xsl:text>cp -v ../kernel-config .config&#xA;</xsl:text>
183 </xsl:if>
184 </xsl:when>
185 <!-- No interactive commands are needed if the .config file is the proper one -->
186 <xsl:when test="contains(string(),'menuconfig')"/>
187<!-- test instructions -->
188 <xsl:when test="@remap = 'test'">
189 <xsl:if test="not(ancestor::note[@os='a00'] and $method='chroot')">
190 <!-- Avoid executing the note before perl tests while in 'chroot' -->
191 <xsl:if test="
192 $testsuite = '0' or
193 $testsuite = '1' and
194 not(ancestor::sect1[@id='ch-system-gcc']) and
195 not(ancestor::sect1[contains(@id,'ch-system-eglibc')]) and
196 not(ancestor::sect1[contains(@id,'ch-system-glibc')]) and
197 not(ancestor::sect1[contains(@id,'ch-system-gmp')]) and
198 not(ancestor::sect1[contains(@id,'ch-system-mpfr')]) and
199 not(ancestor::sect1[contains(@id,'ch-system-mpc')]) and
200 not(ancestor::sect1[contains(@id,'ch-system-ppl')]) and
201 not(ancestor::sect1[contains(@id,'ch-system-isl')]) and
202 not(ancestor::sect1[contains(@id,'ch-system-cloog')]) and
203 not(ancestor::sect1[contains(@id,'ch-system-cloog-ppl')]) and
204 not(ancestor::sect1[@id='ch-system-binutils'])">
205 <xsl:text># </xsl:text>
206 </xsl:if>
207 <xsl:choose>
208 <xsl:when test="$bomb-testsuite = 'n'">
209 <xsl:choose>
210 <!-- special case for (e)glibc -->
211 <xsl:when test="contains(string(), 'glibc-check-log')">
212 <xsl:value-of
213 select="substring-before(string(),'2&gt;&amp;1')"/>
214 <xsl:text>&gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
215 </xsl:when>
216 <!-- special case for procps-ng -->
217 <xsl:when test="contains(string(), 'pushd')">
218 <xsl:text>{ </xsl:text>
219 <xsl:apply-templates/>
220 <xsl:text>; } &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
221 </xsl:when>
222 <xsl:when test="contains(string(), 'make -k')">
223 <xsl:apply-templates/>
224 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
225 </xsl:when>
226 <xsl:when test="contains(string(), 'make')">
227 <xsl:value-of select="substring-before(string(),'make')"/>
228 <xsl:text>make -k</xsl:text>
229 <xsl:value-of select="substring-after(string(),'make')"/>
230 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
231 </xsl:when>
232 <xsl:otherwise>
233 <xsl:apply-templates/>
234 <xsl:if test="not(contains(string(), '&gt;&gt;'))">
235 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
236 </xsl:if>
237 <xsl:text>&#xA;</xsl:text>
238 </xsl:otherwise>
239 </xsl:choose>
240 </xsl:when>
241 <xsl:otherwise>
242 <!-- bomb-testsuite != 'n'-->
243 <xsl:choose>
244 <!-- special case for (e)glibc -->
245 <xsl:when test="contains(string(), 'glibc-check-log')">
246 <xsl:value-of
247 select="substring-before(string(),'2&gt;&amp;1')"/>
248 <xsl:text>&gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
249 </xsl:when>
250 <!-- special case for gmp -->
251 <xsl:when test="contains(string(), 'tee gmp-check-log')">
252 <xsl:text>(</xsl:text>
253 <xsl:apply-templates/>
254 <xsl:text>&gt;&gt; $TEST_LOG 2&gt;&amp;1 &amp;&amp; exit $PIPESTATUS)&#xA;</xsl:text>
255 </xsl:when>
256 <!-- special case for procps-ng -->
257 <xsl:when test="contains(string(), 'pushd')">
258 <xsl:text>{ </xsl:text>
259 <xsl:apply-templates/>
260 <xsl:text>; } &gt;&gt; $TEST_LOG 2&gt;&amp;1&#xA;</xsl:text>
261 </xsl:when>
262 <xsl:when test="contains(string(), 'make -k')">
263 <xsl:apply-templates/>
264 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
265 </xsl:when>
266 <xsl:otherwise>
267 <xsl:apply-templates/>
268 <xsl:if test="not(contains(string(), '&gt;&gt;'))">
269 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
270 </xsl:if>
271 <xsl:text>&#xA;</xsl:text>
272 </xsl:otherwise>
273 </xsl:choose>
274 </xsl:otherwise>
275 </xsl:choose>
276 </xsl:if><!-- avoid executing note before perl tests -->
277 </xsl:when>
278<!-- End of test instructions -->
279
280 <!-- Fixing toolchain test suites run XXX more to fix -->
281 <xsl:when test="contains(string(),'glibc-check-log')">
282 <xsl:choose>
283 <xsl:when test="$testsuite != '0'">
284 <xsl:value-of select="substring-before(string(),'2&gt;')"/>
285 <xsl:choose>
286 <xsl:when test="$bomb-testsuite = 'n'">
287 <xsl:text>&gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
288 </xsl:when>
289 <xsl:otherwise>
290 <xsl:text>&gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
291 <xsl:if test="contains(string(),' -k ')">
292 <xsl:text> || true</xsl:text>
293 </xsl:if>
294 <xsl:text>&#xA;</xsl:text>
295 </xsl:otherwise>
296 </xsl:choose>
297 </xsl:when>
298 </xsl:choose>
299 </xsl:when>
300 <xsl:when test="string() = 'make check' or
301 contains(string(), 'make -k check')">
302 <xsl:choose>
303 <xsl:when test="$testsuite != '0'">
304 <xsl:choose>
305 <xsl:when test="$bomb-testsuite = 'n'">
306 <xsl:text>make -k check &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
307 </xsl:when>
308 <xsl:otherwise>
309 <xsl:apply-templates/>
310 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
311 <xsl:if test="contains(string(),' -k ')">
312 <xsl:text> || true</xsl:text>
313 </xsl:if>
314 <xsl:text>&#xA;</xsl:text>
315 </xsl:otherwise>
316 </xsl:choose>
317 </xsl:when>
318 </xsl:choose>
319 </xsl:when>
320 <xsl:when test="contains(string(),'test_summary') or
321 contains(string(),'expect -c')">
322 <xsl:choose>
323 <xsl:when test="$testsuite != '0'">
324 <xsl:apply-templates/>
325 <xsl:text> &gt;&gt; $TEST_LOG&#xA;</xsl:text>
326 </xsl:when>
327 </xsl:choose>
328 </xsl:when>
329 <!-- Don't stop on strip run -->
330 <xsl:when test="contains(string(),'strip ')">
331 <xsl:apply-templates/>
332 <xsl:text> || true&#xA;</xsl:text>
333 </xsl:when>
334 <!-- Add -j1 to make install commands -->
335 <xsl:when test="contains(string(),'make ') and
336 contains(string(),'install')">
337 <xsl:value-of select="substring-before(string(),'make ')"/>
338 <xsl:text>make -j1 </xsl:text>
339 <xsl:value-of select="substring-after(string(),'make ')"/>
340 <xsl:text>&#xA;</xsl:text>
341 </xsl:when>
342 <!-- The rest of commands -->
343 <xsl:otherwise>
344 <xsl:apply-templates/>
345 <xsl:text>&#xA;</xsl:text>
346 </xsl:otherwise>
347 </xsl:choose>
348 </xsl:template>
349
350 <xsl:template match="replaceable">
351 <xsl:choose>
352 <xsl:when test="ancestor::sect1[@id='ch-system-glibc']">
353 <xsl:value-of select="$timezone"/>
354 </xsl:when>
355 <xsl:when test="ancestor::sect1[@id='ch-system-eglibc']">
356 <xsl:value-of select="$timezone"/>
357 </xsl:when>
358 <xsl:when test="ancestor::sect1[@id='ch-system-groff']">
359 <xsl:value-of select="$page"/>
360 </xsl:when>
361 <xsl:when test="ancestor::sect1[@id='ch-cross-tools-flags']">
362 <xsl:choose>
363 <xsl:when test="contains(string(),'BUILD32')">
364 <xsl:choose>
365 <xsl:when test="$sparc = '1' or $sparc = '2'">
366 <xsl:text>-m32 -mcpu=ultrasparc -mtune=ultrasparc</xsl:text>
367 </xsl:when>
368 <xsl:when test="$sparc = '3'">
369 <xsl:text>-m32 -mcpu=ultrasparc3 -mtune=ultrasparc3</xsl:text>
370 </xsl:when>
371 </xsl:choose>
372 </xsl:when>
373 <xsl:when test="contains(string(),'BUILD64')">
374 <xsl:choose>
375 <xsl:when test="$sparc = '1' or $sparc = '2'">
376 <xsl:text>-m64 -mcpu=ultrasparc -mtune=ultrasparc</xsl:text>
377 </xsl:when>
378 <xsl:when test="$sparc = '3'">
379 <xsl:text>-m64 -mcpu=ultrasparc3 -mtune=ultrasparc3</xsl:text>
380 </xsl:when>
381 </xsl:choose>
382 </xsl:when>
383 <xsl:when test="contains(string(),'GCCTARGET')">
384 <xsl:choose>
385 <xsl:when test="$sparc = '1' or $sparc = '2'">
386 <xsl:text>-mcpu=ultrasparc -mtune=ultrasparc</xsl:text>
387 </xsl:when>
388 <xsl:when test="$sparc = '3'">
389 <xsl:text>-mcpu=ultrasparc3 -mtune=ultrasparc3</xsl:text>
390 </xsl:when>
391 </xsl:choose>
392 </xsl:when>
393 </xsl:choose>
394 </xsl:when>
395 <xsl:when test="ancestor::sect1[@id='ch-final-preps-variables']">
396 <xsl:choose>
397 <xsl:when test="contains(string(),'target triplet')">
398 <xsl:value-of select="$x86"/>
399 </xsl:when>
400 <xsl:when test="contains(string(),'mips')">
401 <xsl:value-of select="$mips"/>
402 </xsl:when>
403 <xsl:when test="contains(string(),'BUILD32')">
404 <xsl:choose>
405 <xsl:when test="$sparc = '1' or $sparc = '2'">
406 <xsl:text>-m32 -mcpu=ultrasparc -mtune=ultrasparc</xsl:text>
407 </xsl:when>
408 <xsl:when test="$sparc = '3'">
409 <xsl:text>-m32 -mcpu=ultrasparc3 -mtune=ultrasparc3</xsl:text>
410 </xsl:when>
411 </xsl:choose>
412 </xsl:when>
413 <xsl:when test="contains(string(),'BUILD64')">
414 <xsl:choose>
415 <xsl:when test="$sparc = '1' or $sparc = '2'">
416 <xsl:text>-m64 -mcpu=ultrasparc -mtune=ultrasparc</xsl:text>
417 </xsl:when>
418 <xsl:when test="$sparc = '3'">
419 <xsl:text>-m64 -mcpu=ultrasparc3 -mtune=ultrasparc3</xsl:text>
420 </xsl:when>
421 </xsl:choose>
422 </xsl:when>
423 <xsl:when test="contains(string(),'GCCTARGET')">
424 <xsl:choose>
425 <xsl:when test="$sparc = '1' or $sparc = '2'">
426 <xsl:text>-mcpu=ultrasparc -mtune=ultrasparc</xsl:text>
427 </xsl:when>
428 <xsl:when test="$sparc = '3'">
429 <xsl:text>-mcpu=ultrasparc3 -mtune=ultrasparc3</xsl:text>
430 </xsl:when>
431 </xsl:choose>
432 </xsl:when>
433 </xsl:choose>
434 </xsl:when>
435 <xsl:otherwise>
436 <xsl:text>**EDITME</xsl:text>
437 <xsl:apply-templates/>
438 <xsl:text>EDITME**</xsl:text>
439 </xsl:otherwise>
440 </xsl:choose>
441 </xsl:template>
442
443</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.