[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? -->
|
---|
[401f81e] | 20 | <xsl:param name="grsecurity_host" select="n"/>
|
---|
[877cc6a] | 21 |
|
---|
| 22 | <!-- Run test suites?
|
---|
| 23 | 0 = none
|
---|
| 24 | 1 = only chapter06 Glibc, GCC and Binutils testsuites
|
---|
| 25 | 2 = all chapter06 testsuites
|
---|
[28f4756] | 26 | 3 = alias to 2
|
---|
| 27 | -->
|
---|
[877cc6a] | 28 | <xsl:param name="testsuite" select="1"/>
|
---|
| 29 |
|
---|
[28f4756] | 30 | <!-- Bomb on test suites failures?
|
---|
[401f81e] | 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
|
---|
[28f4756] | 33 | -->
|
---|
[401f81e] | 34 | <xsl:param name="bomb-testsuite" select="n"/>
|
---|
[28f4756] | 35 |
|
---|
[877cc6a] | 36 | <!-- Time zone -->
|
---|
[a229600] | 37 | <xsl:param name="timezone" select="GMT"/>
|
---|
[877cc6a] | 38 |
|
---|
| 39 | <!-- Page size -->
|
---|
| 40 | <xsl:param name="page" select="letter"/>
|
---|
| 41 |
|
---|
| 42 | <!-- Locale settings -->
|
---|
[a229600] | 43 | <xsl:param name="lang" select="C"/>
|
---|
| 44 | <xsl:param name="lc_all" select="C"/>
|
---|
[877cc6a] | 45 |
|
---|
| 46 | <xsl:template match="/">
|
---|
| 47 | <xsl:apply-templates select="//sect1"/>
|
---|
| 48 | </xsl:template>
|
---|
| 49 |
|
---|
| 50 | <xsl:template match="sect1">
|
---|
| 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']))">
|
---|
| 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">
|
---|
[5f4982d] | 86 | <xsl:text>#!/bin/bash
set +h
</xsl:text>
|
---|
| 87 | <xsl:if test="not(@id='ch-tools-stripping') and
|
---|
| 88 | not(@id='ch-system-strippingagain')">
|
---|
| 89 | <xsl:text>set -e
</xsl:text>
|
---|
| 90 | </xsl:if>
|
---|
| 91 | <xsl:text>
</xsl:text>
|
---|
[877cc6a] | 92 | <xsl:if test="(sect2[@role='installation'] and
|
---|
[d81c640] | 93 | not(@id='bootable-kernel'))">
|
---|
[877cc6a] | 94 | <xsl:text>cd $PKGDIR
</xsl:text>
|
---|
[5e83595] | 95 | <xsl:if test="@id='ch-system-uclibc'">
|
---|
[877cc6a] | 96 | <xsl:text>pushd ../; tar -xvf gettext-&gettext-version;.*; popd; 
</xsl:text>
|
---|
| 97 | </xsl:if>
|
---|
[d81c640] | 98 |
|
---|
[4d15d7f] | 99 | <!-- SVN toolchain format, from inside ./sources dir unpack binutils and gcc -->
|
---|
[d81c640] | 100 | <xsl:if test="@id='ch-tools-embryo-toolchain' or
|
---|
| 101 | @id='ch-tools-cocoon-toolchain' or
|
---|
| 102 | @id='ch-system-butterfly-toolchain'">
|
---|
| 103 | <xsl:text>tar -xvf gcc-core-&gcc-version;.*; 
</xsl:text>
|
---|
| 104 | <xsl:text>tar -xvf binutils-&binutils-version;.*; 
</xsl:text>
|
---|
[877cc6a] | 105 | </xsl:if>
|
---|
[30d1215] | 106 | <xsl:if test="@id='ch-tools-cocoon-toolchain' or
|
---|
| 107 | @id='ch-system-butterfly-toolchain'">
|
---|
| 108 | <xsl:text>tar -xvf gcc-g++-&gcc-version;.*; 
</xsl:text>
|
---|
| 109 | </xsl:if>
|
---|
[d81c640] | 110 | <!-- ONLY butterfly has a testsuite -->
|
---|
[b2489fb] | 111 | <xsl:if test="@id='ch-system-butterfly-toolchain' and $testsuite != '0'">
|
---|
[d81c640] | 112 | <xsl:text>tar -xvf gcc-testsuite-&gcc-version;.*; 
</xsl:text>
|
---|
[877cc6a] | 113 | </xsl:if>
|
---|
[4d15d7f] | 114 | <!-- END SVN toolchain format -->
|
---|
| 115 |
|
---|
| 116 | <!-- 2.4-branch toolchain -->
|
---|
| 117 | <xsl:if test="@id='ch-tools-gcc-pass2' or @id='ch-system-gcc'">
|
---|
| 118 | <xsl:text>pushd ../; tar -xvf gcc-g++-&gcc-version;.*; popd; 
</xsl:text>
|
---|
| 119 | </xsl:if>
|
---|
| 120 | <xsl:if test="@id='ch-system-gcc' and $testsuite != '0'">
|
---|
| 121 | <xsl:text>pushd ../; tar -xvf gcc-testsuite-&gcc-version;.*; popd; 
</xsl:text>
|
---|
| 122 | </xsl:if>
|
---|
| 123 | <!-- END 2.4-branch toolchain -->
|
---|
[d81c640] | 124 |
|
---|
[877cc6a] | 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 |
|
---|
| 135 | <xsl:template match="screen">
|
---|
| 136 | <xsl:if test="(@condition=$model or not(@condition)) and
|
---|
| 137 | child::* = userinput and not(@role = 'nodump')">
|
---|
| 138 | <xsl:apply-templates select="userinput" mode="screen"/>
|
---|
| 139 | </xsl:if>
|
---|
| 140 | </xsl:template>
|
---|
| 141 |
|
---|
| 142 | <xsl:template match="para/userinput">
|
---|
| 143 | <xsl:if test="(contains(string(),'test') or
|
---|
[d81c640] | 144 | contains(string(),'check')) and
|
---|
| 145 | ($testsuite = '2' or $testsuite = '3')">
|
---|
[28f4756] | 146 | <xsl:choose>
|
---|
[401f81e] | 147 | <xsl:when test="$bomb-testsuite = 'n'">
|
---|
[28f4756] | 148 | <xsl:value-of select="substring-before(string(),'make')"/>
|
---|
| 149 | <xsl:text>make -k</xsl:text>
|
---|
| 150 | <xsl:value-of select="substring-after(string(),'make')"/>
|
---|
| 151 | <xsl:text> >> $TEST_LOG 2>&1 || true
</xsl:text>
|
---|
| 152 | </xsl:when>
|
---|
| 153 | <xsl:otherwise>
|
---|
| 154 | <xsl:apply-templates/>
|
---|
[a1f1969] | 155 | <xsl:text> >> $TEST_LOG 2>&1</xsl:text>
|
---|
| 156 | <xsl:if test="contains(string(),' -k ')">
|
---|
| 157 | <xsl:text> || true</xsl:text>
|
---|
| 158 | </xsl:if>
|
---|
| 159 | <xsl:text>
</xsl:text>
|
---|
[28f4756] | 160 | </xsl:otherwise>
|
---|
| 161 | </xsl:choose>
|
---|
[877cc6a] | 162 | </xsl:if>
|
---|
| 163 | </xsl:template>
|
---|
| 164 |
|
---|
| 165 | <xsl:template match="userinput" mode="screen">
|
---|
| 166 | <xsl:choose>
|
---|
| 167 | <!-- Estandarized package formats -->
|
---|
| 168 | <xsl:when test="contains(string(),'tar.gz')">
|
---|
| 169 | <xsl:value-of select="substring-before(string(),'tar.gz')"/>
|
---|
| 170 | <xsl:text>tar.*</xsl:text>
|
---|
| 171 | <xsl:value-of select="substring-after(string(),'tar.gz')"/>
|
---|
| 172 | <xsl:text>
</xsl:text>
|
---|
| 173 | </xsl:when>
|
---|
| 174 | <!-- grsecurity kernel in the host? -->
|
---|
| 175 | <xsl:when test="ancestor::sect1[@id='ch-system-kernfs'] and
|
---|
| 176 | contains(string(),'sysctl')
|
---|
[401f81e] | 177 | and $grsecurity_host ='n'"/>
|
---|
[4d15d7f] | 178 | <!-- Fix MAKEDEV installation in 2.4-branch -->
|
---|
| 179 | <xsl:when test="ancestor::sect1[@id='ch-system-devices'] and
|
---|
| 180 | contains(string(),'bzcat MAKEDEV')">
|
---|
| 181 | <xsl:text>bzcat /sources/</xsl:text>
|
---|
| 182 | <xsl:value-of select="substring-after(string(),'bzcat ')"/>
|
---|
| 183 | <xsl:text>
</xsl:text>
|
---|
| 184 | </xsl:when>
|
---|
[877cc6a] | 185 | <!-- Setting $LC_ALL and $LANG for /etc/profile -->
|
---|
| 186 | <xsl:when test="ancestor::sect1[@id='bootable-profile'] and
|
---|
| 187 | contains(string(),'export LANG=')">
|
---|
| 188 | <xsl:value-of select="substring-before(string(),'export LC_ALL=')"/>
|
---|
| 189 | <xsl:text>export LC_ALL=</xsl:text>
|
---|
| 190 | <xsl:value-of select="$lc_all"/>
|
---|
| 191 | <xsl:text>
export LANG=</xsl:text>
|
---|
| 192 | <xsl:value-of select="$lang"/>
|
---|
| 193 | <xsl:text>
export INPUTRC</xsl:text>
|
---|
| 194 | <xsl:value-of select="substring-after(string(),'INPUTRC')"/>
|
---|
| 195 | <xsl:text>
</xsl:text>
|
---|
| 196 | </xsl:when>
|
---|
| 197 | <!-- Fixing bootscripts installation -->
|
---|
| 198 | <xsl:when test="ancestor::sect1[@id='bootable-bootscripts'] and
|
---|
| 199 | string() = 'make install'">
|
---|
| 200 | <xsl:text>make install
</xsl:text>
|
---|
| 201 | <xsl:text>cd ../blfs-bootscripts-&blfs-bootscripts-version;
</xsl:text>
|
---|
| 202 | </xsl:when>
|
---|
[f4caf9c] | 203 | <!-- Compile the keymap into the kernel has been dissabled -->
|
---|
| 204 | <xsl:when test="contains(string(),'defkeymap')"/>
|
---|
[877cc6a] | 205 | <!-- Copying the kernel config file -->
|
---|
| 206 | <xsl:when test="string() = 'make mrproper'">
|
---|
| 207 | <xsl:text>make mrproper
</xsl:text>
|
---|
| 208 | <xsl:text>cp -v /sources/kernel-config .config
</xsl:text>
|
---|
| 209 | </xsl:when>
|
---|
| 210 | <!-- No interactive commands are needed if the .config file is the proper one -->
|
---|
| 211 | <xsl:when test="string() = 'make menuconfig'"/>
|
---|
| 212 | <!-- For uClibc we need to cd to the Gettext package -->
|
---|
| 213 | <xsl:when test="contains(string(),'cd gettext-runtime/')">
|
---|
| 214 | <xsl:text>cd ../gettext-*/gettext-runtime</xsl:text>
|
---|
| 215 | <xsl:value-of select="substring-after(string(),'gettext-runtime')"/>
|
---|
| 216 | <xsl:text>
</xsl:text>
|
---|
| 217 | </xsl:when>
|
---|
| 218 | <!-- The Coreutils and Module-Init-Tools test suites are optional -->
|
---|
[a229600] | 219 | <xsl:when test="(ancestor::sect1[@id='ch-system-coreutils'] or
|
---|
[877cc6a] | 220 | ancestor::sect1[@id='ch-system-module-init-tools']) and
|
---|
| 221 | (contains(string(),'check') or
|
---|
| 222 | contains(string(),'distclean') or
|
---|
[a229600] | 223 | contains(string(),'dummy'))">
|
---|
| 224 | <xsl:choose>
|
---|
| 225 | <xsl:when test="$testsuite = '0' or $testsuite = '1'"/>
|
---|
| 226 | <xsl:otherwise>
|
---|
[28f4756] | 227 | <xsl:if test="not(contains(string(),'check'))">
|
---|
| 228 | <xsl:apply-templates/>
|
---|
| 229 | <xsl:text>
</xsl:text>
|
---|
| 230 | </xsl:if>
|
---|
[a229600] | 231 | <xsl:if test="contains(string(),'check')">
|
---|
[28f4756] | 232 | <xsl:choose>
|
---|
[401f81e] | 233 | <xsl:when test="$bomb-testsuite = 'n'">
|
---|
[28f4756] | 234 | <xsl:value-of select="substring-before(string(),'check')"/>
|
---|
| 235 | <xsl:text>-k check</xsl:text>
|
---|
| 236 | <xsl:value-of select="substring-after(string(),'check')"/>
|
---|
| 237 | <xsl:text> >> $TEST_LOG 2>&1 || true
</xsl:text>
|
---|
| 238 | </xsl:when>
|
---|
| 239 | <xsl:otherwise>
|
---|
| 240 | <xsl:apply-templates/>
|
---|
[a1f1969] | 241 | <xsl:text> >> $TEST_LOG 2>&1</xsl:text>
|
---|
| 242 | <xsl:if test="contains(string(),' -k ')">
|
---|
| 243 | <xsl:text> || true</xsl:text>
|
---|
| 244 | </xsl:if>
|
---|
| 245 | <xsl:text>
</xsl:text>
|
---|
[28f4756] | 246 | </xsl:otherwise>
|
---|
| 247 | </xsl:choose>
|
---|
[a229600] | 248 | </xsl:if>
|
---|
| 249 | </xsl:otherwise>
|
---|
| 250 | </xsl:choose>
|
---|
| 251 | </xsl:when>
|
---|
[4d15d7f] | 252 | <!-- Fixing butterfly and 2.4-branch toolchain plus other packages test suites run -->
|
---|
[ff43bb8] | 253 | <xsl:when test="string() = 'make -k check'
|
---|
| 254 | or string() = 'make check'
|
---|
| 255 | or string() = 'make tests'">
|
---|
[877cc6a] | 256 | <xsl:choose>
|
---|
[4d15d7f] | 257 | <xsl:when test="((ancestor::sect1[@id='ch-system-butterfly-toolchain']
|
---|
| 258 | or ancestor::sect1[@id='ch-system-gcc'] or
|
---|
| 259 | ancestor::sect1[@id='ch-system-binutils'])
|
---|
[ff43bb8] | 260 | and $testsuite != '0') or
|
---|
| 261 | $testsuite = '2' or $testsuite = '3'">
|
---|
[28f4756] | 262 | <xsl:choose>
|
---|
[401f81e] | 263 | <xsl:when test="$bomb-testsuite = 'n'">
|
---|
[ff43bb8] | 264 | <xsl:text>make -k check >> $TEST_LOG 2>&1 || true
</xsl:text>
|
---|
[28f4756] | 265 | </xsl:when>
|
---|
| 266 | <xsl:otherwise>
|
---|
[ff43bb8] | 267 | <xsl:apply-templates/>
|
---|
[f98695c] | 268 | <xsl:text> >> $TEST_LOG 2>&1</xsl:text>
|
---|
[a1f1969] | 269 | <xsl:if test="contains(string(),' -k ')">
|
---|
| 270 | <xsl:text> || true</xsl:text>
|
---|
| 271 | </xsl:if>
|
---|
[f98695c] | 272 | <xsl:text>
</xsl:text>
|
---|
[28f4756] | 273 | </xsl:otherwise>
|
---|
| 274 | </xsl:choose>
|
---|
[877cc6a] | 275 | </xsl:when>
|
---|
| 276 | </xsl:choose>
|
---|
| 277 | </xsl:when>
|
---|
[d81c640] | 278 | <!-- Fixing Glbc test suite -->
|
---|
| 279 | <xsl:when test="contains(string(),'glibc-check-log')">
|
---|
[877cc6a] | 280 | <xsl:choose>
|
---|
| 281 | <xsl:when test="$testsuite != '0'">
|
---|
[ff43bb8] | 282 | <xsl:value-of select="substring-before(string(),'2>&1')"/>
|
---|
| 283 | <xsl:text>>> $TEST_LOG 2>&1 || true
</xsl:text>
|
---|
[877cc6a] | 284 | </xsl:when>
|
---|
| 285 | </xsl:choose>
|
---|
| 286 | </xsl:when>
|
---|
[ff43bb8] | 287 | <!-- Don't stop on strip run -->
|
---|
[85077e7] | 288 | <xsl:when test="contains(string(),'strip ')">
|
---|
[877cc6a] | 289 | <xsl:apply-templates/>
|
---|
| 290 | <xsl:text> || true
</xsl:text>
|
---|
| 291 | </xsl:when>
|
---|
| 292 | <!-- The rest of commands -->
|
---|
| 293 | <xsl:otherwise>
|
---|
| 294 | <xsl:apply-templates/>
|
---|
| 295 | <xsl:text>
</xsl:text>
|
---|
| 296 | </xsl:otherwise>
|
---|
| 297 | </xsl:choose>
|
---|
| 298 | </xsl:template>
|
---|
| 299 |
|
---|
[d81c640] | 300 | <xsl:template match="literal">
|
---|
| 301 | <xsl:if test="@condition=$model or not(@condition)">
|
---|
| 302 | <xsl:apply-templates/>
|
---|
| 303 | </xsl:if>
|
---|
| 304 | </xsl:template>
|
---|
| 305 |
|
---|
[877cc6a] | 306 | <xsl:template match="replaceable">
|
---|
| 307 | <xsl:choose>
|
---|
| 308 | <xsl:when test="ancestor::sect1[@id='ch-system-glibc'] or
|
---|
| 309 | ancestor::sect1[@id='ch-system-uclibc']">
|
---|
| 310 | <xsl:value-of select="$timezone"/>
|
---|
| 311 | </xsl:when>
|
---|
| 312 | <xsl:when test="ancestor::sect1[@id='ch-system-groff']">
|
---|
| 313 | <xsl:value-of select="$page"/>
|
---|
| 314 | </xsl:when>
|
---|
| 315 | <xsl:otherwise>
|
---|
| 316 | <xsl:text>**EDITME</xsl:text>
|
---|
| 317 | <xsl:apply-templates/>
|
---|
| 318 | <xsl:text>EDITME**</xsl:text>
|
---|
| 319 | </xsl:otherwise>
|
---|
| 320 | </xsl:choose>
|
---|
| 321 | </xsl:template>
|
---|
| 322 |
|
---|
| 323 | </xsl:stylesheet>
|
---|