source: HLFS/hlfs.xsl@ 0ebdc33

experimental
Last change on this file since 0ebdc33 was 0ebdc33, checked in by Manuel Canales Esparcia <manuel@…>, 19 years ago

There is no Vim-lang package in HLFS.
Removed also unexistant entities expect-lib, linux-dl, groff-patchlevel, and udev-config from the HLFS packages download code.

  • Property mode set to 100644
File size: 9.1 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 <!-- Run test suites?
20 0 = none
21 1 = only chapter06 Glibc, GCC and Binutils testsuites
22 2 = all chapter06 testsuites
23 3 = all chapter05 and chapter06 testsuites-->
24 <xsl:param name="testsuite" select="1"/>
25
26 <xsl:template match="/">
27 <xsl:apply-templates select="//sect1"/>
28 </xsl:template>
29
30 <xsl:template match="sect1">
31 <xsl:if test="(../@id='chapter-temporary-tools' or
32 ../@id='chapter-building-system' or
33 ../@id='chapter-bootable') and
34 ((@condition=$model or not(@condition)) and
35 count(descendant::screen/userinput) &gt; 0 and
36 count(descendant::screen/userinput) &gt;
37 count(descendant::screen[@role='nodump']))">
38 <!-- The dirs names -->
39 <xsl:variable name="pi-dir" select="../processing-instruction('dbhtml')"/>
40 <xsl:variable name="pi-dir-value" select="substring-after($pi-dir,'dir=')"/>
41 <xsl:variable name="quote-dir" select="substring($pi-dir-value,1,1)"/>
42 <xsl:variable name="dirname" select="substring-before(substring($pi-dir-value,2),$quote-dir)"/>
43 <!-- The file names -->
44 <xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/>
45 <xsl:variable name="pi-file-value" select="substring-after($pi-file,'filename=')"/>
46 <xsl:variable name="filename" select="substring-before(substring($pi-file-value,2),'.html')"/>
47 <!-- The build order -->
48 <xsl:variable name="position" select="position()"/>
49 <xsl:variable name="order">
50 <xsl:choose>
51 <xsl:when test="string-length($position) = 1">
52 <xsl:text>00</xsl:text>
53 <xsl:value-of select="$position"/>
54 </xsl:when>
55 <xsl:when test="string-length($position) = 2">
56 <xsl:text>0</xsl:text>
57 <xsl:value-of select="$position"/>
58 </xsl:when>
59 <xsl:otherwise>
60 <xsl:value-of select="$position"/>
61 </xsl:otherwise>
62 </xsl:choose>
63 </xsl:variable>
64 <!-- Creating dirs and files -->
65 <exsl:document href="{$dirname}/{$order}-{$filename}" method="text">
66 <xsl:choose>
67 <xsl:when test="@id='ch-system-changingowner' or
68 @id='ch-system-creatingdirs' or
69 @id='ch-system-createfiles'">
70 <xsl:text>#!/tools/bin/bash&#xA;set -e&#xA;&#xA;</xsl:text>
71 </xsl:when>
72 <xsl:when test="@id='ch-tools-stripping' or
73 @id='ch-system-strippingagain'">
74 <xsl:text>#!/bin/sh&#xA;</xsl:text>
75 </xsl:when>
76 <xsl:otherwise>
77 <xsl:text>#!/bin/sh&#xA;set -e&#xA;&#xA;</xsl:text>
78 </xsl:otherwise>
79 </xsl:choose>
80 <xsl:if test="sect2[@role='installation'] or
81 @id='ch-tools-adjusting' or
82 @id='ch-system-readjusting'">
83 <xsl:text>cd $PKGDIR&#xA;</xsl:text>
84 <xsl:if test="@id='ch-tools-uclibc' or @id='ch-system-uclibc'">
85 <xsl:text>pushd ../; tar -xvf gettext-&gettext-version;.*; popd; &#xA;</xsl:text>
86 </xsl:if>
87 <xsl:if test="@id='ch-tools-glibc' or @id='ch-system-glibc'">
88 <xsl:text>tar -xvf ../glibc-libidn-&glibc-version;.*&#xA;</xsl:text>
89 </xsl:if>
90 <xsl:if test="@id='ch-tools-gcc' or @id='ch-system-gcc'">
91 <xsl:text>pushd ../; tar -xvf gcc-g++-&gcc-version;.*; popd; &#xA;</xsl:text>
92 </xsl:if>
93 <xsl:if test="@id='ch-tools-gcc' and $testsuite = '3'">
94 <xsl:text>pushd ../; tar -xvf gcc-testsuite-&gcc-version;.*; popd; &#xA;</xsl:text>
95 </xsl:if>
96 <xsl:if test="@id='ch-system-gcc' and $testsuite != '0'">
97 <xsl:text>pushd ../; tar -xvf gcc-testsuite-&gcc-version;.*; popd; &#xA;</xsl:text>
98 </xsl:if>
99 <xsl:if test="@id='bootable-bootscripts'">
100 <xsl:text>pushd ../; tar -xvf blfs-bootscripts-&blfs-bootscripts-version;.* ; popd; &#xA;</xsl:text>
101 </xsl:if>
102 </xsl:if>
103 <xsl:apply-templates select=".//para/userinput | .//screen"/>
104 <xsl:text>exit</xsl:text>
105 </exsl:document>
106 </xsl:if>
107 </xsl:template>
108
109 <xsl:template match="screen">
110 <xsl:if test="(@condition=$model or not(@condition)) and
111 child::* = userinput and not(@role = 'nodump')">
112 <xsl:apply-templates select="userinput" mode="screen"/>
113 </xsl:if>
114 </xsl:template>
115
116 <xsl:template match="para/userinput">
117 <xsl:if test="(contains(string(),'test') or
118 contains(string(),'check')) and
119 (($testsuite = '1' and
120 (ancestor::sect1[@id='ch-system-gcc'] or
121 ancestor::sect1[@id='ch-system-glibc'])) or
122 ($testsuite = '2' and
123 ancestor::chapter[@id='chapter-building-system']) or
124 $testsuite = '3')">
125 <xsl:value-of select="substring-before(string(),'make')"/>
126 <xsl:text>make -k</xsl:text>
127 <xsl:value-of select="substring-after(string(),'make')"/>
128 <xsl:text> || true&#xA;</xsl:text>
129 </xsl:if>
130 </xsl:template>
131
132 <xsl:template match="userinput" mode="screen">
133 <xsl:choose>
134 <!-- Estandarized package formats -->
135 <xsl:when test="contains(string(),'tar.gz')">
136 <xsl:value-of select="substring-before(string(),'tar.gz')"/>
137 <xsl:text>tar.*</xsl:text>
138 <xsl:value-of select="substring-after(string(),'tar.gz')"/>
139 <xsl:text>&#xA;</xsl:text>
140 </xsl:when>
141 <!-- Avoiding a race condition in a patch -->
142 <xsl:when test="contains(string(),'debian_fixes')">
143 <xsl:value-of select="substring-before(string(),'patch')"/>
144 <xsl:text>patch -Z</xsl:text>
145 <xsl:value-of select="substring-after(string(),'patch')"/>
146 <xsl:text>&#xA;</xsl:text>
147 </xsl:when>
148 <!-- Setting $LC_ALL and $LANG for /etc/profile -->
149 <xsl:when test="ancestor::sect1[@id='bootable-profile'] and
150 contains(string(),'export LANG=')">
151 <xsl:value-of select="substring-before(string(),'export LC_ALL=')"/>
152 <xsl:text>export LC_ALL=$LC_ALL&#xA;export LANG=$LANG&#xA;</xsl:text>
153 <xsl:text>export INPUTRC</xsl:text>
154 <xsl:value-of select="substring-after(string(),'INPUTRC')"/>
155 <xsl:text>&#xA;</xsl:text>
156 </xsl:when>
157 <!-- Copying the kernel config file -->
158 <xsl:when test="string() = 'make mrproper'">
159 <xsl:text>make mrproper&#xA;</xsl:text>
160 <xsl:text>cp -v /sources/kernel-config .config&#xA;</xsl:text>
161 </xsl:when>
162 <!-- The Coreutils and Module-Init-Tools test suites are optional -->
163 <xsl:when test="($testsuite = '0' or $testsuite = '1') and
164 (ancestor::sect1[@id='ch-system-coreutils'] or
165 ancestor::sect1[@id='ch-system-module-init-tools']) and
166 (contains(string(),'check') or
167 contains(string(),'distclean') or
168 contains(string(),'dummy'))"/>
169 <!-- Fixing toolchain test suites run -->
170 <xsl:when test="string() = 'make check' or
171 string() = 'make -k check'">
172 <xsl:choose>
173 <xsl:when test="(($testsuite = '1' or $testsuite = '2') and
174 ancestor::chapter[@id='chapter-building-system']) or
175 $testsuite = '3'">
176 <xsl:text>make -k check || true</xsl:text>
177 <xsl:text>&#xA;</xsl:text>
178 </xsl:when>
179 </xsl:choose>
180 </xsl:when>
181 <xsl:when test="contains(string(),'make check') and
182 ancestor::sect1[@id='ch-system-binutils']">
183 <xsl:choose>
184 <xsl:when test="$testsuite != '0'">
185 <xsl:value-of select="substring-before(string(),'make check')"/>
186 <xsl:text>make -k check || true&#xA;</xsl:text>
187 </xsl:when>
188 </xsl:choose>
189 </xsl:when>
190 <!-- Don't stop on strip run -->
191 <xsl:when test="contains(string(),'strip ')">
192 <xsl:apply-templates/>
193 <xsl:text> || true&#xA;</xsl:text>
194 </xsl:when>
195 <!-- The rest of commands -->
196 <xsl:otherwise>
197 <xsl:apply-templates/>
198 <xsl:text>&#xA;</xsl:text>
199 </xsl:otherwise>
200 </xsl:choose>
201 </xsl:template>
202
203 <xsl:template match="replaceable">
204 <xsl:choose>
205 <xsl:when test="ancestor::sect1[@id='ch-system-glibc'] or
206 ancestor::sect1[@id='ch-system-uclibc']">
207 <xsl:text>$TIMEZONE</xsl:text>
208 </xsl:when>
209 <xsl:when test="ancestor::sect1[@id='ch-system-groff']">
210 <xsl:text>$PAGE</xsl:text>
211 </xsl:when>
212 <xsl:otherwise>
213 <xsl:text>**EDITME</xsl:text>
214 <xsl:apply-templates/>
215 <xsl:text>EDITME**</xsl:text>
216 </xsl:otherwise>
217 </xsl:choose>
218 </xsl:template>
219
220</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.