source: HLFS/hlfs.xsl@ 7e5ea15

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

There is no Groff debian fixes patch in HLFS or CLFS.

  • Property mode set to 100644
File size: 12.7 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">
[5f4982d]86 <xsl:text>#!/bin/bash&#xA;set +h&#xA;</xsl:text>
87 <xsl:if test="not(@id='ch-tools-stripping') and
88 not(@id='ch-system-strippingagain')">
89 <xsl:text>set -e&#xA;</xsl:text>
90 </xsl:if>
91 <xsl:text>&#xA;</xsl:text>
[877cc6a]92 <xsl:if test="(sect2[@role='installation'] and
[d81c640]93 not(@id='bootable-kernel'))">
[877cc6a]94 <xsl:text>cd $PKGDIR&#xA;</xsl:text>
[5e83595]95 <xsl:if test="@id='ch-system-uclibc'">
[877cc6a]96 <xsl:text>pushd ../; tar -xvf gettext-&gettext-version;.*; popd; &#xA;</xsl:text>
97 </xsl:if>
[d81c640]98
99 <!-- NEW toolchain format, from inside ./sources dir unpack binutils and gcc -->
100 <xsl:if test="@id='ch-tools-embryo-toolchain' or
101 @id='ch-tools-cocoon-toolchain' or
102 @id='ch-system-butterfly-toolchain'">
103 <xsl:text>tar -xvf gcc-core-&gcc-version;.*; &#xA;</xsl:text>
104 <xsl:text>tar -xvf binutils-&binutils-version;.*; &#xA;</xsl:text>
[877cc6a]105 </xsl:if>
[30d1215]106 <xsl:if test="@id='ch-tools-cocoon-toolchain' or
107 @id='ch-system-butterfly-toolchain'">
108 <xsl:text>tar -xvf gcc-g++-&gcc-version;.*; &#xA;</xsl:text>
109 </xsl:if>
[d81c640]110 <!-- ONLY butterfly has a testsuite -->
[b2489fb]111 <xsl:if test="@id='ch-system-butterfly-toolchain' and $testsuite != '0'">
[d81c640]112 <xsl:text>tar -xvf gcc-testsuite-&gcc-version;.*; &#xA;</xsl:text>
[877cc6a]113 </xsl:if>
[d81c640]114 <!-- END new toolchain format -->
115
[877cc6a]116 <xsl:if test="@id='bootable-bootscripts'">
117 <xsl:text>pushd ../; tar -xvf blfs-bootscripts-&blfs-bootscripts-version;.* ; popd; &#xA;</xsl:text>
118 </xsl:if>
119 </xsl:if>
120 <xsl:apply-templates select=".//para/userinput | .//screen"/>
121 <xsl:text>exit</xsl:text>
122 </exsl:document>
123 </xsl:if>
124 </xsl:template>
125
126 <xsl:template match="screen">
127 <xsl:if test="(@condition=$model or not(@condition)) and
128 child::* = userinput and not(@role = 'nodump')">
129 <xsl:apply-templates select="userinput" mode="screen"/>
130 </xsl:if>
131 </xsl:template>
132
133 <xsl:template match="para/userinput">
134 <xsl:if test="(contains(string(),'test') or
[d81c640]135 contains(string(),'check')) and
136 ($testsuite = '2' or $testsuite = '3')">
[28f4756]137 <xsl:choose>
[401f81e]138 <xsl:when test="$bomb-testsuite = 'n'">
[28f4756]139 <xsl:value-of select="substring-before(string(),'make')"/>
140 <xsl:text>make -k</xsl:text>
141 <xsl:value-of select="substring-after(string(),'make')"/>
142 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
143 </xsl:when>
144 <xsl:otherwise>
145 <xsl:apply-templates/>
[a1f1969]146 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
147 <xsl:if test="contains(string(),' -k ')">
148 <xsl:text> || true</xsl:text>
149 </xsl:if>
150 <xsl:text>&#xA;</xsl:text>
[28f4756]151 </xsl:otherwise>
152 </xsl:choose>
[877cc6a]153 </xsl:if>
154 </xsl:template>
155
156 <xsl:template match="userinput" mode="screen">
157 <xsl:choose>
158 <!-- Estandarized package formats -->
159 <xsl:when test="contains(string(),'tar.gz')">
160 <xsl:value-of select="substring-before(string(),'tar.gz')"/>
161 <xsl:text>tar.*</xsl:text>
162 <xsl:value-of select="substring-after(string(),'tar.gz')"/>
163 <xsl:text>&#xA;</xsl:text>
164 </xsl:when>
165 <!-- grsecurity kernel in the host? -->
166 <xsl:when test="ancestor::sect1[@id='ch-system-kernfs'] and
167 contains(string(),'sysctl')
[401f81e]168 and $grsecurity_host ='n'"/>
[877cc6a]169 <!-- Setting $LC_ALL and $LANG for /etc/profile -->
170 <xsl:when test="ancestor::sect1[@id='bootable-profile'] and
171 contains(string(),'export LANG=')">
172 <xsl:value-of select="substring-before(string(),'export LC_ALL=')"/>
173 <xsl:text>export LC_ALL=</xsl:text>
174 <xsl:value-of select="$lc_all"/>
175 <xsl:text>&#xA;export LANG=</xsl:text>
176 <xsl:value-of select="$lang"/>
177 <xsl:text>&#xA;export INPUTRC</xsl:text>
178 <xsl:value-of select="substring-after(string(),'INPUTRC')"/>
179 <xsl:text>&#xA;</xsl:text>
180 </xsl:when>
181 <!-- Fixing bootscripts installation -->
182 <xsl:when test="ancestor::sect1[@id='bootable-bootscripts'] and
183 string() = 'make install'">
184 <xsl:text>make install&#xA;</xsl:text>
185 <xsl:text>cd ../blfs-bootscripts-&blfs-bootscripts-version;&#xA;</xsl:text>
186 </xsl:when>
[f4caf9c]187 <!-- Compile the keymap into the kernel has been dissabled -->
188 <xsl:when test="contains(string(),'defkeymap')"/>
[877cc6a]189 <!-- Copying the kernel config file -->
190 <xsl:when test="string() = 'make mrproper'">
191 <xsl:text>make mrproper&#xA;</xsl:text>
192 <xsl:text>cp -v /sources/kernel-config .config&#xA;</xsl:text>
193 </xsl:when>
194 <!-- No interactive commands are needed if the .config file is the proper one -->
195 <xsl:when test="string() = 'make menuconfig'"/>
196 <!-- For uClibc we need to cd to the Gettext package -->
197 <xsl:when test="contains(string(),'cd gettext-runtime/')">
198 <xsl:text>cd ../gettext-*/gettext-runtime</xsl:text>
199 <xsl:value-of select="substring-after(string(),'gettext-runtime')"/>
200 <xsl:text>&#xA;</xsl:text>
201 </xsl:when>
202 <!-- The Coreutils and Module-Init-Tools test suites are optional -->
[a229600]203 <xsl:when test="(ancestor::sect1[@id='ch-system-coreutils'] or
[877cc6a]204 ancestor::sect1[@id='ch-system-module-init-tools']) and
205 (contains(string(),'check') or
206 contains(string(),'distclean') or
[a229600]207 contains(string(),'dummy'))">
208 <xsl:choose>
209 <xsl:when test="$testsuite = '0' or $testsuite = '1'"/>
210 <xsl:otherwise>
[28f4756]211 <xsl:if test="not(contains(string(),'check'))">
212 <xsl:apply-templates/>
213 <xsl:text>&#xA;</xsl:text>
214 </xsl:if>
[a229600]215 <xsl:if test="contains(string(),'check')">
[28f4756]216 <xsl:choose>
[401f81e]217 <xsl:when test="$bomb-testsuite = 'n'">
[28f4756]218 <xsl:value-of select="substring-before(string(),'check')"/>
219 <xsl:text>-k check</xsl:text>
220 <xsl:value-of select="substring-after(string(),'check')"/>
221 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
222 </xsl:when>
223 <xsl:otherwise>
224 <xsl:apply-templates/>
[a1f1969]225 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
226 <xsl:if test="contains(string(),' -k ')">
227 <xsl:text> || true</xsl:text>
228 </xsl:if>
229 <xsl:text>&#xA;</xsl:text>
[28f4756]230 </xsl:otherwise>
231 </xsl:choose>
[a229600]232 </xsl:if>
233 </xsl:otherwise>
234 </xsl:choose>
235 </xsl:when>
[d81c640]236 <!-- Fixing butterfly toolchain test suites run -->
[a1f1969]237 <xsl:when test="string() = 'make -k check' or string() = 'make check'">
[877cc6a]238 <xsl:choose>
[d81c640]239 <xsl:when test="$testsuite != '0'">
[28f4756]240 <xsl:apply-templates/>
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>
[f98695c]246 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
[a1f1969]247 <xsl:if test="contains(string(),' -k ')">
248 <xsl:text> || true</xsl:text>
249 </xsl:if>
[f98695c]250 <xsl:text>&#xA;</xsl:text>
[28f4756]251 </xsl:otherwise>
252 </xsl:choose>
[877cc6a]253 </xsl:when>
254 </xsl:choose>
255 </xsl:when>
[d81c640]256 <!-- Fixing Glbc test suite -->
257 <xsl:when test="contains(string(),'glibc-check-log')">
[877cc6a]258 <xsl:choose>
259 <xsl:when test="$testsuite != '0'">
[d81c640]260 <xsl:value-of select="substring-before(string(),'&gt; glibc-')"/>
[28f4756]261 <xsl:choose>
[401f81e]262 <xsl:when test="$bomb-testsuite = 'n'">
[28f4756]263 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1 || true&#xA;</xsl:text>
264 </xsl:when>
265 <xsl:otherwise>
[a1f1969]266 <xsl:text> &gt;&gt; $TEST_LOG 2&gt;&amp;1</xsl:text>
267 <xsl:if test="contains(string(),' -k ')">
268 <xsl:text> || true</xsl:text>
269 </xsl:if>
270 <xsl:text>&#xA;</xsl:text>
[28f4756]271 </xsl:otherwise>
272 </xsl:choose>
[877cc6a]273 </xsl:when>
274 </xsl:choose>
275 </xsl:when>
276 <!-- Don't stop on strip run and chapter05 GCC installation test-->
277 <xsl:when test="contains(string(),'strip ') or
278 ancestor::sect2[@id='testing-gcc'] and
279 not(contains(string(),'EOF'))">
280 <xsl:apply-templates/>
281 <xsl:text> || true&#xA;</xsl:text>
282 </xsl:when>
283 <!-- The rest of commands -->
284 <xsl:otherwise>
285 <xsl:apply-templates/>
286 <xsl:text>&#xA;</xsl:text>
287 </xsl:otherwise>
288 </xsl:choose>
289 </xsl:template>
290
[d81c640]291 <xsl:template match="literal">
292 <xsl:if test="@condition=$model or not(@condition)">
293 <xsl:apply-templates/>
294 </xsl:if>
295 </xsl:template>
296
[877cc6a]297 <xsl:template match="replaceable">
298 <xsl:choose>
299 <xsl:when test="ancestor::sect1[@id='ch-system-glibc'] or
300 ancestor::sect1[@id='ch-system-uclibc']">
301 <xsl:value-of select="$timezone"/>
302 </xsl:when>
303 <xsl:when test="ancestor::sect1[@id='ch-system-groff']">
304 <xsl:value-of select="$page"/>
305 </xsl:when>
306 <xsl:otherwise>
307 <xsl:text>**EDITME</xsl:text>
308 <xsl:apply-templates/>
309 <xsl:text>EDITME**</xsl:text>
310 </xsl:otherwise>
311 </xsl:choose>
312 </xsl:template>
313
314</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.