source: HLFS/hlfs.xsl@ 6af630c

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

Setting +h in the build scripts to be sure that hashing is actually dissabled.

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