[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? -->
|
---|
| 20 | <xsl:param name="grsecurity_host" select="0"/>
|
---|
| 21 |
|
---|
| 22 | <!-- Compile the keymap into the kernel? -->
|
---|
| 23 | <xsl:param name="keymap" select="none"/>
|
---|
| 24 |
|
---|
| 25 | <!-- Run test suites?
|
---|
| 26 | 0 = none
|
---|
| 27 | 1 = only chapter06 Glibc, GCC and Binutils testsuites
|
---|
| 28 | 2 = all chapter06 testsuites
|
---|
| 29 | 3 = all chapter05 and chapter06 testsuites-->
|
---|
| 30 | <xsl:param name="testsuite" select="1"/>
|
---|
| 31 |
|
---|
| 32 | <!-- Time zone -->
|
---|
| 33 | <xsl:param name="timezone" select="America/Toronto"/>
|
---|
| 34 |
|
---|
| 35 | <!-- Page size -->
|
---|
| 36 | <xsl:param name="page" select="letter"/>
|
---|
| 37 |
|
---|
| 38 | <!-- Locale settings -->
|
---|
| 39 | <xsl:param name="lang" select="en_CA"/>
|
---|
| 40 | <xsl:param name="lc_all" select="en_CA"/>
|
---|
| 41 |
|
---|
| 42 | <xsl:template match="/">
|
---|
| 43 | <xsl:apply-templates select="//sect1"/>
|
---|
| 44 | </xsl:template>
|
---|
| 45 |
|
---|
| 46 | <xsl:template match="sect1">
|
---|
| 47 | <xsl:if test="(../@id='chapter-temporary-tools' or
|
---|
| 48 | ../@id='chapter-building-system' or
|
---|
| 49 | ../@id='chapter-bootable') and
|
---|
| 50 | ((@condition=$model or not(@condition)) and
|
---|
| 51 | count(descendant::screen/userinput) > 0 and
|
---|
| 52 | count(descendant::screen/userinput) >
|
---|
| 53 | count(descendant::screen[@role='nodump']))">
|
---|
| 54 | <!-- The dirs names -->
|
---|
| 55 | <xsl:variable name="pi-dir" select="../processing-instruction('dbhtml')"/>
|
---|
| 56 | <xsl:variable name="pi-dir-value" select="substring-after($pi-dir,'dir=')"/>
|
---|
| 57 | <xsl:variable name="quote-dir" select="substring($pi-dir-value,1,1)"/>
|
---|
| 58 | <xsl:variable name="dirname" select="substring-before(substring($pi-dir-value,2),$quote-dir)"/>
|
---|
| 59 | <!-- The file names -->
|
---|
| 60 | <xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/>
|
---|
| 61 | <xsl:variable name="pi-file-value" select="substring-after($pi-file,'filename=')"/>
|
---|
| 62 | <xsl:variable name="filename" select="substring-before(substring($pi-file-value,2),'.html')"/>
|
---|
| 63 | <!-- The build order -->
|
---|
| 64 | <xsl:variable name="position" select="position()"/>
|
---|
| 65 | <xsl:variable name="order">
|
---|
| 66 | <xsl:choose>
|
---|
| 67 | <xsl:when test="string-length($position) = 1">
|
---|
| 68 | <xsl:text>00</xsl:text>
|
---|
| 69 | <xsl:value-of select="$position"/>
|
---|
| 70 | </xsl:when>
|
---|
| 71 | <xsl:when test="string-length($position) = 2">
|
---|
| 72 | <xsl:text>0</xsl:text>
|
---|
| 73 | <xsl:value-of select="$position"/>
|
---|
| 74 | </xsl:when>
|
---|
| 75 | <xsl:otherwise>
|
---|
| 76 | <xsl:value-of select="$position"/>
|
---|
| 77 | </xsl:otherwise>
|
---|
| 78 | </xsl:choose>
|
---|
| 79 | </xsl:variable>
|
---|
| 80 | <!-- Creating dirs and files -->
|
---|
| 81 | <exsl:document href="{$dirname}/{$order}-{$filename}" method="text">
|
---|
| 82 | <xsl:choose>
|
---|
| 83 | <xsl:when test="@id='ch-system-changingowner' or
|
---|
| 84 | @id='ch-system-creatingdirs' or
|
---|
| 85 | @id='ch-system-createfiles'">
|
---|
| 86 | <xsl:text>#!/tools/bin/bash
set -e

</xsl:text>
|
---|
| 87 | </xsl:when>
|
---|
| 88 | <xsl:when test="@id='ch-tools-stripping' or
|
---|
| 89 | @id='ch-system-strippingagain'">
|
---|
| 90 | <xsl:text>#!/bin/sh
</xsl:text>
|
---|
| 91 | </xsl:when>
|
---|
| 92 | <xsl:otherwise>
|
---|
| 93 | <xsl:text>#!/bin/sh
set -e

</xsl:text>
|
---|
| 94 | </xsl:otherwise>
|
---|
| 95 | </xsl:choose>
|
---|
| 96 | <xsl:if test="(sect2[@role='installation'] and
|
---|
| 97 | not(@id='bootable-kernel')) or
|
---|
| 98 | @id='ch-tools-adjusting' or
|
---|
| 99 | @id='ch-system-readjusting'">
|
---|
| 100 | <xsl:text>cd $PKGDIR
</xsl:text>
|
---|
| 101 | <xsl:if test="@id='ch-tools-uclibc' or @id='ch-system-uclibc'">
|
---|
| 102 | <xsl:text>pushd ../; tar -xvf gettext-&gettext-version;.*; popd; 
</xsl:text>
|
---|
| 103 | </xsl:if>
|
---|
| 104 | <xsl:if test="@id='ch-tools-glibc' or @id='ch-system-glibc'">
|
---|
| 105 | <xsl:text>tar -xvf ../glibc-libidn-&glibc-version;.*
</xsl:text>
|
---|
| 106 | </xsl:if>
|
---|
| 107 | <xsl:if test="@id='ch-tools-gcc' or @id='ch-system-gcc'">
|
---|
| 108 | <xsl:text>pushd ../; tar -xvf gcc-g++-&gcc-version;.*; popd; 
</xsl:text>
|
---|
| 109 | </xsl:if>
|
---|
| 110 | <xsl:if test="@id='ch-tools-gcc' and $testsuite = '3'">
|
---|
| 111 | <xsl:text>pushd ../; tar -xvf gcc-testsuite-&gcc-version;.*; popd; 
</xsl:text>
|
---|
| 112 | </xsl:if>
|
---|
| 113 | <xsl:if test="@id='ch-system-gcc' and $testsuite != '0'">
|
---|
| 114 | <xsl:text>pushd ../; tar -xvf gcc-testsuite-&gcc-version;.*; popd; 
</xsl:text>
|
---|
| 115 | </xsl:if>
|
---|
| 116 | <xsl:if test="@id='bootable-bootscripts'">
|
---|
| 117 | <xsl:text>pushd ../; tar -xvf blfs-bootscripts-&blfs-bootscripts-version;.* ; popd; 
</xsl:text>
|
---|
| 118 | </xsl:if>
|
---|
| 119 | </xsl:if>
|
---|
| 120 | <xsl:if test="@id='ch-system-kernfs'">
|
---|
| 121 | <xsl:text>export HLFS=$LFS
</xsl:text>
|
---|
| 122 | </xsl:if>
|
---|
| 123 | <xsl:apply-templates select=".//para/userinput | .//screen"/>
|
---|
| 124 | <xsl:text>exit</xsl:text>
|
---|
| 125 | </exsl:document>
|
---|
| 126 | </xsl:if>
|
---|
| 127 | </xsl:template>
|
---|
| 128 |
|
---|
| 129 | <xsl:template match="screen">
|
---|
| 130 | <xsl:if test="(@condition=$model or not(@condition)) and
|
---|
| 131 | child::* = userinput and not(@role = 'nodump')">
|
---|
| 132 | <xsl:apply-templates select="userinput" mode="screen"/>
|
---|
| 133 | </xsl:if>
|
---|
| 134 | </xsl:template>
|
---|
| 135 |
|
---|
| 136 | <xsl:template match="para/userinput">
|
---|
| 137 | <xsl:if test="(contains(string(),'test') or
|
---|
| 138 | contains(string(),'check')) and
|
---|
| 139 | (($testsuite = '1' and
|
---|
| 140 | (ancestor::sect1[@id='ch-system-gcc'] or
|
---|
| 141 | ancestor::sect1[@id='ch-system-glibc'])) or
|
---|
| 142 | ($testsuite = '2' and
|
---|
| 143 | ancestor::chapter[@id='chapter-building-system']) or
|
---|
| 144 | $testsuite = '3')">
|
---|
| 145 | <xsl:choose>
|
---|
| 146 | <xsl:when test="ancestor::sect1[@id='ch-system-gcc']">
|
---|
| 147 | <xsl:text>make -k check || true
</xsl:text>
|
---|
| 148 | </xsl:when>
|
---|
| 149 | <xsl:otherwise>
|
---|
| 150 | <xsl:value-of select="substring-before(string(),'make')"/>
|
---|
| 151 | <xsl:text>make -k</xsl:text>
|
---|
| 152 | <xsl:value-of select="substring-after(string(),'make')"/>
|
---|
| 153 | <xsl:text> || true
</xsl:text>
|
---|
| 154 | </xsl:otherwise>
|
---|
| 155 | </xsl:choose>
|
---|
| 156 | </xsl:if>
|
---|
| 157 | </xsl:template>
|
---|
| 158 |
|
---|
| 159 | <xsl:template match="userinput" mode="screen">
|
---|
| 160 | <xsl:choose>
|
---|
| 161 | <!-- Estandarized package formats -->
|
---|
| 162 | <xsl:when test="contains(string(),'tar.gz')">
|
---|
| 163 | <xsl:value-of select="substring-before(string(),'tar.gz')"/>
|
---|
| 164 | <xsl:text>tar.*</xsl:text>
|
---|
| 165 | <xsl:value-of select="substring-after(string(),'tar.gz')"/>
|
---|
| 166 | <xsl:text>
</xsl:text>
|
---|
| 167 | </xsl:when>
|
---|
| 168 | <!-- Avoiding a race condition in a patch -->
|
---|
| 169 | <xsl:when test="contains(string(),'debian_fixes')">
|
---|
| 170 | <xsl:value-of select="substring-before(string(),'patch')"/>
|
---|
| 171 | <xsl:text>patch -Z</xsl:text>
|
---|
| 172 | <xsl:value-of select="substring-after(string(),'patch')"/>
|
---|
| 173 | <xsl:text>
</xsl:text>
|
---|
| 174 | </xsl:when>
|
---|
| 175 | <!-- grsecurity kernel in the host? -->
|
---|
| 176 | <xsl:when test="ancestor::sect1[@id='ch-system-kernfs'] and
|
---|
| 177 | contains(string(),'sysctl')
|
---|
| 178 | and $grsecurity_host ='0'"/>
|
---|
| 179 | <!-- Setting $LC_ALL and $LANG for /etc/profile -->
|
---|
| 180 | <xsl:when test="ancestor::sect1[@id='bootable-profile'] and
|
---|
| 181 | contains(string(),'export LANG=')">
|
---|
| 182 | <xsl:value-of select="substring-before(string(),'export LC_ALL=')"/>
|
---|
| 183 | <xsl:text>export LC_ALL=</xsl:text>
|
---|
| 184 | <xsl:value-of select="$lc_all"/>
|
---|
| 185 | <xsl:text>
export LANG=</xsl:text>
|
---|
| 186 | <xsl:value-of select="$lang"/>
|
---|
| 187 | <xsl:text>
export INPUTRC</xsl:text>
|
---|
| 188 | <xsl:value-of select="substring-after(string(),'INPUTRC')"/>
|
---|
| 189 | <xsl:text>
</xsl:text>
|
---|
| 190 | </xsl:when>
|
---|
| 191 | <!-- Fixing bootscripts installation -->
|
---|
| 192 | <xsl:when test="ancestor::sect1[@id='bootable-bootscripts'] and
|
---|
| 193 | string() = 'make install'">
|
---|
| 194 | <xsl:text>make install
</xsl:text>
|
---|
| 195 | <xsl:text>cd ../blfs-bootscripts-&blfs-bootscripts-version;
</xsl:text>
|
---|
| 196 | </xsl:when>
|
---|
| 197 | <!-- Compile the keymap into the kernel? -->
|
---|
| 198 | <xsl:when test="contains(string(),'defkeymap') and
|
---|
| 199 | $keymap = 'none'"/>
|
---|
| 200 | <!-- Copying the kernel config file -->
|
---|
| 201 | <xsl:when test="string() = 'make mrproper'">
|
---|
| 202 | <xsl:text>make mrproper
</xsl:text>
|
---|
| 203 | <xsl:text>cp -v /sources/kernel-config .config
</xsl:text>
|
---|
| 204 | </xsl:when>
|
---|
| 205 | <!-- No interactive commands are needed if the .config file is the proper one -->
|
---|
| 206 | <xsl:when test="string() = 'make menuconfig'"/>
|
---|
| 207 | <!-- For uClibc we need to cd to the Gettext package -->
|
---|
| 208 | <xsl:when test="contains(string(),'cd gettext-runtime/')">
|
---|
| 209 | <xsl:text>cd ../gettext-*/gettext-runtime</xsl:text>
|
---|
| 210 | <xsl:value-of select="substring-after(string(),'gettext-runtime')"/>
|
---|
| 211 | <xsl:text>
</xsl:text>
|
---|
| 212 | </xsl:when>
|
---|
| 213 | <!-- The Coreutils and Module-Init-Tools test suites are optional -->
|
---|
| 214 | <xsl:when test="($testsuite = '0' or $testsuite = '1') and
|
---|
| 215 | (ancestor::sect1[@id='ch-system-coreutils'] or
|
---|
| 216 | ancestor::sect1[@id='ch-system-module-init-tools']) and
|
---|
| 217 | (contains(string(),'check') or
|
---|
| 218 | contains(string(),'distclean') or
|
---|
| 219 | contains(string(),'dummy'))"/>
|
---|
| 220 | <!-- Fixing toolchain test suites run -->
|
---|
| 221 | <xsl:when test="string() = 'make check' or
|
---|
| 222 | string() = 'make -k check'">
|
---|
| 223 | <xsl:choose>
|
---|
| 224 | <xsl:when test="(($testsuite = '1' or $testsuite = '2') and
|
---|
| 225 | ancestor::chapter[@id='chapter-building-system']) or
|
---|
| 226 | $testsuite = '3'">
|
---|
| 227 | <xsl:text>make -k check || true</xsl:text>
|
---|
| 228 | <xsl:text>
</xsl:text>
|
---|
| 229 | </xsl:when>
|
---|
| 230 | </xsl:choose>
|
---|
| 231 | </xsl:when>
|
---|
| 232 | <xsl:when test="contains(string(),'make check') and
|
---|
| 233 | ancestor::sect1[@id='ch-system-binutils']">
|
---|
| 234 | <xsl:choose>
|
---|
| 235 | <xsl:when test="$testsuite != '0'">
|
---|
| 236 | <xsl:value-of select="substring-before(string(),'make check')"/>
|
---|
| 237 | <xsl:text>make -k check || true
</xsl:text>
|
---|
| 238 | </xsl:when>
|
---|
| 239 | </xsl:choose>
|
---|
| 240 | </xsl:when>
|
---|
| 241 | <xsl:when test="contains(string(),'hardened-specs') and
|
---|
| 242 | ancestor::sect1[@id='ch-system-binutils']
|
---|
| 243 | and $testsuite = '0'"/>
|
---|
| 244 | <!-- Don't stop on strip run and chapter05 GCC installation test-->
|
---|
| 245 | <xsl:when test="contains(string(),'strip ') or
|
---|
| 246 | ancestor::sect2[@id='testing-gcc'] and
|
---|
| 247 | not(contains(string(),'EOF'))">
|
---|
| 248 | <xsl:apply-templates/>
|
---|
| 249 | <xsl:text> || true
</xsl:text>
|
---|
| 250 | </xsl:when>
|
---|
| 251 | <!-- The rest of commands -->
|
---|
| 252 | <xsl:otherwise>
|
---|
| 253 | <xsl:apply-templates/>
|
---|
| 254 | <xsl:text>
</xsl:text>
|
---|
| 255 | </xsl:otherwise>
|
---|
| 256 | </xsl:choose>
|
---|
| 257 | </xsl:template>
|
---|
| 258 |
|
---|
| 259 | <xsl:template match="replaceable">
|
---|
| 260 | <xsl:choose>
|
---|
| 261 | <xsl:when test="ancestor::sect1[@id='ch-system-glibc'] or
|
---|
| 262 | ancestor::sect1[@id='ch-system-uclibc']">
|
---|
| 263 | <xsl:value-of select="$timezone"/>
|
---|
| 264 | </xsl:when>
|
---|
| 265 | <xsl:when test="ancestor::sect1[@id='ch-system-groff']">
|
---|
| 266 | <xsl:value-of select="$page"/>
|
---|
| 267 | </xsl:when>
|
---|
| 268 | <xsl:when test="ancestor::sect1[@id='bootable-kernel']">
|
---|
| 269 | <xsl:value-of select="$keymap"/>
|
---|
| 270 | </xsl:when>
|
---|
| 271 | <xsl:otherwise>
|
---|
| 272 | <xsl:text>**EDITME</xsl:text>
|
---|
| 273 | <xsl:apply-templates/>
|
---|
| 274 | <xsl:text>EDITME**</xsl:text>
|
---|
| 275 | </xsl:otherwise>
|
---|
| 276 | </xsl:choose>
|
---|
| 277 | </xsl:template>
|
---|
| 278 |
|
---|
| 279 | </xsl:stylesheet>
|
---|