source: HLFS/hlfs.xsl@ 05760bc

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

HLFS: Removed LC_ALL setting.
CLFS3: Removed remaining VIMLANG references.

  • Property mode set to 100644
File size: 14.0 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"/>
[877cc6a]44
45 <xsl:template match="/">
46 <xsl:apply-templates select="//sect1"/>
47 </xsl:template>
48
49 <xsl:template match="sect1">
50 <xsl:if test="(../@id='chapter-temporary-tools' or
51 ../@id='chapter-building-system' or
52 ../@id='chapter-bootable') and
53 ((@condition=$model or not(@condition)) and
54 count(descendant::screen/userinput) &gt; 0 and
55 count(descendant::screen/userinput) &gt;
56 count(descendant::screen[@role='nodump']))">
57 <!-- The dirs names -->
58 <xsl:variable name="pi-dir" select="../processing-instruction('dbhtml')"/>
59 <xsl:variable name="pi-dir-value" select="substring-after($pi-dir,'dir=')"/>
60 <xsl:variable name="quote-dir" select="substring($pi-dir-value,1,1)"/>
61 <xsl:variable name="dirname" select="substring-before(substring($pi-dir-value,2),$quote-dir)"/>
62 <!-- The file names -->
63 <xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/>
64 <xsl:variable name="pi-file-value" select="substring-after($pi-file,'filename=')"/>
65 <xsl:variable name="filename" select="substring-before(substring($pi-file-value,2),'.html')"/>
66 <!-- The build order -->
67 <xsl:variable name="position" select="position()"/>
68 <xsl:variable name="order">
69 <xsl:choose>
70 <xsl:when test="string-length($position) = 1">
71 <xsl:text>00</xsl:text>
72 <xsl:value-of select="$position"/>
73 </xsl:when>
74 <xsl:when test="string-length($position) = 2">
75 <xsl:text>0</xsl:text>
76 <xsl:value-of select="$position"/>
77 </xsl:when>
78 <xsl:otherwise>
79 <xsl:value-of select="$position"/>
80 </xsl:otherwise>
81 </xsl:choose>
82 </xsl:variable>
83 <!-- Creating dirs and files -->
84 <exsl:document href="{$dirname}/{$order}-{$filename}" method="text">
[1330ebc]85 <xsl:choose>
86 <xsl:when test="@id='ch-system-creatingdirs' or
[7d6fe10]87 @id='ch-system-createfiles' or
[1a39790]88 @id='ch-system-changingowner' or
[7d6fe10]89 @id='ch-system-strippingagain'">
[1330ebc]90 <xsl:text>#!/tools/bin/bash&#xA;set +h&#xA;</xsl:text>
91 </xsl:when>
92 <xsl:otherwise>
93 <xsl:text>#!/bin/bash&#xA;set +h&#xA;</xsl:text>
94 </xsl:otherwise>
95 </xsl:choose>
[5f4982d]96 <xsl:if test="not(@id='ch-tools-stripping') and
97 not(@id='ch-system-strippingagain')">
98 <xsl:text>set -e&#xA;</xsl:text>
99 </xsl:if>
100 <xsl:text>&#xA;</xsl:text>
[a9d3a9a]101 <xsl:if test="(sect2[@role='installation'])">
[877cc6a]102 <xsl:text>cd $PKGDIR&#xA;</xsl:text>
[5e83595]103 <xsl:if test="@id='ch-system-uclibc'">
[877cc6a]104 <xsl:text>pushd ../; tar -xvf gettext-&gettext-version;.*; popd; &#xA;</xsl:text>
105 </xsl:if>
[d81c640]106
[4d15d7f]107 <!-- SVN toolchain format, from inside ./sources dir unpack binutils and gcc -->
[d81c640]108 <xsl:if test="@id='ch-tools-embryo-toolchain' or
109 @id='ch-tools-cocoon-toolchain' or
110 @id='ch-system-butterfly-toolchain'">
111 <xsl:text>tar -xvf gcc-core-&gcc-version;.*; &#xA;</xsl:text>
112 <xsl:text>tar -xvf binutils-&binutils-version;.*; &#xA;</xsl:text>
[877cc6a]113 </xsl:if>
[30d1215]114 <xsl:if test="@id='ch-tools-cocoon-toolchain' or
115 @id='ch-system-butterfly-toolchain'">
116 <xsl:text>tar -xvf gcc-g++-&gcc-version;.*; &#xA;</xsl:text>
117 </xsl:if>
[d81c640]118 <!-- ONLY butterfly has a testsuite -->
[b2489fb]119 <xsl:if test="@id='ch-system-butterfly-toolchain' and $testsuite != '0'">
[d81c640]120 <xsl:text>tar -xvf gcc-testsuite-&gcc-version;.*; &#xA;</xsl:text>
[877cc6a]121 </xsl:if>
[4d15d7f]122 <!-- END SVN toolchain format -->
123
124 <!-- 2.4-branch toolchain -->
125 <xsl:if test="@id='ch-tools-gcc-pass2' or @id='ch-system-gcc'">
126 <xsl:text>pushd ../; tar -xvf gcc-g++-&gcc-version;.*; popd; &#xA;</xsl:text>
127 </xsl:if>
128 <xsl:if test="@id='ch-system-gcc' and $testsuite != '0'">
129 <xsl:text>pushd ../; tar -xvf gcc-testsuite-&gcc-version;.*; popd; &#xA;</xsl:text>
130 </xsl:if>
131 <!-- END 2.4-branch toolchain -->
[d81c640]132
[a9d3a9a]133<!-- temporary
[877cc6a]134 <xsl:if test="@id='bootable-bootscripts'">
135 <xsl:text>pushd ../; tar -xvf blfs-bootscripts-&blfs-bootscripts-version;.* ; popd; &#xA;</xsl:text>
136 </xsl:if>
[a9d3a9a]137-->
[877cc6a]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>
[05760bc]199 <!-- Setting $LANG for /etc/profile -->
[877cc6a]200 <xsl:when test="ancestor::sect1[@id='bootable-profile'] and
201 contains(string(),'export LANG=')">
[05760bc]202 <xsl:value-of select="substring-before(string(),'export LANG=')"/>
203 <xsl:text>export LANG=</xsl:text>
[877cc6a]204 <xsl:value-of select="$lang"/>
[05760bc]205 <xsl:value-of select="substring-after(string(),'CC]')"/>
[877cc6a]206 <xsl:text>&#xA;</xsl:text>
207 </xsl:when>
208 <!-- Fixing bootscripts installation -->
[a9d3a9a]209
210<!-- temporary
[877cc6a]211 <xsl:when test="ancestor::sect1[@id='bootable-bootscripts'] and
212 string() = 'make install'">
213 <xsl:text>make install&#xA;</xsl:text>
214 <xsl:text>cd ../blfs-bootscripts-&blfs-bootscripts-version;&#xA;</xsl:text>
215 </xsl:when>
[a9d3a9a]216-->
[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>
[39f5f3e]301 <!-- Fixing Butterfly sanity checks -->
302 <xsl:when test="contains(string(),'./fortify-test')
303 or contains(string(),'./ssp-test')">
[b6f6212]304 <xsl:text>! </xsl:text>
[39f5f3e]305 <xsl:apply-templates/>
306 <xsl:text>&#xA;</xsl:text>
307 </xsl:when>
[ff43bb8]308 <!-- Don't stop on strip run -->
[85077e7]309 <xsl:when test="contains(string(),'strip ')">
[877cc6a]310 <xsl:apply-templates/>
311 <xsl:text> || true&#xA;</xsl:text>
312 </xsl:when>
313 <!-- The rest of commands -->
314 <xsl:otherwise>
315 <xsl:apply-templates/>
316 <xsl:text>&#xA;</xsl:text>
317 </xsl:otherwise>
318 </xsl:choose>
319 </xsl:template>
320
[d81c640]321 <xsl:template match="literal">
322 <xsl:if test="@condition=$model or not(@condition)">
323 <xsl:apply-templates/>
324 </xsl:if>
325 </xsl:template>
326
[877cc6a]327 <xsl:template match="replaceable">
328 <xsl:choose>
329 <xsl:when test="ancestor::sect1[@id='ch-system-glibc'] or
330 ancestor::sect1[@id='ch-system-uclibc']">
331 <xsl:value-of select="$timezone"/>
332 </xsl:when>
333 <xsl:when test="ancestor::sect1[@id='ch-system-groff']">
334 <xsl:value-of select="$page"/>
335 </xsl:when>
336 <xsl:otherwise>
337 <xsl:text>**EDITME</xsl:text>
338 <xsl:apply-templates/>
339 <xsl:text>EDITME**</xsl:text>
340 </xsl:otherwise>
341 </xsl:choose>
342 </xsl:template>
343
344</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.