source: CLFS/clfs.xsl@ d09e32a

2.3 2.4 ablfs ablfs-more legacy new_features trunk
Last change on this file since d09e32a was c93f2b0, checked in by Manuel Canales Esparcia <manuel@…>, 17 years ago

CLFS: Using a more sane default for sparc param.

  • Property mode set to 100644
File size: 12.9 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 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
23 3 = alias to 2
24 -->
25 <xsl:param name="testsuite" select="1"/>
26
27 <!-- Bomb on test suites failures?
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
30 -->
31 <xsl:param name="bomb-testsuite" select="n"/>
32
33 <!-- Install vim-lang package? -->
34 <xsl:param name="vim-lang" select="y"/>
35
36 <!-- Time zone -->
37 <xsl:param name="timezone" select="GMT"/>
38
39 <!-- Page size -->
40 <xsl:param name="page" select="letter"/>
41
42 <!-- Locale settings -->
43 <xsl:param name="lang" select="C"/>
44
45 <!-- Sparc64 processor type -->
46 <xsl:param name="sparc" select="none"/>
47
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">
92 <xsl:choose>
93 <xsl:when test="@id='ch-chroot-changingowner' or
94 @id='ch-chroot-creatingdirs' or
95 @id='ch-chroot-createfiles' or
96 @id='ch-system-stripping'">
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>
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>
107 <xsl:if test="sect2[@role='installation'] and
108 not(@id='ch-system-multiarch-wrapper')">
109 <xsl:text>cd $PKGDIR&#xA;</xsl:text>
110 <xsl:if test="@id='ch-system-vim' and $vim-lang = 'y'">
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"/>
115 <xsl:text>exit</xsl:text>
116 </exsl:document>
117 </xsl:if>
118 </xsl:otherwise>
119 </xsl:choose>
120 </xsl:template>
121
122 <xsl:template match="screen">
123 <xsl:if test="child::* = userinput and not(@role = 'nodump')">
124 <xsl:apply-templates select="userinput" mode="screen"/>
125 </xsl:if>
126 </xsl:template>
127
128 <xsl:template match="para/userinput">
129 <xsl:if test="(contains(string(),'test') or
130 contains(string(),'check')) and
131 ($testsuite = '2' or $testsuite = '3')">
132 <xsl:choose>
133 <xsl:when test="$bomb-testsuite = 'n'">
134 <xsl:value-of select="substring-before(string(),'make')"/>
135 <xsl:text>make -k</xsl:text>
136 <xsl:value-of select="substring-after(string(),'make')"/>
137 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
138 </xsl:when>
139 <xsl:otherwise>
140 <xsl:apply-templates/>
141 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
142 <xsl:if test="contains(string(),' -k ')">
143 <xsl:text> || true</xsl:text>
144 </xsl:if>
145 <xsl:text>&#xA;</xsl:text>
146 </xsl:otherwise>
147 </xsl:choose>
148 </xsl:if>
149 </xsl:template>
150
151 <xsl:template match="userinput" mode="screen">
152 <xsl:choose>
153 <!-- Estandarized package formats -->
154 <xsl:when test="contains(string(),'tar.gz')">
155 <xsl:value-of select="substring-before(string(),'tar.gz')"/>
156 <xsl:text>tar.*</xsl:text>
157 <xsl:value-of select="substring-after(string(),'tar.gz')"/>
158 <xsl:text>&#xA;</xsl:text>
159 </xsl:when>
160 <!-- Setting $LANG for /etc/profile -->
161 <xsl:when test="ancestor::sect1[@id='ch-scripts-profile'] and
162 contains(string(),'export LANG=')">
163 <xsl:value-of select="substring-before(string(),'export LANG=')"/>
164 <xsl:text>export LANG=</xsl:text>
165 <xsl:value-of select="$lang"/>
166 <xsl:value-of select="substring-after(string(),'charmap]')"/>
167 <xsl:text>&#xA;</xsl:text>
168 </xsl:when>
169 <!-- Compile the keymap into the kernel has been disabled for 1.0 -->
170 <xsl:when test="contains(string(),'defkeymap')"/>
171 <!-- Copying the kernel config file -->
172 <xsl:when test="string() = 'make mrproper'">
173 <xsl:text>make mrproper&#xA;</xsl:text>
174 <xsl:if test="ancestor::sect1[@id='ch-boot-kernel']">
175 <xsl:text>cp -v ../bootkernel-config .config&#xA;</xsl:text>
176 </xsl:if>
177 <xsl:if test="ancestor::sect1[@id='ch-bootable-kernel']">
178 <xsl:text>cp -v ../kernel-config .config&#xA;</xsl:text>
179 </xsl:if>
180 </xsl:when>
181 <!-- No interactive commands are needed if the .config file is the proper one -->
182 <xsl:when test="contains(string(),'menuconfig')"/>
183 <!-- The Coreutils and Module-Init-Tools test suites are optional -->
184 <xsl:when test="(ancestor::sect1[@id='ch-system-coreutils'] or
185 ancestor::sect1[@id='ch-system-module-init-tools']) and
186 (contains(string(),'check') or
187 contains(string(),'dummy'))">
188 <xsl:choose>
189 <xsl:when test="$testsuite = '0' or $testsuite = '1'"/>
190 <xsl:otherwise>
191 <xsl:if test="not(contains(string(),'check'))">
192 <xsl:apply-templates/>
193 <xsl:text>&#xA;</xsl:text>
194 </xsl:if>
195 <xsl:if test="contains(string(),'check')">
196 <xsl:choose>
197 <xsl:when test="$bomb-testsuite = 'n'">
198 <xsl:value-of select="substring-before(string(),'check')"/>
199 <xsl:text>-k check</xsl:text>
200 <xsl:value-of select="substring-after(string(),'check')"/>
201 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
202 </xsl:when>
203 <xsl:otherwise>
204 <xsl:apply-templates/>
205 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
206 <xsl:if test="contains(string(),' -k ')">
207 <xsl:text> || true</xsl:text>
208 </xsl:if>
209 <xsl:text>&#xA;</xsl:text>
210 </xsl:otherwise>
211 </xsl:choose>
212 </xsl:if>
213 </xsl:otherwise>
214 </xsl:choose>
215 </xsl:when>
216 <!-- Fixing toolchain test suites run -->
217 <xsl:when test="string() = 'make check' or
218 string() = 'make -k check'">
219 <xsl:choose>
220 <xsl:when test="$testsuite != '0'">
221 <xsl:choose>
222 <xsl:when test="$bomb-testsuite = 'n'">
223 <xsl:text>make -k check &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
224 </xsl:when>
225 <xsl:otherwise>
226 <xsl:apply-templates/>
227 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
228 <xsl:if test="contains(string(),' -k ')">
229 <xsl:text> || true</xsl:text>
230 </xsl:if>
231 <xsl:text>&#xA;</xsl:text>
232 </xsl:otherwise>
233 </xsl:choose>
234 </xsl:when>
235 </xsl:choose>
236 </xsl:when>
237 <xsl:when test="contains(string(),'glibc-check-log')">
238 <xsl:choose>
239 <xsl:when test="$testsuite != '0'">
240 <xsl:value-of select="substring-before(string(),'&gt;g')"/>
241 <xsl:choose>
242 <xsl:when test="$bomb-testsuite = 'n'">
243 <xsl:text>&gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
244 </xsl:when>
245 <xsl:otherwise>
246 <xsl:text>&gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
247 <xsl:if test="contains(string(),' -k ')">
248 <xsl:text> || true</xsl:text>
249 </xsl:if>
250 <xsl:text>&#xA;</xsl:text>
251 </xsl:otherwise>
252 </xsl:choose>
253 </xsl:when>
254 </xsl:choose>
255 </xsl:when>
256 <xsl:when test="contains(string(),'test_summary') or
257 contains(string(),'expect -c')">
258 <xsl:choose>
259 <xsl:when test="$testsuite != '0'">
260 <xsl:apply-templates/>
261 <xsl:text> &gt;&gt; $TEST_LOG&#xA;</xsl:text>
262 </xsl:when>
263 </xsl:choose>
264 </xsl:when>
265 <!-- Don't stop on strip run -->
266 <xsl:when test="contains(string(),'strip ')">
267 <xsl:apply-templates/>
268 <xsl:text> || true&#xA;</xsl:text>
269 </xsl:when>
270 <!-- The rest of commands -->
271 <xsl:otherwise>
272 <xsl:apply-templates/>
273 <xsl:text>&#xA;</xsl:text>
274 </xsl:otherwise>
275 </xsl:choose>
276 </xsl:template>
277
278 <xsl:template match="replaceable">
279 <xsl:choose>
280 <xsl:when test="ancestor::sect1[@id='ch-system-glibc']">
281 <xsl:value-of select="$timezone"/>
282 </xsl:when>
283 <xsl:when test="ancestor::sect1[@id='ch-system-groff']">
284 <xsl:value-of select="$page"/>
285 </xsl:when>
286 <xsl:when test="ancestor::sect1[@id='ch-cross-tools-flags']">
287 <xsl:choose>
288 <xsl:when test="contains(string(),'BUILD32')">
289 <xsl:choose>
290 <xsl:when test="$sparc = '1' or $sparc = '2'">
291 <xsl:text>-m32 -mcpu=ultrasparc -mtune=ultrasparc</xsl:text>
292 </xsl:when>
293 <xsl:when test="$sparc = '3'">
294 <xsl:text>-m32 -mcpu=ultrasparc3 -mtune=ultrasparc3</xsl:text>
295 </xsl:when>
296 </xsl:choose>
297 </xsl:when>
298 <xsl:when test="contains(string(),'BUILD64')">
299 <xsl:choose>
300 <xsl:when test="$sparc = '1' or $sparc = '2'">
301 <xsl:text>-m64 -mcpu=ultrasparc -mtune=ultrasparc</xsl:text>
302 </xsl:when>
303 <xsl:when test="$sparc = '3'">
304 <xsl:text>-m64 -mcpu=ultrasparc3 -mtune=ultrasparc3</xsl:text>
305 </xsl:when>
306 </xsl:choose>
307 </xsl:when>
308 <xsl:when test="contains(string(),'GCCTARGET')">
309 <xsl:choose>
310 <xsl:when test="$sparc = '1' or $sparc = '2'">
311 <xsl:text>-mcpu=ultrasparc -mtune=ultrasparc</xsl:text>
312 </xsl:when>
313 <xsl:when test="$sparc = '3'">
314 <xsl:text>-mcpu=ultrasparc3 -mtune=ultrasparc3</xsl:text>
315 </xsl:when>
316 </xsl:choose>
317 </xsl:when>
318 </xsl:choose>
319 </xsl:when>
320 <xsl:otherwise>
321 <xsl:text>**EDITME</xsl:text>
322 <xsl:apply-templates/>
323 <xsl:text>EDITME**</xsl:text>
324 </xsl:otherwise>
325 </xsl:choose>
326 </xsl:template>
327
328</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.