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

</xsl:text>
|
---|
| 91 | </xsl:when>
|
---|
| 92 | <xsl:when test="@id='ch-tools-stripping' or
|
---|
[174a8e9] | 93 | @id='ch-system-strippingagain'">
|
---|
[0170229] | 94 | <xsl:text>#!/bin/sh
</xsl:text>
|
---|
| 95 | </xsl:when>
|
---|
| 96 | <xsl:otherwise>
|
---|
| 97 | <xsl:text>#!/bin/sh
set -e

</xsl:text>
|
---|
| 98 | </xsl:otherwise>
|
---|
| 99 | </xsl:choose>
|
---|
[d540567] | 100 | <xsl:if test="(sect2[@role='installation'] and
|
---|
[a82bbc0] | 101 | not(@id='bootable-kernel'))">
|
---|
[0170229] | 102 | <xsl:text>cd $PKGDIR
</xsl:text>
|
---|
[174a8e9] | 103 | <xsl:if test="@id='ch-tools-uclibc' or @id='ch-system-uclibc'">
|
---|
[0170229] | 104 | <xsl:text>pushd ../; tar -xvf gettext-&gettext-version;.*; popd; 
</xsl:text>
|
---|
| 105 | </xsl:if>
|
---|
[f83bcee] | 106 |
|
---|
[7c4730c] | 107 | <!-- NEW toolchain format, from inside ./sources dir unpack binutils and gcc -->
|
---|
[f83bcee] | 108 | <xsl:if test="@id='ch-tools-embryo-toolchain' or
|
---|
| 109 | @id='ch-tools-cocoon-toolchain' or
|
---|
| 110 | @id='ch-system-butterfly-toolchain'">
|
---|
[a82bbc0] | 111 | <xsl:text>tar -xvf gcc-core-&gcc-version;.*; 
</xsl:text>
|
---|
| 112 | <xsl:text>tar -xvf gcc-g++-&gcc-version;.*; 
</xsl:text>
|
---|
| 113 | <xsl:text>tar -xvf binutils-&binutils-version;.*; 
</xsl:text>
|
---|
[174a8e9] | 114 | </xsl:if>
|
---|
[a82bbc0] | 115 | <!-- ONLY butterfly has a testsuite -->
|
---|
[00818a6] | 116 | <xsl:if test="@id='ch-system-butterfly-toolchain' and $testsuite != '0'">
|
---|
[7c4730c] | 117 | <xsl:text>tar -xvf gcc-testsuite-&gcc-version;.*; 
</xsl:text>
|
---|
[0170229] | 118 | </xsl:if>
|
---|
[a82bbc0] | 119 | <!-- END new toolchain format -->
|
---|
[f83bcee] | 120 |
|
---|
[0170229] | 121 | <xsl:if test="@id='bootable-bootscripts'">
|
---|
| 122 | <xsl:text>pushd ../; tar -xvf blfs-bootscripts-&blfs-bootscripts-version;.* ; popd; 
</xsl:text>
|
---|
| 123 | </xsl:if>
|
---|
| 124 | </xsl:if>
|
---|
| 125 | <xsl:apply-templates select=".//para/userinput | .//screen"/>
|
---|
| 126 | <xsl:text>exit</xsl:text>
|
---|
| 127 | </exsl:document>
|
---|
| 128 | </xsl:if>
|
---|
| 129 | </xsl:template>
|
---|
| 130 |
|
---|
| 131 | <xsl:template match="screen">
|
---|
[174a8e9] | 132 | <xsl:if test="(@condition=$model or not(@condition)) and
|
---|
| 133 | child::* = userinput and not(@role = 'nodump')">
|
---|
| 134 | <xsl:apply-templates select="userinput" mode="screen"/>
|
---|
[0170229] | 135 | </xsl:if>
|
---|
| 136 | </xsl:template>
|
---|
| 137 |
|
---|
| 138 | <xsl:template match="para/userinput">
|
---|
[174a8e9] | 139 | <xsl:if test="(contains(string(),'test') or
|
---|
[f83bcee] | 140 | contains(string(),'check')) and
|
---|
| 141 | ($testsuite = '2' or $testsuite = '3')">
|
---|
[056486c] | 142 | <xsl:choose>
|
---|
[47fddc8] | 143 | <xsl:when test="$bomb-testsuite = 'n'">
|
---|
[056486c] | 144 | <xsl:value-of select="substring-before(string(),'make')"/>
|
---|
| 145 | <xsl:text>make -k</xsl:text>
|
---|
| 146 | <xsl:value-of select="substring-after(string(),'make')"/>
|
---|
| 147 | <xsl:text> >> $TEST_LOG 2>&1 || true
</xsl:text>
|
---|
| 148 | </xsl:when>
|
---|
| 149 | <xsl:otherwise>
|
---|
| 150 | <xsl:apply-templates/>
|
---|
[8946876] | 151 | <xsl:text> >> $TEST_LOG 2>&1</xsl:text>
|
---|
| 152 | <xsl:if test="contains(string(),' -k ')">
|
---|
| 153 | <xsl:text> || true</xsl:text>
|
---|
| 154 | </xsl:if>
|
---|
| 155 | <xsl:text>
</xsl:text>
|
---|
[056486c] | 156 | </xsl:otherwise>
|
---|
| 157 | </xsl:choose>
|
---|
[0170229] | 158 | </xsl:if>
|
---|
| 159 | </xsl:template>
|
---|
| 160 |
|
---|
| 161 | <xsl:template match="userinput" mode="screen">
|
---|
| 162 | <xsl:choose>
|
---|
| 163 | <!-- Estandarized package formats -->
|
---|
| 164 | <xsl:when test="contains(string(),'tar.gz')">
|
---|
| 165 | <xsl:value-of select="substring-before(string(),'tar.gz')"/>
|
---|
| 166 | <xsl:text>tar.*</xsl:text>
|
---|
| 167 | <xsl:value-of select="substring-after(string(),'tar.gz')"/>
|
---|
| 168 | <xsl:text>
</xsl:text>
|
---|
| 169 | </xsl:when>
|
---|
| 170 | <!-- Avoiding a race condition in a patch -->
|
---|
| 171 | <xsl:when test="contains(string(),'debian_fixes')">
|
---|
| 172 | <xsl:value-of select="substring-before(string(),'patch')"/>
|
---|
| 173 | <xsl:text>patch -Z</xsl:text>
|
---|
| 174 | <xsl:value-of select="substring-after(string(),'patch')"/>
|
---|
| 175 | <xsl:text>
</xsl:text>
|
---|
| 176 | </xsl:when>
|
---|
[d540567] | 177 | <!-- grsecurity kernel in the host? -->
|
---|
| 178 | <xsl:when test="ancestor::sect1[@id='ch-system-kernfs'] and
|
---|
| 179 | contains(string(),'sysctl')
|
---|
[47fddc8] | 180 | and $grsecurity_host ='n'"/>
|
---|
[174a8e9] | 181 | <!-- Setting $LC_ALL and $LANG for /etc/profile -->
|
---|
| 182 | <xsl:when test="ancestor::sect1[@id='bootable-profile'] and
|
---|
| 183 | contains(string(),'export LANG=')">
|
---|
| 184 | <xsl:value-of select="substring-before(string(),'export LC_ALL=')"/>
|
---|
[d87b293] | 185 | <xsl:text>export LC_ALL=</xsl:text>
|
---|
| 186 | <xsl:value-of select="$lc_all"/>
|
---|
| 187 | <xsl:text>
export LANG=</xsl:text>
|
---|
| 188 | <xsl:value-of select="$lang"/>
|
---|
| 189 | <xsl:text>
export INPUTRC</xsl:text>
|
---|
[174a8e9] | 190 | <xsl:value-of select="substring-after(string(),'INPUTRC')"/>
|
---|
| 191 | <xsl:text>
</xsl:text>
|
---|
| 192 | </xsl:when>
|
---|
[d540567] | 193 | <!-- Fixing bootscripts installation -->
|
---|
| 194 | <xsl:when test="ancestor::sect1[@id='bootable-bootscripts'] and
|
---|
| 195 | string() = 'make install'">
|
---|
| 196 | <xsl:text>make install
</xsl:text>
|
---|
| 197 | <xsl:text>cd ../blfs-bootscripts-&blfs-bootscripts-version;
</xsl:text>
|
---|
| 198 | </xsl:when>
|
---|
[ffd8c5a] | 199 | <!-- Compile the keymap into the kernel has been dissabled -->
|
---|
| 200 | <xsl:when test="contains(string(),'defkeymap')"/>
|
---|
[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>
|
---|
[056486c] | 223 | <xsl:if test="not(contains(string(),'check'))">
|
---|
| 224 | <xsl:apply-templates/>
|
---|
| 225 | <xsl:text>
</xsl:text>
|
---|
| 226 | </xsl:if>
|
---|
[e35e794] | 227 | <xsl:if test="contains(string(),'check')">
|
---|
[056486c] | 228 | <xsl:choose>
|
---|
[47fddc8] | 229 | <xsl:when test="$bomb-testsuite = 'n'">
|
---|
[056486c] | 230 | <xsl:value-of select="substring-before(string(),'check')"/>
|
---|
| 231 | <xsl:text>-k check</xsl:text>
|
---|
| 232 | <xsl:value-of select="substring-after(string(),'check')"/>
|
---|
| 233 | <xsl:text> >> $TEST_LOG 2>&1 || true
</xsl:text>
|
---|
| 234 | </xsl:when>
|
---|
| 235 | <xsl:otherwise>
|
---|
| 236 | <xsl:apply-templates/>
|
---|
[8946876] | 237 | <xsl:text> >> $TEST_LOG 2>&1</xsl:text>
|
---|
| 238 | <xsl:if test="contains(string(),' -k ')">
|
---|
| 239 | <xsl:text> || true</xsl:text>
|
---|
| 240 | </xsl:if>
|
---|
| 241 | <xsl:text>
</xsl:text>
|
---|
[056486c] | 242 | </xsl:otherwise>
|
---|
| 243 | </xsl:choose>
|
---|
[e35e794] | 244 | </xsl:if>
|
---|
| 245 | </xsl:otherwise>
|
---|
| 246 | </xsl:choose>
|
---|
| 247 | </xsl:when>
|
---|
[f83bcee] | 248 | <!-- Fixing butterfly toolchain test suites run -->
|
---|
[8946876] | 249 | <xsl:when test="string() = 'make -k check' or string() = 'make check'">
|
---|
[0170229] | 250 | <xsl:choose>
|
---|
[f83bcee] | 251 | <xsl:when test="$testsuite != '0'">
|
---|
[056486c] | 252 | <xsl:apply-templates/>
|
---|
| 253 | <xsl:choose>
|
---|
[47fddc8] | 254 | <xsl:when test="$bomb-testsuite = 'n'">
|
---|
[056486c] | 255 | <xsl:text> >> $TEST_LOG 2>&1 || true
</xsl:text>
|
---|
| 256 | </xsl:when>
|
---|
| 257 | <xsl:otherwise>
|
---|
[d0fa46b] | 258 | <xsl:text> >> $TEST_LOG 2>&1</xsl:text>
|
---|
[8946876] | 259 | <xsl:if test="contains(string(),' -k ')">
|
---|
| 260 | <xsl:text> || true</xsl:text>
|
---|
| 261 | </xsl:if>
|
---|
[d0fa46b] | 262 | <xsl:text>
</xsl:text>
|
---|
[056486c] | 263 | </xsl:otherwise>
|
---|
| 264 | </xsl:choose>
|
---|
[174a8e9] | 265 | </xsl:when>
|
---|
[0170229] | 266 | </xsl:choose>
|
---|
| 267 | </xsl:when>
|
---|
[f83bcee] | 268 | <!-- Fixing Glbc test suite -->
|
---|
| 269 | <xsl:when test="contains(string(),'glibc-check-log')">
|
---|
| 270 | <xsl:choose>
|
---|
| 271 | <xsl:when test="$testsuite != '0'">
|
---|
| 272 | <xsl:value-of select="substring-before(string(),'> glibc-')"/>
|
---|
[056486c] | 273 | <xsl:choose>
|
---|
[47fddc8] | 274 | <xsl:when test="$bomb-testsuite = 'n'">
|
---|
[056486c] | 275 | <xsl:text> >> $TEST_LOG 2>&1 || true
</xsl:text>
|
---|
| 276 | </xsl:when>
|
---|
| 277 | <xsl:otherwise>
|
---|
[8946876] | 278 | <xsl:text> >> $TEST_LOG 2>&1</xsl:text>
|
---|
| 279 | <xsl:if test="contains(string(),' -k ')">
|
---|
| 280 | <xsl:text> || true</xsl:text>
|
---|
| 281 | </xsl:if>
|
---|
| 282 | <xsl:text>
</xsl:text>
|
---|
[056486c] | 283 | </xsl:otherwise>
|
---|
| 284 | </xsl:choose>
|
---|
[f83bcee] | 285 | </xsl:when>
|
---|
| 286 | </xsl:choose>
|
---|
| 287 | </xsl:when>
|
---|
[d540567] | 288 | <!-- Don't stop on strip run and chapter05 GCC installation test-->
|
---|
| 289 | <xsl:when test="contains(string(),'strip ') or
|
---|
[ad71d98] | 290 | ancestor::sect2[@id='testing-gcc'] and
|
---|
| 291 | not(contains(string(),'EOF'))">
|
---|
[0170229] | 292 | <xsl:apply-templates/>
|
---|
| 293 | <xsl:text> || true
</xsl:text>
|
---|
| 294 | </xsl:when>
|
---|
| 295 | <!-- The rest of commands -->
|
---|
| 296 | <xsl:otherwise>
|
---|
| 297 | <xsl:apply-templates/>
|
---|
| 298 | <xsl:text>
</xsl:text>
|
---|
| 299 | </xsl:otherwise>
|
---|
| 300 | </xsl:choose>
|
---|
| 301 | </xsl:template>
|
---|
| 302 |
|
---|
[f83bcee] | 303 | <xsl:template match="literal">
|
---|
| 304 | <xsl:if test="@condition=$model or not(@condition)">
|
---|
| 305 | <xsl:apply-templates/>
|
---|
| 306 | </xsl:if>
|
---|
| 307 | </xsl:template>
|
---|
| 308 |
|
---|
[0170229] | 309 | <xsl:template match="replaceable">
|
---|
| 310 | <xsl:choose>
|
---|
[174a8e9] | 311 | <xsl:when test="ancestor::sect1[@id='ch-system-glibc'] or
|
---|
| 312 | ancestor::sect1[@id='ch-system-uclibc']">
|
---|
[ad71d98] | 313 | <xsl:value-of select="$timezone"/>
|
---|
[0170229] | 314 | </xsl:when>
|
---|
| 315 | <xsl:when test="ancestor::sect1[@id='ch-system-groff']">
|
---|
[ad71d98] | 316 | <xsl:value-of select="$page"/>
|
---|
[0170229] | 317 | </xsl:when>
|
---|
| 318 | <xsl:otherwise>
|
---|
| 319 | <xsl:text>**EDITME</xsl:text>
|
---|
| 320 | <xsl:apply-templates/>
|
---|
| 321 | <xsl:text>EDITME**</xsl:text>
|
---|
| 322 | </xsl:otherwise>
|
---|
| 323 | </xsl:choose>
|
---|
| 324 | </xsl:template>
|
---|
| 325 |
|
---|
| 326 | </xsl:stylesheet>
|
---|