source: CLFS/clfs.xsl@ cb29c9c

2.4 ablfs-more legacy new_features trunk
Last change on this file since cb29c9c was 608fbe1, checked in by Matthew Burgess <matthew@…>, 13 years ago

Fix various issues when building CLFS.

  • Property mode set to 100644
File size: 13.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
9<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
10 xmlns:exsl="http://exslt.org/common"
11 extension-element-prefixes="exsl"
12 version="1.0">
13
14<!-- XSLT stylesheet to create shell scripts from CLFS books. -->
15
16 <!-- Build method used -->
17 <xsl:param name="method" select="chroot"/>
18
19 <!-- Run test suites?
20 0 = none
21 1 = only Glibc, GCC and Binutils testsuites
22 2 = all testsuites
[28f4756]23 3 = alias to 2
24 -->
[877cc6a]25 <xsl:param name="testsuite" select="1"/>
26
[28f4756]27 <!-- Bomb on test suites failures?
[401f81e]28 n = no, I want to build the full system and review the logs
29 y = yes, bomb at the first test suite failure to can review the build dir
[28f4756]30 -->
[401f81e]31 <xsl:param name="bomb-testsuite" select="n"/>
[28f4756]32
[877cc6a]33 <!-- Install vim-lang package? -->
[401f81e]34 <xsl:param name="vim-lang" select="y"/>
[877cc6a]35
36 <!-- Time zone -->
[a229600]37 <xsl:param name="timezone" select="GMT"/>
[877cc6a]38
39 <!-- Page size -->
40 <xsl:param name="page" select="letter"/>
41
42 <!-- Locale settings -->
[a229600]43 <xsl:param name="lang" select="C"/>
[877cc6a]44
[650acce]45 <!-- Sparc64 processor type -->
[c93f2b0]46 <xsl:param name="sparc" select="none"/>
[650acce]47
[877cc6a]48 <xsl:template match="/">
49 <xsl:apply-templates select="//sect1"/>
50 </xsl:template>
51
52 <xsl:template match="sect1">
53 <xsl:choose>
54 <xsl:when test="../@id='chapter-partitioning' or
55 ../@id='chapter-getting-materials' or
56 ../@id='chapter-final-preps'"/>
57 <xsl:when test="../@id='chapter-testsuite-tools' and $testsuite='0'"/>
58 <xsl:when test="../@id='chapter-boot' and $method='chroot'"/>
59 <xsl:when test="../@id='chapter-chroot' and $method='boot'"/>
60 <xsl:otherwise>
61 <xsl:if test="count(descendant::screen/userinput) &gt; 0 and
62 count(descendant::screen/userinput) &gt;
63 count(descendant::screen[@role='nodump'])">
64 <!-- The dirs names -->
65 <xsl:variable name="pi-dir" select="../processing-instruction('dbhtml')"/>
66 <xsl:variable name="pi-dir-value" select="substring-after($pi-dir,'dir=')"/>
67 <xsl:variable name="quote-dir" select="substring($pi-dir-value,1,1)"/>
68 <xsl:variable name="dirname" select="substring-before(substring($pi-dir-value,2),$quote-dir)"/>
69 <!-- The file names -->
70 <xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/>
71 <xsl:variable name="pi-file-value" select="substring-after($pi-file,'filename=')"/>
72 <xsl:variable name="filename" select="substring-before(substring($pi-file-value,2),'.html')"/>
73 <!-- The build order -->
74 <xsl:variable name="position" select="position()"/>
75 <xsl:variable name="order">
76 <xsl:choose>
77 <xsl:when test="string-length($position) = 1">
78 <xsl:text>00</xsl:text>
79 <xsl:value-of select="$position"/>
80 </xsl:when>
81 <xsl:when test="string-length($position) = 2">
82 <xsl:text>0</xsl:text>
83 <xsl:value-of select="$position"/>
84 </xsl:when>
85 <xsl:otherwise>
86 <xsl:value-of select="$position"/>
87 </xsl:otherwise>
88 </xsl:choose>
89 </xsl:variable>
90 <!-- Creating dirs and files -->
91 <exsl:document href="{$dirname}/{$order}-{$filename}" method="text">
[1330ebc]92 <xsl:choose>
93 <xsl:when test="@id='ch-chroot-changingowner' or
94 @id='ch-chroot-creatingdirs' or
[7d6fe10]95 @id='ch-chroot-createfiles' or
96 @id='ch-system-stripping'">
[1330ebc]97 <xsl:text>#!/tools/bin/bash&#xA;set +h&#xA;</xsl:text>
98 </xsl:when>
99 <xsl:otherwise>
100 <xsl:text>#!/bin/bash&#xA;set +h&#xA;</xsl:text>
101 </xsl:otherwise>
102 </xsl:choose>
[5f4982d]103 <xsl:if test="not(@id='ch-system-stripping')">
104 <xsl:text>set -e</xsl:text>
105 </xsl:if>
106 <xsl:text>&#xA;</xsl:text>
[58b186c]107 <xsl:if test="sect2[@role='installation'] and
108 not(@id='ch-system-multiarch-wrapper')">
[877cc6a]109 <xsl:text>cd $PKGDIR&#xA;</xsl:text>
[401f81e]110 <xsl:if test="@id='ch-system-vim' and $vim-lang = 'y'">
[877cc6a]111 <xsl:text>tar -xvf ../vim-&vim-version;-lang.* --strip-components=1&#xA;</xsl:text>
112 </xsl:if>
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
134 ($testsuite = '2' or $testsuite = '3')">
[28f4756]135 <xsl:choose>
[401f81e]136 <xsl:when test="$bomb-testsuite = 'n'">
[28f4756]137 <xsl:value-of select="substring-before(string(),'make')"/>
138 <xsl:text>make -k</xsl:text>
139 <xsl:value-of select="substring-after(string(),'make')"/>
140 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
141 </xsl:when>
142 <xsl:otherwise>
143 <xsl:apply-templates/>
[a1f1969]144 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
145 <xsl:if test="contains(string(),' -k ')">
146 <xsl:text> || true</xsl:text>
147 </xsl:if>
148 <xsl:text>&#xA;</xsl:text>
[28f4756]149 </xsl:otherwise>
150 </xsl:choose>
[877cc6a]151 </xsl:if>
152 </xsl:template>
153
154 <xsl:template match="userinput" mode="screen">
155 <xsl:choose>
156 <!-- Estandarized package formats -->
157 <xsl:when test="contains(string(),'tar.gz')">
158 <xsl:value-of select="substring-before(string(),'tar.gz')"/>
159 <xsl:text>tar.*</xsl:text>
160 <xsl:value-of select="substring-after(string(),'tar.gz')"/>
161 <xsl:text>&#xA;</xsl:text>
162 </xsl:when>
163 <!-- Setting $LANG for /etc/profile -->
164 <xsl:when test="ancestor::sect1[@id='ch-scripts-profile'] and
165 contains(string(),'export LANG=')">
166 <xsl:value-of select="substring-before(string(),'export LANG=')"/>
167 <xsl:text>export LANG=</xsl:text>
168 <xsl:value-of select="$lang"/>
169 <xsl:value-of select="substring-after(string(),'charmap]')"/>
170 <xsl:text>&#xA;</xsl:text>
171 </xsl:when>
[f4caf9c]172 <!-- Compile the keymap into the kernel has been disabled for 1.0 -->
173 <xsl:when test="contains(string(),'defkeymap')"/>
[877cc6a]174 <!-- Copying the kernel config file -->
175 <xsl:when test="string() = 'make mrproper'">
176 <xsl:text>make mrproper&#xA;</xsl:text>
177 <xsl:if test="ancestor::sect1[@id='ch-boot-kernel']">
178 <xsl:text>cp -v ../bootkernel-config .config&#xA;</xsl:text>
179 </xsl:if>
180 <xsl:if test="ancestor::sect1[@id='ch-bootable-kernel']">
181 <xsl:text>cp -v ../kernel-config .config&#xA;</xsl:text>
182 </xsl:if>
183 </xsl:when>
184 <!-- No interactive commands are needed if the .config file is the proper one -->
185 <xsl:when test="contains(string(),'menuconfig')"/>
186 <!-- The Coreutils and Module-Init-Tools test suites are optional -->
[a229600]187 <xsl:when test="(ancestor::sect1[@id='ch-system-coreutils'] or
[877cc6a]188 ancestor::sect1[@id='ch-system-module-init-tools']) and
189 (contains(string(),'check') or
[a229600]190 contains(string(),'dummy'))">
191 <xsl:choose>
192 <xsl:when test="$testsuite = '0' or $testsuite = '1'"/>
193 <xsl:otherwise>
[28f4756]194 <xsl:if test="not(contains(string(),'check'))">
195 <xsl:apply-templates/>
196 <xsl:text>&#xA;</xsl:text>
197 </xsl:if>
[a229600]198 <xsl:if test="contains(string(),'check')">
[28f4756]199 <xsl:choose>
[401f81e]200 <xsl:when test="$bomb-testsuite = 'n'">
[28f4756]201 <xsl:value-of select="substring-before(string(),'check')"/>
202 <xsl:text>-k check</xsl:text>
203 <xsl:value-of select="substring-after(string(),'check')"/>
204 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
205 </xsl:when>
206 <xsl:otherwise>
207 <xsl:apply-templates/>
[3014928]208 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
[a1f1969]209 <xsl:if test="contains(string(),' -k ')">
210 <xsl:text> || true</xsl:text>
211 </xsl:if>
[f98695c]212 <xsl:text>&#xA;</xsl:text>
[28f4756]213 </xsl:otherwise>
214 </xsl:choose>
[a229600]215 </xsl:if>
216 </xsl:otherwise>
217 </xsl:choose>
218 </xsl:when>
[608fbe1]219 <!-- Fixing toolchain test suites run XXX more to fix -->
[877cc6a]220 <xsl:when test="string() = 'make check' or
[608fbe1]221 contains(string(), 'make -k check')">
[877cc6a]222 <xsl:choose>
223 <xsl:when test="$testsuite != '0'">
[28f4756]224 <xsl:choose>
[401f81e]225 <xsl:when test="$bomb-testsuite = 'n'">
[28f4756]226 <xsl:text>make -k check &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
227 </xsl:when>
228 <xsl:otherwise>
229 <xsl:apply-templates/>
[a1f1969]230 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
231 <xsl:if test="contains(string(),' -k ')">
232 <xsl:text> || true</xsl:text>
233 </xsl:if>
234 <xsl:text>&#xA;</xsl:text>
[28f4756]235 </xsl:otherwise>
236 </xsl:choose>
[877cc6a]237 </xsl:when>
238 </xsl:choose>
239 </xsl:when>
240 <xsl:when test="contains(string(),'glibc-check-log')">
241 <xsl:choose>
242 <xsl:when test="$testsuite != '0'">
[a229600]243 <xsl:value-of select="substring-before(string(),'&gt;g')"/>
[28f4756]244 <xsl:choose>
[401f81e]245 <xsl:when test="$bomb-testsuite = 'n'">
[28f4756]246 <xsl:text>&gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
247 </xsl:when>
248 <xsl:otherwise>
[a1f1969]249 <xsl:text>&gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
250 <xsl:if test="contains(string(),' -k ')">
251 <xsl:text> || true</xsl:text>
252 </xsl:if>
253 <xsl:text>&#xA;</xsl:text>
[28f4756]254 </xsl:otherwise>
255 </xsl:choose>
[877cc6a]256 </xsl:when>
257 </xsl:choose>
258 </xsl:when>
259 <xsl:when test="contains(string(),'test_summary') or
260 contains(string(),'expect -c')">
261 <xsl:choose>
262 <xsl:when test="$testsuite != '0'">
263 <xsl:apply-templates/>
[28f4756]264 <xsl:text> &gt;&gt; $TEST_LOG&#xA;</xsl:text>
[877cc6a]265 </xsl:when>
266 </xsl:choose>
267 </xsl:when>
268 <!-- Don't stop on strip run -->
269 <xsl:when test="contains(string(),'strip ')">
270 <xsl:apply-templates/>
271 <xsl:text> || true&#xA;</xsl:text>
272 </xsl:when>
273 <!-- The rest of commands -->
274 <xsl:otherwise>
275 <xsl:apply-templates/>
276 <xsl:text>&#xA;</xsl:text>
277 </xsl:otherwise>
278 </xsl:choose>
279 </xsl:template>
280
281 <xsl:template match="replaceable">
282 <xsl:choose>
283 <xsl:when test="ancestor::sect1[@id='ch-system-glibc']">
284 <xsl:value-of select="$timezone"/>
285 </xsl:when>
[608fbe1]286 <xsl:when test="ancestor::sect1[@id='ch-system-eglibc']">
287 <xsl:value-of select="$timezone"/>
288 </xsl:when>
[877cc6a]289 <xsl:when test="ancestor::sect1[@id='ch-system-groff']">
290 <xsl:value-of select="$page"/>
291 </xsl:when>
[650acce]292 <xsl:when test="ancestor::sect1[@id='ch-cross-tools-flags']">
293 <xsl:choose>
294 <xsl:when test="contains(string(),'BUILD32')">
295 <xsl:choose>
296 <xsl:when test="$sparc = '1' or $sparc = '2'">
297 <xsl:text>-m32 -mcpu=ultrasparc -mtune=ultrasparc</xsl:text>
298 </xsl:when>
299 <xsl:when test="$sparc = '3'">
300 <xsl:text>-m32 -mcpu=ultrasparc3 -mtune=ultrasparc3</xsl:text>
301 </xsl:when>
302 </xsl:choose>
303 </xsl:when>
304 <xsl:when test="contains(string(),'BUILD64')">
305 <xsl:choose>
306 <xsl:when test="$sparc = '1' or $sparc = '2'">
307 <xsl:text>-m64 -mcpu=ultrasparc -mtune=ultrasparc</xsl:text>
308 </xsl:when>
309 <xsl:when test="$sparc = '3'">
310 <xsl:text>-m64 -mcpu=ultrasparc3 -mtune=ultrasparc3</xsl:text>
311 </xsl:when>
312 </xsl:choose>
313 </xsl:when>
314 <xsl:when test="contains(string(),'GCCTARGET')">
315 <xsl:choose>
316 <xsl:when test="$sparc = '1' or $sparc = '2'">
317 <xsl:text>-mcpu=ultrasparc -mtune=ultrasparc</xsl:text>
318 </xsl:when>
319 <xsl:when test="$sparc = '3'">
320 <xsl:text>-mcpu=ultrasparc3 -mtune=ultrasparc3</xsl:text>
321 </xsl:when>
322 </xsl:choose>
323 </xsl:when>
324 </xsl:choose>
325 </xsl:when>
[877cc6a]326 <xsl:otherwise>
327 <xsl:text>**EDITME</xsl:text>
328 <xsl:apply-templates/>
329 <xsl:text>EDITME**</xsl:text>
330 </xsl:otherwise>
331 </xsl:choose>
332 </xsl:template>
333
334</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.