[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 |
|
---|
[d540567] | 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 |
|
---|
[174a8e9] | 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"/>
|
---|
[0170229] | 31 |
|
---|
[ad71d98] | 32 | <!-- Time zone -->
|
---|
[e35e794] | 33 | <xsl:param name="timezone" select="GMT"/>
|
---|
[ad71d98] | 34 |
|
---|
| 35 | <!-- Page size -->
|
---|
| 36 | <xsl:param name="page" select="letter"/>
|
---|
| 37 |
|
---|
[d87b293] | 38 | <!-- Locale settings -->
|
---|
[e35e794] | 39 | <xsl:param name="lang" select="C"/>
|
---|
| 40 | <xsl:param name="lc_all" select="C"/>
|
---|
[d87b293] | 41 |
|
---|
[0170229] | 42 | <xsl:template match="/">
|
---|
| 43 | <xsl:apply-templates select="//sect1"/>
|
---|
| 44 | </xsl:template>
|
---|
| 45 |
|
---|
| 46 | <xsl:template match="sect1">
|
---|
[174a8e9] | 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']))">
|
---|
[0170229] | 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
|
---|
[174a8e9] | 84 | @id='ch-system-creatingdirs' or
|
---|
| 85 | @id='ch-system-createfiles'">
|
---|
[0170229] | 86 | <xsl:text>#!/tools/bin/bash
set -e

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