[0170229] | 1 | <?xml version="1.0"?>
|
---|
| 2 | <!DOCTYPE xsl:stylesheet [
|
---|
| 3 | <!ENTITY % general-entities SYSTEM "FAKEDIR/general.ent">
|
---|
| 4 | %general-entities;
|
---|
| 5 | ]>
|
---|
| 6 |
|
---|
[174a8e9] | 7 | <!-- $Id$ -->
|
---|
| 8 |
|
---|
[0170229] | 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 |
|
---|
[174a8e9] | 14 | <!-- XSLT stylesheet to create shell scripts from HLFS books. -->
|
---|
[0170229] | 15 |
|
---|
[174a8e9] | 16 | <!-- What libc implentation must be used? -->
|
---|
| 17 | <xsl:param name="model" select="glibc"/>
|
---|
[0170229] | 18 |
|
---|
[174a8e9] | 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"/>
|
---|
[0170229] | 25 |
|
---|
| 26 | <xsl:template match="/">
|
---|
| 27 | <xsl:apply-templates select="//sect1"/>
|
---|
| 28 | </xsl:template>
|
---|
| 29 |
|
---|
| 30 | <xsl:template match="sect1">
|
---|
[174a8e9] | 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) > 0 and
|
---|
| 36 | count(descendant::screen/userinput) >
|
---|
| 37 | count(descendant::screen[@role='nodump']))">
|
---|
[0170229] | 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
|
---|
[174a8e9] | 68 | @id='ch-system-creatingdirs' or
|
---|
| 69 | @id='ch-system-createfiles'">
|
---|
[0170229] | 70 | <xsl:text>#!/tools/bin/bash
set -e

</xsl:text>
|
---|
| 71 | </xsl:when>
|
---|
| 72 | <xsl:when test="@id='ch-tools-stripping' or
|
---|
[174a8e9] | 73 | @id='ch-system-strippingagain'">
|
---|
[0170229] | 74 | <xsl:text>#!/bin/sh
</xsl:text>
|
---|
| 75 | </xsl:when>
|
---|
| 76 | <xsl:otherwise>
|
---|
| 77 | <xsl:text>#!/bin/sh
set -e

</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
</xsl:text>
|
---|
[174a8e9] | 84 | <xsl:if test="@id='ch-tools-uclibc' or @id='ch-system-uclibc'">
|
---|
[0170229] | 85 | <xsl:text>pushd ../; tar -xvf gettext-&gettext-version;.*; popd; 
</xsl:text>
|
---|
| 86 | </xsl:if>
|
---|
[174a8e9] | 87 | <xsl:if test="@id='ch-tools-glibc' or @id='ch-system-glibc'">
|
---|
[0170229] | 88 | <xsl:text>tar -xvf ../glibc-libidn-&glibc-version;.*
</xsl:text>
|
---|
| 89 | </xsl:if>
|
---|
[174a8e9] | 90 | <xsl:if test="@id='ch-tools-gcc' or @id='ch-system-gcc'">
|
---|
[0170229] | 91 | <xsl:text>pushd ../; tar -xvf gcc-g++-&gcc-version;.*; popd; 
</xsl:text>
|
---|
| 92 | </xsl:if>
|
---|
[174a8e9] | 93 | <xsl:if test="@id='ch-tools-gcc' and $testsuite = '3'">
|
---|
| 94 | <xsl:text>pushd ../; tar -xvf gcc-testsuite-&gcc-version;.*; popd; 
</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; 
</xsl:text>
|
---|
[0170229] | 98 | </xsl:if>
|
---|
| 99 | <xsl:if test="@id='bootable-bootscripts'">
|
---|
| 100 | <xsl:text>pushd ../; tar -xvf blfs-bootscripts-&blfs-bootscripts-version;.* ; popd; 
</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">
|
---|
[174a8e9] | 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"/>
|
---|
[0170229] | 113 | </xsl:if>
|
---|
| 114 | </xsl:template>
|
---|
| 115 |
|
---|
| 116 | <xsl:template match="para/userinput">
|
---|
[174a8e9] | 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')">
|
---|
[1f89002] | 125 | <xsl:choose>
|
---|
| 126 | <xsl:when test="ancestor::sect1[@id='ch-system-gcc']">
|
---|
| 127 | <xsl:text>make -k check || true
</xsl:text>
|
---|
| 128 | </xsl:when>
|
---|
| 129 | <xsl:otherwise>
|
---|
| 130 | <xsl:value-of select="substring-before(string(),'make')"/>
|
---|
| 131 | <xsl:text>make -k</xsl:text>
|
---|
| 132 | <xsl:value-of select="substring-after(string(),'make')"/>
|
---|
| 133 | <xsl:text> || true
</xsl:text>
|
---|
| 134 | </xsl:otherwise>
|
---|
| 135 | </xsl:choose>
|
---|
[0170229] | 136 | </xsl:if>
|
---|
| 137 | </xsl:template>
|
---|
| 138 |
|
---|
| 139 | <xsl:template match="userinput" mode="screen">
|
---|
| 140 | <xsl:choose>
|
---|
| 141 | <!-- Estandarized package formats -->
|
---|
| 142 | <xsl:when test="contains(string(),'tar.gz')">
|
---|
| 143 | <xsl:value-of select="substring-before(string(),'tar.gz')"/>
|
---|
| 144 | <xsl:text>tar.*</xsl:text>
|
---|
| 145 | <xsl:value-of select="substring-after(string(),'tar.gz')"/>
|
---|
| 146 | <xsl:text>
</xsl:text>
|
---|
| 147 | </xsl:when>
|
---|
| 148 | <!-- Avoiding a race condition in a patch -->
|
---|
| 149 | <xsl:when test="contains(string(),'debian_fixes')">
|
---|
| 150 | <xsl:value-of select="substring-before(string(),'patch')"/>
|
---|
| 151 | <xsl:text>patch -Z</xsl:text>
|
---|
| 152 | <xsl:value-of select="substring-after(string(),'patch')"/>
|
---|
| 153 | <xsl:text>
</xsl:text>
|
---|
| 154 | </xsl:when>
|
---|
[174a8e9] | 155 | <!-- Setting $LC_ALL and $LANG for /etc/profile -->
|
---|
| 156 | <xsl:when test="ancestor::sect1[@id='bootable-profile'] and
|
---|
| 157 | contains(string(),'export LANG=')">
|
---|
| 158 | <xsl:value-of select="substring-before(string(),'export LC_ALL=')"/>
|
---|
| 159 | <xsl:text>export LC_ALL=$LC_ALL
export LANG=$LANG
</xsl:text>
|
---|
| 160 | <xsl:text>export INPUTRC</xsl:text>
|
---|
| 161 | <xsl:value-of select="substring-after(string(),'INPUTRC')"/>
|
---|
| 162 | <xsl:text>
</xsl:text>
|
---|
| 163 | </xsl:when>
|
---|
[0170229] | 164 | <!-- Copying the kernel config file -->
|
---|
| 165 | <xsl:when test="string() = 'make mrproper'">
|
---|
| 166 | <xsl:text>make mrproper
</xsl:text>
|
---|
| 167 | <xsl:text>cp -v /sources/kernel-config .config
</xsl:text>
|
---|
| 168 | </xsl:when>
|
---|
| 169 | <!-- The Coreutils and Module-Init-Tools test suites are optional -->
|
---|
[174a8e9] | 170 | <xsl:when test="($testsuite = '0' or $testsuite = '1') and
|
---|
[0170229] | 171 | (ancestor::sect1[@id='ch-system-coreutils'] or
|
---|
[174a8e9] | 172 | ancestor::sect1[@id='ch-system-module-init-tools']) and
|
---|
[0170229] | 173 | (contains(string(),'check') or
|
---|
[174a8e9] | 174 | contains(string(),'distclean') or
|
---|
| 175 | contains(string(),'dummy'))"/>
|
---|
[0170229] | 176 | <!-- Fixing toolchain test suites run -->
|
---|
| 177 | <xsl:when test="string() = 'make check' or
|
---|
[174a8e9] | 178 | string() = 'make -k check'">
|
---|
[0170229] | 179 | <xsl:choose>
|
---|
[174a8e9] | 180 | <xsl:when test="(($testsuite = '1' or $testsuite = '2') and
|
---|
| 181 | ancestor::chapter[@id='chapter-building-system']) or
|
---|
| 182 | $testsuite = '3'">
|
---|
[0170229] | 183 | <xsl:text>make -k check || true</xsl:text>
|
---|
| 184 | <xsl:text>
</xsl:text>
|
---|
[174a8e9] | 185 | </xsl:when>
|
---|
[0170229] | 186 | </xsl:choose>
|
---|
| 187 | </xsl:when>
|
---|
[174a8e9] | 188 | <xsl:when test="contains(string(),'make check') and
|
---|
| 189 | ancestor::sect1[@id='ch-system-binutils']">
|
---|
[0170229] | 190 | <xsl:choose>
|
---|
[174a8e9] | 191 | <xsl:when test="$testsuite != '0'">
|
---|
| 192 | <xsl:value-of select="substring-before(string(),'make check')"/>
|
---|
| 193 | <xsl:text>make -k check || true
</xsl:text>
|
---|
| 194 | </xsl:when>
|
---|
[0170229] | 195 | </xsl:choose>
|
---|
| 196 | </xsl:when>
|
---|
[1f89002] | 197 | <xsl:when test="contains(string(),'hardened-specs') and
|
---|
| 198 | ancestor::sect1[@id='ch-system-binutils']
|
---|
| 199 | and $testsuite = '0'"/>
|
---|
[0170229] | 200 | <!-- Don't stop on strip run -->
|
---|
| 201 | <xsl:when test="contains(string(),'strip ')">
|
---|
| 202 | <xsl:apply-templates/>
|
---|
| 203 | <xsl:text> || true
</xsl:text>
|
---|
| 204 | </xsl:when>
|
---|
| 205 | <!-- The rest of commands -->
|
---|
| 206 | <xsl:otherwise>
|
---|
| 207 | <xsl:apply-templates/>
|
---|
| 208 | <xsl:text>
</xsl:text>
|
---|
| 209 | </xsl:otherwise>
|
---|
| 210 | </xsl:choose>
|
---|
| 211 | </xsl:template>
|
---|
| 212 |
|
---|
| 213 | <xsl:template match="replaceable">
|
---|
| 214 | <xsl:choose>
|
---|
[174a8e9] | 215 | <xsl:when test="ancestor::sect1[@id='ch-system-glibc'] or
|
---|
| 216 | ancestor::sect1[@id='ch-system-uclibc']">
|
---|
[0170229] | 217 | <xsl:text>$TIMEZONE</xsl:text>
|
---|
| 218 | </xsl:when>
|
---|
| 219 | <xsl:when test="ancestor::sect1[@id='ch-system-groff']">
|
---|
| 220 | <xsl:text>$PAGE</xsl:text>
|
---|
| 221 | </xsl:when>
|
---|
| 222 | <xsl:otherwise>
|
---|
| 223 | <xsl:text>**EDITME</xsl:text>
|
---|
| 224 | <xsl:apply-templates/>
|
---|
| 225 | <xsl:text>EDITME**</xsl:text>
|
---|
| 226 | </xsl:otherwise>
|
---|
| 227 | </xsl:choose>
|
---|
| 228 | </xsl:template>
|
---|
| 229 |
|
---|
| 230 | </xsl:stylesheet>
|
---|