source: CLFS/clfs.xsl@ bb4b5c3

2.4 ablfs-more legacy new_features trunk
Last change on this file since bb4b5c3 was 269d81c, checked in by Pierre Labastie <pierre@…>, 11 years ago

Incorporates BLFS tools to CLFS. WOrks with method=chroot. Not tested
with method=boot

  • Property mode set to 100644
File size: 13.8 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
[269d81c]34 <!-- Install vim-lang package? OBSOLETE should always be 'n'-->
35 <xsl:param name="vim-lang" select="n"/>
[877cc6a]36
37 <!-- Time zone -->
[a229600]38 <xsl:param name="timezone" select="GMT"/>
[877cc6a]39
40 <!-- Page size -->
41 <xsl:param name="page" select="letter"/>
42
43 <!-- Locale settings -->
[a229600]44 <xsl:param name="lang" select="C"/>
[877cc6a]45
[650acce]46 <!-- Sparc64 processor type -->
[c93f2b0]47 <xsl:param name="sparc" select="none"/>
[650acce]48
[877cc6a]49 <xsl:template match="/">
50 <xsl:apply-templates select="//sect1"/>
51 </xsl:template>
52
53 <xsl:template match="sect1">
54 <xsl:choose>
55 <xsl:when test="../@id='chapter-partitioning' or
56 ../@id='chapter-getting-materials' or
57 ../@id='chapter-final-preps'"/>
58 <xsl:when test="../@id='chapter-testsuite-tools' and $testsuite='0'"/>
59 <xsl:when test="../@id='chapter-boot' and $method='chroot'"/>
60 <xsl:when test="../@id='chapter-chroot' and $method='boot'"/>
61 <xsl:otherwise>
62 <xsl:if test="count(descendant::screen/userinput) &gt; 0 and
63 count(descendant::screen/userinput) &gt;
64 count(descendant::screen[@role='nodump'])">
65 <!-- The dirs names -->
66 <xsl:variable name="pi-dir" select="../processing-instruction('dbhtml')"/>
67 <xsl:variable name="pi-dir-value" select="substring-after($pi-dir,'dir=')"/>
68 <xsl:variable name="quote-dir" select="substring($pi-dir-value,1,1)"/>
69 <xsl:variable name="dirname" select="substring-before(substring($pi-dir-value,2),$quote-dir)"/>
70 <!-- The file names -->
71 <xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/>
72 <xsl:variable name="pi-file-value" select="substring-after($pi-file,'filename=')"/>
73 <xsl:variable name="filename" select="substring-before(substring($pi-file-value,2),'.html')"/>
74 <!-- The build order -->
75 <xsl:variable name="position" select="position()"/>
76 <xsl:variable name="order">
77 <xsl:choose>
78 <xsl:when test="string-length($position) = 1">
79 <xsl:text>00</xsl:text>
80 <xsl:value-of select="$position"/>
81 </xsl:when>
82 <xsl:when test="string-length($position) = 2">
83 <xsl:text>0</xsl:text>
84 <xsl:value-of select="$position"/>
85 </xsl:when>
86 <xsl:otherwise>
87 <xsl:value-of select="$position"/>
88 </xsl:otherwise>
89 </xsl:choose>
90 </xsl:variable>
91 <!-- Creating dirs and files -->
92 <exsl:document href="{$dirname}/{$order}-{$filename}" method="text">
[1330ebc]93 <xsl:choose>
94 <xsl:when test="@id='ch-chroot-changingowner' or
95 @id='ch-chroot-creatingdirs' or
[7d6fe10]96 @id='ch-chroot-createfiles' or
97 @id='ch-system-stripping'">
[1330ebc]98 <xsl:text>#!/tools/bin/bash&#xA;set +h&#xA;</xsl:text>
99 </xsl:when>
100 <xsl:otherwise>
101 <xsl:text>#!/bin/bash&#xA;set +h&#xA;</xsl:text>
102 </xsl:otherwise>
103 </xsl:choose>
[5f4982d]104 <xsl:if test="not(@id='ch-system-stripping')">
105 <xsl:text>set -e</xsl:text>
106 </xsl:if>
107 <xsl:text>&#xA;</xsl:text>
[58b186c]108 <xsl:if test="sect2[@role='installation'] and
109 not(@id='ch-system-multiarch-wrapper')">
[877cc6a]110 <xsl:text>cd $PKGDIR&#xA;</xsl:text>
[401f81e]111 <xsl:if test="@id='ch-system-vim' and $vim-lang = 'y'">
[877cc6a]112 <xsl:text>tar -xvf ../vim-&vim-version;-lang.* --strip-components=1&#xA;</xsl:text>
113 </xsl:if>
114 </xsl:if>
115 <xsl:apply-templates select=".//para/userinput | .//screen"/>
[68713c9]116 <xsl:if test="not(@id='ch-chroot-chroot')">
117 <xsl:text>echo -e "\n\nTotalseconds: $SECONDS\n"&#xA;</xsl:text>
118 </xsl:if>
[877cc6a]119 <xsl:text>exit</xsl:text>
120 </exsl:document>
121 </xsl:if>
122 </xsl:otherwise>
123 </xsl:choose>
124 </xsl:template>
125
126 <xsl:template match="screen">
127 <xsl:if test="child::* = userinput and not(@role = 'nodump')">
128 <xsl:apply-templates select="userinput" mode="screen"/>
129 </xsl:if>
130 </xsl:template>
131
132 <xsl:template match="para/userinput">
133 <xsl:if test="(contains(string(),'test') or
134 contains(string(),'check')) and
135 ($testsuite = '2' or $testsuite = '3')">
[28f4756]136 <xsl:choose>
[401f81e]137 <xsl:when test="$bomb-testsuite = 'n'">
[28f4756]138 <xsl:value-of select="substring-before(string(),'make')"/>
139 <xsl:text>make -k</xsl:text>
140 <xsl:value-of select="substring-after(string(),'make')"/>
141 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
142 </xsl:when>
143 <xsl:otherwise>
144 <xsl:apply-templates/>
[a1f1969]145 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
146 <xsl:if test="contains(string(),' -k ')">
147 <xsl:text> || true</xsl:text>
148 </xsl:if>
149 <xsl:text>&#xA;</xsl:text>
[28f4756]150 </xsl:otherwise>
151 </xsl:choose>
[877cc6a]152 </xsl:if>
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')"/>
187 <!-- The Coreutils and Module-Init-Tools test suites are optional -->
[a229600]188 <xsl:when test="(ancestor::sect1[@id='ch-system-coreutils'] or
[877cc6a]189 ancestor::sect1[@id='ch-system-module-init-tools']) and
190 (contains(string(),'check') or
[a229600]191 contains(string(),'dummy'))">
192 <xsl:choose>
193 <xsl:when test="$testsuite = '0' or $testsuite = '1'"/>
194 <xsl:otherwise>
[28f4756]195 <xsl:if test="not(contains(string(),'check'))">
196 <xsl:apply-templates/>
197 <xsl:text>&#xA;</xsl:text>
198 </xsl:if>
[a229600]199 <xsl:if test="contains(string(),'check')">
[28f4756]200 <xsl:choose>
[401f81e]201 <xsl:when test="$bomb-testsuite = 'n'">
[28f4756]202 <xsl:value-of select="substring-before(string(),'check')"/>
203 <xsl:text>-k check</xsl:text>
204 <xsl:value-of select="substring-after(string(),'check')"/>
205 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
206 </xsl:when>
207 <xsl:otherwise>
208 <xsl:apply-templates/>
[3014928]209 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
[a1f1969]210 <xsl:if test="contains(string(),' -k ')">
211 <xsl:text> || true</xsl:text>
212 </xsl:if>
[f98695c]213 <xsl:text>&#xA;</xsl:text>
[28f4756]214 </xsl:otherwise>
215 </xsl:choose>
[a229600]216 </xsl:if>
217 </xsl:otherwise>
218 </xsl:choose>
219 </xsl:when>
[608fbe1]220 <!-- Fixing toolchain test suites run XXX more to fix -->
[269d81c]221 <xsl:when test="contains(string(),'glibc-check-log')">
[877cc6a]222 <xsl:choose>
223 <xsl:when test="$testsuite != '0'">
[269d81c]224 <xsl:value-of select="substring-before(string(),'2&gt;')"/>
[28f4756]225 <xsl:choose>
[401f81e]226 <xsl:when test="$bomb-testsuite = 'n'">
[269d81c]227 <xsl:text>&gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
[28f4756]228 </xsl:when>
229 <xsl:otherwise>
[269d81c]230 <xsl:text>&gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
[a1f1969]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>
[269d81c]240 <xsl:when test="string() = 'make check' or
241 contains(string(), 'make -k check')">
[877cc6a]242 <xsl:choose>
243 <xsl:when test="$testsuite != '0'">
[28f4756]244 <xsl:choose>
[401f81e]245 <xsl:when test="$bomb-testsuite = 'n'">
[269d81c]246 <xsl:text>make -k check &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
[28f4756]247 </xsl:when>
248 <xsl:otherwise>
[269d81c]249 <xsl:apply-templates/>
250 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
[a1f1969]251 <xsl:if test="contains(string(),' -k ')">
252 <xsl:text> || true</xsl:text>
253 </xsl:if>
254 <xsl:text>&#xA;</xsl:text>
[28f4756]255 </xsl:otherwise>
256 </xsl:choose>
[877cc6a]257 </xsl:when>
258 </xsl:choose>
259 </xsl:when>
260 <xsl:when test="contains(string(),'test_summary') or
261 contains(string(),'expect -c')">
262 <xsl:choose>
263 <xsl:when test="$testsuite != '0'">
264 <xsl:apply-templates/>
[28f4756]265 <xsl:text> &gt;&gt; $TEST_LOG&#xA;</xsl:text>
[877cc6a]266 </xsl:when>
267 </xsl:choose>
268 </xsl:when>
269 <!-- Don't stop on strip run -->
270 <xsl:when test="contains(string(),'strip ')">
271 <xsl:apply-templates/>
272 <xsl:text> || true&#xA;</xsl:text>
273 </xsl:when>
[433a5d4]274 <!-- Add -j1 to make install commands -->
275 <xsl:when test="contains(string(),'make ') and
276 contains(string(),'install')">
277 <xsl:value-of select="substring-before(string(),'make ')"/>
278 <xsl:text>make -j1 </xsl:text>
279 <xsl:value-of select="substring-after(string(),'make ')"/>
280 <xsl:text>&#xA;</xsl:text>
281 </xsl:when>
[269d81c]282 <!-- Avoid calling hostname in chroot -->
283 <xsl:when test="ancestor::note[@os='a00']">
284 <xsl:if test="$method='boot'">
285 <xsl:apply-templates/>
286 <xsl:text>&#xA;</xsl:text>
287 </xsl:if>
288 </xsl:when>
[877cc6a]289 <!-- The rest of commands -->
290 <xsl:otherwise>
291 <xsl:apply-templates/>
292 <xsl:text>&#xA;</xsl:text>
293 </xsl:otherwise>
294 </xsl:choose>
295 </xsl:template>
296
297 <xsl:template match="replaceable">
298 <xsl:choose>
299 <xsl:when test="ancestor::sect1[@id='ch-system-glibc']">
300 <xsl:value-of select="$timezone"/>
301 </xsl:when>
[608fbe1]302 <xsl:when test="ancestor::sect1[@id='ch-system-eglibc']">
303 <xsl:value-of select="$timezone"/>
304 </xsl:when>
[877cc6a]305 <xsl:when test="ancestor::sect1[@id='ch-system-groff']">
306 <xsl:value-of select="$page"/>
307 </xsl:when>
[650acce]308 <xsl:when test="ancestor::sect1[@id='ch-cross-tools-flags']">
309 <xsl:choose>
310 <xsl:when test="contains(string(),'BUILD32')">
311 <xsl:choose>
312 <xsl:when test="$sparc = '1' or $sparc = '2'">
313 <xsl:text>-m32 -mcpu=ultrasparc -mtune=ultrasparc</xsl:text>
314 </xsl:when>
315 <xsl:when test="$sparc = '3'">
316 <xsl:text>-m32 -mcpu=ultrasparc3 -mtune=ultrasparc3</xsl:text>
317 </xsl:when>
318 </xsl:choose>
319 </xsl:when>
320 <xsl:when test="contains(string(),'BUILD64')">
321 <xsl:choose>
322 <xsl:when test="$sparc = '1' or $sparc = '2'">
323 <xsl:text>-m64 -mcpu=ultrasparc -mtune=ultrasparc</xsl:text>
324 </xsl:when>
325 <xsl:when test="$sparc = '3'">
326 <xsl:text>-m64 -mcpu=ultrasparc3 -mtune=ultrasparc3</xsl:text>
327 </xsl:when>
328 </xsl:choose>
329 </xsl:when>
330 <xsl:when test="contains(string(),'GCCTARGET')">
331 <xsl:choose>
332 <xsl:when test="$sparc = '1' or $sparc = '2'">
333 <xsl:text>-mcpu=ultrasparc -mtune=ultrasparc</xsl:text>
334 </xsl:when>
335 <xsl:when test="$sparc = '3'">
336 <xsl:text>-mcpu=ultrasparc3 -mtune=ultrasparc3</xsl:text>
337 </xsl:when>
338 </xsl:choose>
339 </xsl:when>
340 </xsl:choose>
341 </xsl:when>
[877cc6a]342 <xsl:otherwise>
343 <xsl:text>**EDITME</xsl:text>
344 <xsl:apply-templates/>
345 <xsl:text>EDITME**</xsl:text>
346 </xsl:otherwise>
347 </xsl:choose>
348 </xsl:template>
349
350</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.