source: CLFS/clfs.xsl@ 9695fa7

2.3 2.4 ablfs ablfs-more legacy new_features trunk
Last change on this file since 9695fa7 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
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"/>
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')">
[28f4756]132 <xsl:choose>
[401f81e]133 <xsl:when test="$bomb-testsuite = 'n'">
[28f4756]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/>
[a1f1969]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>
[28f4756]146 </xsl:otherwise>
147 </xsl:choose>
[877cc6a]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>
[f4caf9c]169 <!-- Compile the keymap into the kernel has been disabled for 1.0 -->
170 <xsl:when test="contains(string(),'defkeymap')"/>
[877cc6a]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 -->
[a229600]184 <xsl:when test="(ancestor::sect1[@id='ch-system-coreutils'] or
[877cc6a]185 ancestor::sect1[@id='ch-system-module-init-tools']) and
186 (contains(string(),'check') or
[a229600]187 contains(string(),'dummy'))">
188 <xsl:choose>
189 <xsl:when test="$testsuite = '0' or $testsuite = '1'"/>
190 <xsl:otherwise>
[28f4756]191 <xsl:if test="not(contains(string(),'check'))">
192 <xsl:apply-templates/>
193 <xsl:text>&#xA;</xsl:text>
194 </xsl:if>
[a229600]195 <xsl:if test="contains(string(),'check')">
[28f4756]196 <xsl:choose>
[401f81e]197 <xsl:when test="$bomb-testsuite = 'n'">
[28f4756]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/>
[3014928]205 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
[a1f1969]206 <xsl:if test="contains(string(),' -k ')">
207 <xsl:text> || true</xsl:text>
208 </xsl:if>
[f98695c]209 <xsl:text>&#xA;</xsl:text>
[28f4756]210 </xsl:otherwise>
211 </xsl:choose>
[a229600]212 </xsl:if>
213 </xsl:otherwise>
214 </xsl:choose>
215 </xsl:when>
[877cc6a]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'">
[28f4756]221 <xsl:choose>
[401f81e]222 <xsl:when test="$bomb-testsuite = 'n'">
[28f4756]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/>
[a1f1969]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>
[28f4756]232 </xsl:otherwise>
233 </xsl:choose>
[877cc6a]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'">
[a229600]240 <xsl:value-of select="substring-before(string(),'&gt;g')"/>
[28f4756]241 <xsl:choose>
[401f81e]242 <xsl:when test="$bomb-testsuite = 'n'">
[28f4756]243 <xsl:text>&gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
244 </xsl:when>
245 <xsl:otherwise>
[a1f1969]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>
[28f4756]251 </xsl:otherwise>
252 </xsl:choose>
[877cc6a]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/>
[28f4756]261 <xsl:text> &gt;&gt; $TEST_LOG&#xA;</xsl:text>
[877cc6a]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>
[650acce]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>
[877cc6a]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.