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