source: CLFS/clfs.xsl@ cfdb089

ablfs-more legacy trunk
Last change on this file since cfdb089 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
RevLine 
[877cc6a]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
[269d81c]9<xsl:stylesheet
10 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
[877cc6a]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
[28f4756]24 3 = alias to 2
25 -->
[877cc6a]26 <xsl:param name="testsuite" select="1"/>
27
[28f4756]28 <!-- Bomb on test suites failures?
[401f81e]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
[28f4756]31 -->
[401f81e]32 <xsl:param name="bomb-testsuite" select="n"/>
[28f4756]33
[877cc6a]34 <!-- Time zone -->
[a229600]35 <xsl:param name="timezone" select="GMT"/>
[877cc6a]36
37 <!-- Page size -->
38 <xsl:param name="page" select="letter"/>
39
40 <!-- Locale settings -->
[a229600]41 <xsl:param name="lang" select="C"/>
[877cc6a]42
[650acce]43 <!-- Sparc64 processor type -->
[c93f2b0]44 <xsl:param name="sparc" select="none"/>
[650acce]45
[3f83cb0]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
[877cc6a]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
[3f83cb0]59 ../@id='chapter-getting-materials'"/>
[877cc6a]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">
[1330ebc]95 <xsl:choose>
96 <xsl:when test="@id='ch-chroot-changingowner' or
97 @id='ch-chroot-creatingdirs' or
[7d6fe10]98 @id='ch-chroot-createfiles' or
99 @id='ch-system-stripping'">
[1330ebc]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>
[5f4982d]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>
[58b186c]110 <xsl:if test="sect2[@role='installation'] and
111 not(@id='ch-system-multiarch-wrapper')">
[877cc6a]112 <xsl:text>cd $PKGDIR&#xA;</xsl:text>
113 </xsl:if>
114 <xsl:apply-templates select=".//para/userinput | .//screen"/>
[68713c9]115 <xsl:if test="not(@id='ch-chroot-chroot')">
116 <xsl:text>echo -e "\n\nTotalseconds: $SECONDS\n"&#xA;</xsl:text>
117 </xsl:if>
[877cc6a]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
[489bdc2]134 not($testsuite = '2' or $testsuite = '3')">
135 <xsl:text># </xsl:text>
[877cc6a]136 </xsl:if>
[489bdc2]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>
[877cc6a]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>
[f4caf9c]173 <!-- Compile the keymap into the kernel has been disabled for 1.0 -->
174 <xsl:when test="contains(string(),'defkeymap')"/>
[877cc6a]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')"/>
[c3b96a9]187<!-- test instructions -->
[489bdc2]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 -->
[a229600]277 </xsl:when>
[c3b96a9]278<!-- End of test instructions -->
279
[608fbe1]280 <!-- Fixing toolchain test suites run XXX more to fix -->
[ee2c45c]281 <xsl:when test="contains(string(),'glibc-check-log')">
[877cc6a]282 <xsl:choose>
283 <xsl:when test="$testsuite != '0'">
[269d81c]284 <xsl:value-of select="substring-before(string(),'2&gt;')"/>
[28f4756]285 <xsl:choose>
[401f81e]286 <xsl:when test="$bomb-testsuite = 'n'">
[269d81c]287 <xsl:text>&gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
[28f4756]288 </xsl:when>
289 <xsl:otherwise>
[269d81c]290 <xsl:text>&gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
[a1f1969]291 <xsl:if test="contains(string(),' -k ')">
292 <xsl:text> || true</xsl:text>
293 </xsl:if>
294 <xsl:text>&#xA;</xsl:text>
[28f4756]295 </xsl:otherwise>
296 </xsl:choose>
[877cc6a]297 </xsl:when>
298 </xsl:choose>
299 </xsl:when>
[269d81c]300 <xsl:when test="string() = 'make check' or
301 contains(string(), 'make -k check')">
[877cc6a]302 <xsl:choose>
303 <xsl:when test="$testsuite != '0'">
[28f4756]304 <xsl:choose>
[401f81e]305 <xsl:when test="$bomb-testsuite = 'n'">
[269d81c]306 <xsl:text>make -k check &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
[28f4756]307 </xsl:when>
308 <xsl:otherwise>
[269d81c]309 <xsl:apply-templates/>
310 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
[a1f1969]311 <xsl:if test="contains(string(),' -k ')">
312 <xsl:text> || true</xsl:text>
313 </xsl:if>
314 <xsl:text>&#xA;</xsl:text>
[28f4756]315 </xsl:otherwise>
316 </xsl:choose>
[877cc6a]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/>
[28f4756]325 <xsl:text> &gt;&gt; $TEST_LOG&#xA;</xsl:text>
[877cc6a]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>
[433a5d4]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>
[877cc6a]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>
[608fbe1]355 <xsl:when test="ancestor::sect1[@id='ch-system-eglibc']">
356 <xsl:value-of select="$timezone"/>
357 </xsl:when>
[877cc6a]358 <xsl:when test="ancestor::sect1[@id='ch-system-groff']">
359 <xsl:value-of select="$page"/>
360 </xsl:when>
[650acce]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'">
[3f83cb0]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'">
[650acce]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>
[877cc6a]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.