[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 | <!-- Install vim-lang package? -->
|
---|
| 27 | <xsl:param name="vim-lang" select="1"/>
|
---|
| 28 |
|
---|
| 29 | <xsl:template match="/">
|
---|
| 30 | <xsl:apply-templates select="//sect1"/>
|
---|
| 31 | </xsl:template>
|
---|
| 32 |
|
---|
| 33 | <xsl:template match="sect1">
|
---|
[174a8e9] | 34 | <xsl:if test="(../@id='chapter-temporary-tools' or
|
---|
| 35 | ../@id='chapter-building-system' or
|
---|
| 36 | ../@id='chapter-bootable') and
|
---|
| 37 | ((@condition=$model or not(@condition)) and
|
---|
| 38 | count(descendant::screen/userinput) > 0 and
|
---|
| 39 | count(descendant::screen/userinput) >
|
---|
| 40 | count(descendant::screen[@role='nodump']))">
|
---|
[0170229] | 41 | <!-- The dirs names -->
|
---|
| 42 | <xsl:variable name="pi-dir" select="../processing-instruction('dbhtml')"/>
|
---|
| 43 | <xsl:variable name="pi-dir-value" select="substring-after($pi-dir,'dir=')"/>
|
---|
| 44 | <xsl:variable name="quote-dir" select="substring($pi-dir-value,1,1)"/>
|
---|
| 45 | <xsl:variable name="dirname" select="substring-before(substring($pi-dir-value,2),$quote-dir)"/>
|
---|
| 46 | <!-- The file names -->
|
---|
| 47 | <xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/>
|
---|
| 48 | <xsl:variable name="pi-file-value" select="substring-after($pi-file,'filename=')"/>
|
---|
| 49 | <xsl:variable name="filename" select="substring-before(substring($pi-file-value,2),'.html')"/>
|
---|
| 50 | <!-- The build order -->
|
---|
| 51 | <xsl:variable name="position" select="position()"/>
|
---|
| 52 | <xsl:variable name="order">
|
---|
| 53 | <xsl:choose>
|
---|
| 54 | <xsl:when test="string-length($position) = 1">
|
---|
| 55 | <xsl:text>00</xsl:text>
|
---|
| 56 | <xsl:value-of select="$position"/>
|
---|
| 57 | </xsl:when>
|
---|
| 58 | <xsl:when test="string-length($position) = 2">
|
---|
| 59 | <xsl:text>0</xsl:text>
|
---|
| 60 | <xsl:value-of select="$position"/>
|
---|
| 61 | </xsl:when>
|
---|
| 62 | <xsl:otherwise>
|
---|
| 63 | <xsl:value-of select="$position"/>
|
---|
| 64 | </xsl:otherwise>
|
---|
| 65 | </xsl:choose>
|
---|
| 66 | </xsl:variable>
|
---|
| 67 | <!-- Creating dirs and files -->
|
---|
| 68 | <exsl:document href="{$dirname}/{$order}-{$filename}" method="text">
|
---|
| 69 | <xsl:choose>
|
---|
| 70 | <xsl:when test="@id='ch-system-changingowner' or
|
---|
[174a8e9] | 71 | @id='ch-system-creatingdirs' or
|
---|
| 72 | @id='ch-system-createfiles'">
|
---|
[0170229] | 73 | <xsl:text>#!/tools/bin/bash
set -e

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

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