source: HLFS/hlfs.xsl@ 26dbe1a

2.3 2.3.x 2.4 ablfs ablfs-more legacy new_features trunk
Last change on this file since 26dbe1a was 26dbe1a, checked in by George Boudreau <georgeb@…>, 18 years ago

Successful bug hunt in HLFS

  • Property mode set to 100644
File size: 13.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 HLFS books. -->
15
16 <!-- What libc implentation must be used? -->
17 <xsl:param name="model" select="glibc"/>
18
19 <!-- Is the host kernel using grsecurity? -->
[401f81e]20 <xsl:param name="grsecurity_host" select="n"/>
[877cc6a]21
22 <!-- Run test suites?
23 0 = none
24 1 = only chapter06 Glibc, GCC and Binutils testsuites
25 2 = all chapter06 testsuites
[28f4756]26 3 = alias to 2
27 -->
[877cc6a]28 <xsl:param name="testsuite" select="1"/>
29
[28f4756]30 <!-- Bomb on test suites failures?
[401f81e]31 n = no, I want to build the full system and review the logs
32 y = yes, bomb at the first test suite failure to can review the build dir
[28f4756]33 -->
[401f81e]34 <xsl:param name="bomb-testsuite" select="n"/>
[28f4756]35
[877cc6a]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"/>
44 <xsl:param name="lc_all" select="C"/>
[877cc6a]45
46 <xsl:template match="/">
47 <xsl:apply-templates select="//sect1"/>
48 </xsl:template>
49
50 <xsl:template match="sect1">
51 <xsl:if test="(../@id='chapter-temporary-tools' or
52 ../@id='chapter-building-system' or
53 ../@id='chapter-bootable') and
54 ((@condition=$model or not(@condition)) and
55 count(descendant::screen/userinput) &gt; 0 and
56 count(descendant::screen/userinput) &gt;
57 count(descendant::screen[@role='nodump']))">
58 <!-- The dirs names -->
59 <xsl:variable name="pi-dir" select="../processing-instruction('dbhtml')"/>
60 <xsl:variable name="pi-dir-value" select="substring-after($pi-dir,'dir=')"/>
61 <xsl:variable name="quote-dir" select="substring($pi-dir-value,1,1)"/>
62 <xsl:variable name="dirname" select="substring-before(substring($pi-dir-value,2),$quote-dir)"/>
63 <!-- The file names -->
64 <xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/>
65 <xsl:variable name="pi-file-value" select="substring-after($pi-file,'filename=')"/>
66 <xsl:variable name="filename" select="substring-before(substring($pi-file-value,2),'.html')"/>
67 <!-- The build order -->
68 <xsl:variable name="position" select="position()"/>
69 <xsl:variable name="order">
70 <xsl:choose>
71 <xsl:when test="string-length($position) = 1">
72 <xsl:text>00</xsl:text>
73 <xsl:value-of select="$position"/>
74 </xsl:when>
75 <xsl:when test="string-length($position) = 2">
76 <xsl:text>0</xsl:text>
77 <xsl:value-of select="$position"/>
78 </xsl:when>
79 <xsl:otherwise>
80 <xsl:value-of select="$position"/>
81 </xsl:otherwise>
82 </xsl:choose>
83 </xsl:variable>
84 <!-- Creating dirs and files -->
85 <exsl:document href="{$dirname}/{$order}-{$filename}" method="text">
[1330ebc]86 <xsl:choose>
87 <xsl:when test="@id='ch-system-creatingdirs' or
[7d6fe10]88 @id='ch-system-createfiles' or
[26dbe1a]89 @id='ch-changingowner' or
[7d6fe10]90 @id='ch-system-strippingagain'">
[1330ebc]91 <xsl:text>#!/tools/bin/bash&#xA;set +h&#xA;</xsl:text>
92 </xsl:when>
93 <xsl:otherwise>
94 <xsl:text>#!/bin/bash&#xA;set +h&#xA;</xsl:text>
95 </xsl:otherwise>
96 </xsl:choose>
[5f4982d]97 <xsl:if test="not(@id='ch-tools-stripping') and
98 not(@id='ch-system-strippingagain')">
99 <xsl:text>set -e&#xA;</xsl:text>
100 </xsl:if>
101 <xsl:text>&#xA;</xsl:text>
[877cc6a]102 <xsl:if test="(sect2[@role='installation'] and
[d81c640]103 not(@id='bootable-kernel'))">
[877cc6a]104 <xsl:text>cd $PKGDIR&#xA;</xsl:text>
[5e83595]105 <xsl:if test="@id='ch-system-uclibc'">
[877cc6a]106 <xsl:text>pushd ../; tar -xvf gettext-&gettext-version;.*; popd; &#xA;</xsl:text>
107 </xsl:if>
[d81c640]108
[4d15d7f]109 <!-- SVN toolchain format, from inside ./sources dir unpack binutils and gcc -->
[d81c640]110 <xsl:if test="@id='ch-tools-embryo-toolchain' or
111 @id='ch-tools-cocoon-toolchain' or
112 @id='ch-system-butterfly-toolchain'">
113 <xsl:text>tar -xvf gcc-core-&gcc-version;.*; &#xA;</xsl:text>
114 <xsl:text>tar -xvf binutils-&binutils-version;.*; &#xA;</xsl:text>
[877cc6a]115 </xsl:if>
[30d1215]116 <xsl:if test="@id='ch-tools-cocoon-toolchain' or
117 @id='ch-system-butterfly-toolchain'">
118 <xsl:text>tar -xvf gcc-g++-&gcc-version;.*; &#xA;</xsl:text>
119 </xsl:if>
[d81c640]120 <!-- ONLY butterfly has a testsuite -->
[b2489fb]121 <xsl:if test="@id='ch-system-butterfly-toolchain' and $testsuite != '0'">
[d81c640]122 <xsl:text>tar -xvf gcc-testsuite-&gcc-version;.*; &#xA;</xsl:text>
[877cc6a]123 </xsl:if>
[4d15d7f]124 <!-- END SVN toolchain format -->
125
126 <!-- 2.4-branch toolchain -->
127 <xsl:if test="@id='ch-tools-gcc-pass2' or @id='ch-system-gcc'">
128 <xsl:text>pushd ../; tar -xvf gcc-g++-&gcc-version;.*; popd; &#xA;</xsl:text>
129 </xsl:if>
130 <xsl:if test="@id='ch-system-gcc' and $testsuite != '0'">
131 <xsl:text>pushd ../; tar -xvf gcc-testsuite-&gcc-version;.*; popd; &#xA;</xsl:text>
132 </xsl:if>
133 <!-- END 2.4-branch toolchain -->
[d81c640]134
[877cc6a]135 <xsl:if test="@id='bootable-bootscripts'">
136 <xsl:text>pushd ../; tar -xvf blfs-bootscripts-&blfs-bootscripts-version;.* ; popd; &#xA;</xsl:text>
137 </xsl:if>
138 </xsl:if>
139 <xsl:apply-templates select=".//para/userinput | .//screen"/>
140 <xsl:text>exit</xsl:text>
141 </exsl:document>
142 </xsl:if>
143 </xsl:template>
144
145 <xsl:template match="screen">
146 <xsl:if test="(@condition=$model or not(@condition)) and
147 child::* = userinput and not(@role = 'nodump')">
148 <xsl:apply-templates select="userinput" mode="screen"/>
149 </xsl:if>
150 </xsl:template>
151
152 <xsl:template match="para/userinput">
153 <xsl:if test="(contains(string(),'test') or
[d81c640]154 contains(string(),'check')) and
155 ($testsuite = '2' or $testsuite = '3')">
[28f4756]156 <xsl:choose>
[401f81e]157 <xsl:when test="$bomb-testsuite = 'n'">
[28f4756]158 <xsl:value-of select="substring-before(string(),'make')"/>
159 <xsl:text>make -k</xsl:text>
160 <xsl:value-of select="substring-after(string(),'make')"/>
161 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
162 </xsl:when>
163 <xsl:otherwise>
164 <xsl:apply-templates/>
[a1f1969]165 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
166 <xsl:if test="contains(string(),' -k ')">
167 <xsl:text> || true</xsl:text>
168 </xsl:if>
169 <xsl:text>&#xA;</xsl:text>
[28f4756]170 </xsl:otherwise>
171 </xsl:choose>
[877cc6a]172 </xsl:if>
173 </xsl:template>
174
175 <xsl:template match="userinput" mode="screen">
176 <xsl:choose>
177 <!-- Estandarized package formats -->
178 <xsl:when test="contains(string(),'tar.gz')">
179 <xsl:value-of select="substring-before(string(),'tar.gz')"/>
180 <xsl:text>tar.*</xsl:text>
181 <xsl:value-of select="substring-after(string(),'tar.gz')"/>
182 <xsl:text>&#xA;</xsl:text>
183 </xsl:when>
184 <!-- grsecurity kernel in the host? -->
185 <xsl:when test="ancestor::sect1[@id='ch-system-kernfs'] and
186 contains(string(),'sysctl')
[401f81e]187 and $grsecurity_host ='n'"/>
[37002ae]188 <!-- We need to have /dev/console and /dev/null availables before
189 entering to the chroot -->
190 <xsl:when test="ancestor::sect1[@id='ch-system-devices'] and
191 contains(string(),'600 /dev/console')"/>
[4d15d7f]192 <!-- Fix MAKEDEV installation in 2.4-branch -->
193 <xsl:when test="ancestor::sect1[@id='ch-system-devices'] and
194 contains(string(),'bzcat MAKEDEV')">
195 <xsl:text>bzcat /sources/</xsl:text>
196 <xsl:value-of select="substring-after(string(),'bzcat ')"/>
197 <xsl:text>&#xA;</xsl:text>
198 </xsl:when>
[877cc6a]199 <!-- Setting $LC_ALL and $LANG for /etc/profile -->
200 <xsl:when test="ancestor::sect1[@id='bootable-profile'] and
201 contains(string(),'export LANG=')">
202 <xsl:value-of select="substring-before(string(),'export LC_ALL=')"/>
203 <xsl:text>export LC_ALL=</xsl:text>
204 <xsl:value-of select="$lc_all"/>
205 <xsl:text>&#xA;export LANG=</xsl:text>
206 <xsl:value-of select="$lang"/>
207 <xsl:text>&#xA;export INPUTRC</xsl:text>
208 <xsl:value-of select="substring-after(string(),'INPUTRC')"/>
209 <xsl:text>&#xA;</xsl:text>
210 </xsl:when>
211 <!-- Fixing bootscripts installation -->
212 <xsl:when test="ancestor::sect1[@id='bootable-bootscripts'] and
213 string() = 'make install'">
214 <xsl:text>make install&#xA;</xsl:text>
215 <xsl:text>cd ../blfs-bootscripts-&blfs-bootscripts-version;&#xA;</xsl:text>
216 </xsl:when>
[f4caf9c]217 <!-- Compile the keymap into the kernel has been dissabled -->
218 <xsl:when test="contains(string(),'defkeymap')"/>
[877cc6a]219 <!-- Copying the kernel config file -->
220 <xsl:when test="string() = 'make mrproper'">
221 <xsl:text>make mrproper&#xA;</xsl:text>
222 <xsl:text>cp -v /sources/kernel-config .config&#xA;</xsl:text>
223 </xsl:when>
224 <!-- No interactive commands are needed if the .config file is the proper one -->
225 <xsl:when test="string() = 'make menuconfig'"/>
226 <!-- For uClibc we need to cd to the Gettext package -->
227 <xsl:when test="contains(string(),'cd gettext-runtime/')">
228 <xsl:text>cd ../gettext-*/gettext-runtime</xsl:text>
229 <xsl:value-of select="substring-after(string(),'gettext-runtime')"/>
230 <xsl:text>&#xA;</xsl:text>
231 </xsl:when>
232 <!-- The Coreutils and Module-Init-Tools test suites are optional -->
[a229600]233 <xsl:when test="(ancestor::sect1[@id='ch-system-coreutils'] or
[877cc6a]234 ancestor::sect1[@id='ch-system-module-init-tools']) and
235 (contains(string(),'check') or
236 contains(string(),'distclean') or
[a229600]237 contains(string(),'dummy'))">
238 <xsl:choose>
239 <xsl:when test="$testsuite = '0' or $testsuite = '1'"/>
240 <xsl:otherwise>
[28f4756]241 <xsl:if test="not(contains(string(),'check'))">
242 <xsl:apply-templates/>
243 <xsl:text>&#xA;</xsl:text>
244 </xsl:if>
[a229600]245 <xsl:if test="contains(string(),'check')">
[28f4756]246 <xsl:choose>
[401f81e]247 <xsl:when test="$bomb-testsuite = 'n'">
[28f4756]248 <xsl:value-of select="substring-before(string(),'check')"/>
249 <xsl:text>-k check</xsl:text>
250 <xsl:value-of select="substring-after(string(),'check')"/>
251 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
252 </xsl:when>
253 <xsl:otherwise>
254 <xsl:apply-templates/>
[a1f1969]255 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
256 <xsl:if test="contains(string(),' -k ')">
257 <xsl:text> || true</xsl:text>
258 </xsl:if>
259 <xsl:text>&#xA;</xsl:text>
[28f4756]260 </xsl:otherwise>
261 </xsl:choose>
[a229600]262 </xsl:if>
263 </xsl:otherwise>
264 </xsl:choose>
265 </xsl:when>
[4d15d7f]266 <!-- Fixing butterfly and 2.4-branch toolchain plus other packages test suites run -->
[ff43bb8]267 <xsl:when test="string() = 'make -k check'
268 or string() = 'make check'
269 or string() = 'make tests'">
[877cc6a]270 <xsl:choose>
[4d15d7f]271 <xsl:when test="((ancestor::sect1[@id='ch-system-butterfly-toolchain']
272 or ancestor::sect1[@id='ch-system-gcc'] or
273 ancestor::sect1[@id='ch-system-binutils'])
[ff43bb8]274 and $testsuite != '0') or
275 $testsuite = '2' or $testsuite = '3'">
[28f4756]276 <xsl:choose>
[401f81e]277 <xsl:when test="$bomb-testsuite = 'n'">
[ff43bb8]278 <xsl:text>make -k check &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
[28f4756]279 </xsl:when>
280 <xsl:otherwise>
[ff43bb8]281 <xsl:apply-templates/>
[f98695c]282 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
[a1f1969]283 <xsl:if test="contains(string(),' -k ')">
284 <xsl:text> || true</xsl:text>
285 </xsl:if>
[f98695c]286 <xsl:text>&#xA;</xsl:text>
[28f4756]287 </xsl:otherwise>
288 </xsl:choose>
[877cc6a]289 </xsl:when>
290 </xsl:choose>
291 </xsl:when>
[d81c640]292 <!-- Fixing Glbc test suite -->
293 <xsl:when test="contains(string(),'glibc-check-log')">
[877cc6a]294 <xsl:choose>
295 <xsl:when test="$testsuite != '0'">
[ff43bb8]296 <xsl:value-of select="substring-before(string(),'2&gt;&amp;1')"/>
297 <xsl:text>&gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
[877cc6a]298 </xsl:when>
299 </xsl:choose>
300 </xsl:when>
[ff43bb8]301 <!-- Don't stop on strip run -->
[85077e7]302 <xsl:when test="contains(string(),'strip ')">
[877cc6a]303 <xsl:apply-templates/>
304 <xsl:text> || true&#xA;</xsl:text>
305 </xsl:when>
306 <!-- The rest of commands -->
307 <xsl:otherwise>
308 <xsl:apply-templates/>
309 <xsl:text>&#xA;</xsl:text>
310 </xsl:otherwise>
311 </xsl:choose>
312 </xsl:template>
313
[d81c640]314 <xsl:template match="literal">
315 <xsl:if test="@condition=$model or not(@condition)">
316 <xsl:apply-templates/>
317 </xsl:if>
318 </xsl:template>
319
[877cc6a]320 <xsl:template match="replaceable">
321 <xsl:choose>
322 <xsl:when test="ancestor::sect1[@id='ch-system-glibc'] or
323 ancestor::sect1[@id='ch-system-uclibc']">
324 <xsl:value-of select="$timezone"/>
325 </xsl:when>
326 <xsl:when test="ancestor::sect1[@id='ch-system-groff']">
327 <xsl:value-of select="$page"/>
328 </xsl:when>
329 <xsl:otherwise>
330 <xsl:text>**EDITME</xsl:text>
331 <xsl:apply-templates/>
332 <xsl:text>EDITME**</xsl:text>
333 </xsl:otherwise>
334 </xsl:choose>
335 </xsl:template>
336
337</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.