source: HLFS/hlfs.xsl@ 5c575e1

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

HLFS: Added support to select the kernel series based book.

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