[a9490ab] | 1 | <?xml version="1.0"?>
|
---|
[e676ffa] | 2 | <!DOCTYPE xsl:stylesheet [
|
---|
| 3 | <!ENTITY % general-entities SYSTEM "FAKEDIR/general.ent">
|
---|
| 4 | %general-entities;
|
---|
| 5 | ]>
|
---|
| 6 |
|
---|
| 7 | <!-- $Id$ -->
|
---|
| 8 |
|
---|
[a9490ab] | 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 |
|
---|
[e676ffa] | 14 | <!-- XSLT stylesheet to create shell scripts from CLFS books. -->
|
---|
| 15 |
|
---|
| 16 | <!-- Build method used -->
|
---|
| 17 | <xsl:param name="method" select="chroot"/>
|
---|
| 18 |
|
---|
| 19 | <!-- Run test suites?
|
---|
| 20 | 0 = none
|
---|
| 21 | 1 = only Glibc, GCC and Binutils testsuites
|
---|
| 22 | 2 = all testsuites
|
---|
[056486c] | 23 | 3 = alias to 2
|
---|
| 24 | -->
|
---|
[e676ffa] | 25 | <xsl:param name="testsuite" select="1"/>
|
---|
| 26 |
|
---|
[056486c] | 27 | <!-- Bomb on test suites failures?
|
---|
[47fddc8] | 28 | n = no, I want to build the full system and review the logs
|
---|
| 29 | y = yes, bomb at the first test suite failure to can review the build dir
|
---|
[056486c] | 30 | -->
|
---|
[47fddc8] | 31 | <xsl:param name="bomb-testsuite" select="n"/>
|
---|
[056486c] | 32 |
|
---|
[e676ffa] | 33 | <!-- Install vim-lang package? -->
|
---|
[47fddc8] | 34 | <xsl:param name="vim-lang" select="y"/>
|
---|
[e676ffa] | 35 |
|
---|
| 36 | <!-- Time zone -->
|
---|
[e35e794] | 37 | <xsl:param name="timezone" select="GMT"/>
|
---|
[e676ffa] | 38 |
|
---|
| 39 | <!-- Page size -->
|
---|
| 40 | <xsl:param name="page" select="letter"/>
|
---|
| 41 |
|
---|
| 42 | <!-- Locale settings -->
|
---|
[e35e794] | 43 | <xsl:param name="lang" select="C"/>
|
---|
[a9490ab] | 44 |
|
---|
[9c9775f] | 45 | <!-- Sparc64 processor type -->
|
---|
| 46 | <xsl:param name="sparc" select="none"/>
|
---|
| 47 |
|
---|
[a9490ab] | 48 | <xsl:template match="/">
|
---|
| 49 | <xsl:apply-templates select="//sect1"/>
|
---|
| 50 | </xsl:template>
|
---|
| 51 |
|
---|
| 52 | <xsl:template match="sect1">
|
---|
[e676ffa] | 53 | <xsl:choose>
|
---|
| 54 | <xsl:when test="../@id='chapter-partitioning' or
|
---|
| 55 | ../@id='chapter-getting-materials' or
|
---|
| 56 | ../@id='chapter-final-preps'"/>
|
---|
| 57 | <xsl:when test="../@id='chapter-testsuite-tools' and $testsuite='0'"/>
|
---|
| 58 | <xsl:when test="../@id='chapter-boot' and $method='chroot'"/>
|
---|
| 59 | <xsl:when test="../@id='chapter-chroot' and $method='boot'"/>
|
---|
| 60 | <xsl:otherwise>
|
---|
| 61 | <xsl:if test="count(descendant::screen/userinput) > 0 and
|
---|
| 62 | count(descendant::screen/userinput) >
|
---|
| 63 | count(descendant::screen[@role='nodump'])">
|
---|
| 64 | <!-- The dirs names -->
|
---|
| 65 | <xsl:variable name="pi-dir" select="../processing-instruction('dbhtml')"/>
|
---|
| 66 | <xsl:variable name="pi-dir-value" select="substring-after($pi-dir,'dir=')"/>
|
---|
| 67 | <xsl:variable name="quote-dir" select="substring($pi-dir-value,1,1)"/>
|
---|
| 68 | <xsl:variable name="dirname" select="substring-before(substring($pi-dir-value,2),$quote-dir)"/>
|
---|
| 69 | <!-- The file names -->
|
---|
| 70 | <xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/>
|
---|
| 71 | <xsl:variable name="pi-file-value" select="substring-after($pi-file,'filename=')"/>
|
---|
| 72 | <xsl:variable name="filename" select="substring-before(substring($pi-file-value,2),'.html')"/>
|
---|
| 73 | <!-- The build order -->
|
---|
| 74 | <xsl:variable name="position" select="position()"/>
|
---|
| 75 | <xsl:variable name="order">
|
---|
| 76 | <xsl:choose>
|
---|
| 77 | <xsl:when test="string-length($position) = 1">
|
---|
| 78 | <xsl:text>00</xsl:text>
|
---|
| 79 | <xsl:value-of select="$position"/>
|
---|
| 80 | </xsl:when>
|
---|
| 81 | <xsl:when test="string-length($position) = 2">
|
---|
| 82 | <xsl:text>0</xsl:text>
|
---|
| 83 | <xsl:value-of select="$position"/>
|
---|
| 84 | </xsl:when>
|
---|
| 85 | <xsl:otherwise>
|
---|
| 86 | <xsl:value-of select="$position"/>
|
---|
| 87 | </xsl:otherwise>
|
---|
| 88 | </xsl:choose>
|
---|
| 89 | </xsl:variable>
|
---|
| 90 | <!-- Creating dirs and files -->
|
---|
| 91 | <exsl:document href="{$dirname}/{$order}-{$filename}" method="text">
|
---|
| 92 | <xsl:choose>
|
---|
[9c9775f] | 93 | <xsl:when test="@id='ch-chroot-changingowner' or
|
---|
| 94 | @id='ch-chroot-creatingdirs' or
|
---|
| 95 | @id='ch-chroot-createfiles' or
|
---|
| 96 | @id='ch-system-stripping'">
|
---|
| 97 | <xsl:text>#!/tools/bin/bash
set +h
</xsl:text>
|
---|
[e676ffa] | 98 | </xsl:when>
|
---|
| 99 | <xsl:otherwise>
|
---|
[9c9775f] | 100 | <xsl:text>#!/bin/bash
set +h
</xsl:text>
|
---|
[e676ffa] | 101 | </xsl:otherwise>
|
---|
| 102 | </xsl:choose>
|
---|
[9c9775f] | 103 | <xsl:if test="not(@id='ch-system-stripping')">
|
---|
| 104 | <xsl:text>set -e</xsl:text>
|
---|
| 105 | </xsl:if>
|
---|
| 106 | <xsl:text>
</xsl:text>
|
---|
| 107 | <xsl:if test="sect2[@role='installation'] and
|
---|
| 108 | not(@id='ch-system-multiarch-wrapper')">
|
---|
[e676ffa] | 109 | <xsl:text>cd $PKGDIR
</xsl:text>
|
---|
[47fddc8] | 110 | <xsl:if test="@id='ch-system-vim' and $vim-lang = 'y'">
|
---|
[e676ffa] | 111 | <xsl:text>tar -xvf ../vim-&vim-version;-lang.* --strip-components=1
</xsl:text>
|
---|
| 112 | </xsl:if>
|
---|
| 113 | </xsl:if>
|
---|
| 114 | <xsl:apply-templates select=".//para/userinput | .//screen"/>
|
---|
[9c9775f] | 115 | <xsl:if test="not(@id='ch-chroot-chroot')">
|
---|
| 116 | <xsl:text>echo -e "\n\nTotalseconds: $SECONDS\n"
</xsl:text>
|
---|
| 117 | </xsl:if>
|
---|
[e676ffa] | 118 | <xsl:text>exit</xsl:text>
|
---|
| 119 | </exsl:document>
|
---|
| 120 | </xsl:if>
|
---|
| 121 | </xsl:otherwise>
|
---|
| 122 | </xsl:choose>
|
---|
[a9490ab] | 123 | </xsl:template>
|
---|
| 124 |
|
---|
| 125 | <xsl:template match="screen">
|
---|
[e676ffa] | 126 | <xsl:if test="child::* = userinput and not(@role = 'nodump')">
|
---|
| 127 | <xsl:apply-templates select="userinput" mode="screen"/>
|
---|
[a9490ab] | 128 | </xsl:if>
|
---|
| 129 | </xsl:template>
|
---|
| 130 |
|
---|
[e676ffa] | 131 | <xsl:template match="para/userinput">
|
---|
| 132 | <xsl:if test="(contains(string(),'test') or
|
---|
| 133 | contains(string(),'check')) and
|
---|
| 134 | ($testsuite = '2' or $testsuite = '3')">
|
---|
[056486c] | 135 | <xsl:choose>
|
---|
[47fddc8] | 136 | <xsl:when test="$bomb-testsuite = 'n'">
|
---|
[056486c] | 137 | <xsl:value-of select="substring-before(string(),'make')"/>
|
---|
| 138 | <xsl:text>make -k</xsl:text>
|
---|
| 139 | <xsl:value-of select="substring-after(string(),'make')"/>
|
---|
| 140 | <xsl:text> >> $TEST_LOG 2>&1 || true
</xsl:text>
|
---|
| 141 | </xsl:when>
|
---|
| 142 | <xsl:otherwise>
|
---|
| 143 | <xsl:apply-templates/>
|
---|
[8946876] | 144 | <xsl:text> >> $TEST_LOG 2>&1</xsl:text>
|
---|
| 145 | <xsl:if test="contains(string(),' -k ')">
|
---|
| 146 | <xsl:text> || true</xsl:text>
|
---|
| 147 | </xsl:if>
|
---|
| 148 | <xsl:text>
</xsl:text>
|
---|
[056486c] | 149 | </xsl:otherwise>
|
---|
| 150 | </xsl:choose>
|
---|
[a9490ab] | 151 | </xsl:if>
|
---|
[e676ffa] | 152 | </xsl:template>
|
---|
| 153 |
|
---|
| 154 | <xsl:template match="userinput" mode="screen">
|
---|
| 155 | <xsl:choose>
|
---|
| 156 | <!-- Estandarized package formats -->
|
---|
| 157 | <xsl:when test="contains(string(),'tar.gz')">
|
---|
| 158 | <xsl:value-of select="substring-before(string(),'tar.gz')"/>
|
---|
| 159 | <xsl:text>tar.*</xsl:text>
|
---|
| 160 | <xsl:value-of select="substring-after(string(),'tar.gz')"/>
|
---|
| 161 | <xsl:text>
</xsl:text>
|
---|
| 162 | </xsl:when>
|
---|
| 163 | <!-- Setting $LANG for /etc/profile -->
|
---|
| 164 | <xsl:when test="ancestor::sect1[@id='ch-scripts-profile'] and
|
---|
| 165 | contains(string(),'export LANG=')">
|
---|
| 166 | <xsl:value-of select="substring-before(string(),'export LANG=')"/>
|
---|
| 167 | <xsl:text>export LANG=</xsl:text>
|
---|
| 168 | <xsl:value-of select="$lang"/>
|
---|
[62033d2] | 169 | <xsl:value-of select="substring-after(string(),'charmap]')"/>
|
---|
[e676ffa] | 170 | <xsl:text>
</xsl:text>
|
---|
| 171 | </xsl:when>
|
---|
[ffd8c5a] | 172 | <!-- Compile the keymap into the kernel has been disabled for 1.0 -->
|
---|
| 173 | <xsl:when test="contains(string(),'defkeymap')"/>
|
---|
[e676ffa] | 174 | <!-- Copying the kernel config file -->
|
---|
| 175 | <xsl:when test="string() = 'make mrproper'">
|
---|
| 176 | <xsl:text>make mrproper
</xsl:text>
|
---|
| 177 | <xsl:if test="ancestor::sect1[@id='ch-boot-kernel']">
|
---|
| 178 | <xsl:text>cp -v ../bootkernel-config .config
</xsl:text>
|
---|
| 179 | </xsl:if>
|
---|
| 180 | <xsl:if test="ancestor::sect1[@id='ch-bootable-kernel']">
|
---|
| 181 | <xsl:text>cp -v ../kernel-config .config
</xsl:text>
|
---|
| 182 | </xsl:if>
|
---|
| 183 | </xsl:when>
|
---|
[9a4f673] | 184 | <!-- No interactive commands are needed if the .config file is the proper one -->
|
---|
| 185 | <xsl:when test="contains(string(),'menuconfig')"/>
|
---|
[e676ffa] | 186 | <!-- The Coreutils and Module-Init-Tools test suites are optional -->
|
---|
[e35e794] | 187 | <xsl:when test="(ancestor::sect1[@id='ch-system-coreutils'] or
|
---|
[e676ffa] | 188 | ancestor::sect1[@id='ch-system-module-init-tools']) and
|
---|
| 189 | (contains(string(),'check') or
|
---|
[e35e794] | 190 | contains(string(),'dummy'))">
|
---|
| 191 | <xsl:choose>
|
---|
| 192 | <xsl:when test="$testsuite = '0' or $testsuite = '1'"/>
|
---|
| 193 | <xsl:otherwise>
|
---|
[056486c] | 194 | <xsl:if test="not(contains(string(),'check'))">
|
---|
| 195 | <xsl:apply-templates/>
|
---|
| 196 | <xsl:text>
</xsl:text>
|
---|
| 197 | </xsl:if>
|
---|
[e35e794] | 198 | <xsl:if test="contains(string(),'check')">
|
---|
[056486c] | 199 | <xsl:choose>
|
---|
[47fddc8] | 200 | <xsl:when test="$bomb-testsuite = 'n'">
|
---|
[056486c] | 201 | <xsl:value-of select="substring-before(string(),'check')"/>
|
---|
| 202 | <xsl:text>-k check</xsl:text>
|
---|
| 203 | <xsl:value-of select="substring-after(string(),'check')"/>
|
---|
| 204 | <xsl:text> >> $TEST_LOG 2>&1 || true
</xsl:text>
|
---|
| 205 | </xsl:when>
|
---|
| 206 | <xsl:otherwise>
|
---|
| 207 | <xsl:apply-templates/>
|
---|
[0044289] | 208 | <xsl:text> >> $TEST_LOG 2>&1</xsl:text>
|
---|
[8946876] | 209 | <xsl:if test="contains(string(),' -k ')">
|
---|
| 210 | <xsl:text> || true</xsl:text>
|
---|
| 211 | </xsl:if>
|
---|
[4aede02] | 212 | <xsl:text>
</xsl:text>
|
---|
[056486c] | 213 | </xsl:otherwise>
|
---|
| 214 | </xsl:choose>
|
---|
[e35e794] | 215 | </xsl:if>
|
---|
| 216 | </xsl:otherwise>
|
---|
| 217 | </xsl:choose>
|
---|
| 218 | </xsl:when>
|
---|
[e676ffa] | 219 | <!-- Fixing toolchain test suites run -->
|
---|
| 220 | <xsl:when test="string() = 'make check' or
|
---|
| 221 | string() = 'make -k check'">
|
---|
| 222 | <xsl:choose>
|
---|
| 223 | <xsl:when test="$testsuite != '0'">
|
---|
[056486c] | 224 | <xsl:choose>
|
---|
[47fddc8] | 225 | <xsl:when test="$bomb-testsuite = 'n'">
|
---|
[056486c] | 226 | <xsl:text>make -k check >> $TEST_LOG 2>&1 || true
</xsl:text>
|
---|
| 227 | </xsl:when>
|
---|
| 228 | <xsl:otherwise>
|
---|
| 229 | <xsl:apply-templates/>
|
---|
[8946876] | 230 | <xsl:text> >> $TEST_LOG 2>&1</xsl:text>
|
---|
| 231 | <xsl:if test="contains(string(),' -k ')">
|
---|
| 232 | <xsl:text> || true</xsl:text>
|
---|
| 233 | </xsl:if>
|
---|
| 234 | <xsl:text>
</xsl:text>
|
---|
[056486c] | 235 | </xsl:otherwise>
|
---|
| 236 | </xsl:choose>
|
---|
[e676ffa] | 237 | </xsl:when>
|
---|
| 238 | </xsl:choose>
|
---|
| 239 | </xsl:when>
|
---|
| 240 | <xsl:when test="contains(string(),'glibc-check-log')">
|
---|
| 241 | <xsl:choose>
|
---|
| 242 | <xsl:when test="$testsuite != '0'">
|
---|
[e35e794] | 243 | <xsl:value-of select="substring-before(string(),'>g')"/>
|
---|
[056486c] | 244 | <xsl:choose>
|
---|
[47fddc8] | 245 | <xsl:when test="$bomb-testsuite = 'n'">
|
---|
[056486c] | 246 | <xsl:text>>> $TEST_LOG 2>&1 || true
</xsl:text>
|
---|
| 247 | </xsl:when>
|
---|
| 248 | <xsl:otherwise>
|
---|
[8946876] | 249 | <xsl:text>>> $TEST_LOG 2>&1</xsl:text>
|
---|
| 250 | <xsl:if test="contains(string(),' -k ')">
|
---|
| 251 | <xsl:text> || true</xsl:text>
|
---|
| 252 | </xsl:if>
|
---|
| 253 | <xsl:text>
</xsl:text>
|
---|
[056486c] | 254 | </xsl:otherwise>
|
---|
| 255 | </xsl:choose>
|
---|
[e676ffa] | 256 | </xsl:when>
|
---|
| 257 | </xsl:choose>
|
---|
| 258 | </xsl:when>
|
---|
| 259 | <xsl:when test="contains(string(),'test_summary') or
|
---|
| 260 | contains(string(),'expect -c')">
|
---|
| 261 | <xsl:choose>
|
---|
| 262 | <xsl:when test="$testsuite != '0'">
|
---|
| 263 | <xsl:apply-templates/>
|
---|
[056486c] | 264 | <xsl:text> >> $TEST_LOG
</xsl:text>
|
---|
[e676ffa] | 265 | </xsl:when>
|
---|
| 266 | </xsl:choose>
|
---|
| 267 | </xsl:when>
|
---|
| 268 | <!-- Don't stop on strip run -->
|
---|
| 269 | <xsl:when test="contains(string(),'strip ')">
|
---|
| 270 | <xsl:apply-templates/>
|
---|
| 271 | <xsl:text> || true
</xsl:text>
|
---|
| 272 | </xsl:when>
|
---|
| 273 | <!-- The rest of commands -->
|
---|
| 274 | <xsl:otherwise>
|
---|
| 275 | <xsl:apply-templates/>
|
---|
| 276 | <xsl:text>
</xsl:text>
|
---|
| 277 | </xsl:otherwise>
|
---|
| 278 | </xsl:choose>
|
---|
[a9490ab] | 279 | </xsl:template>
|
---|
| 280 |
|
---|
| 281 | <xsl:template match="replaceable">
|
---|
[e676ffa] | 282 | <xsl:choose>
|
---|
| 283 | <xsl:when test="ancestor::sect1[@id='ch-system-glibc']">
|
---|
| 284 | <xsl:value-of select="$timezone"/>
|
---|
| 285 | </xsl:when>
|
---|
| 286 | <xsl:when test="ancestor::sect1[@id='ch-system-groff']">
|
---|
| 287 | <xsl:value-of select="$page"/>
|
---|
| 288 | </xsl:when>
|
---|
[9c9775f] | 289 | <xsl:when test="ancestor::sect1[@id='ch-cross-tools-flags']">
|
---|
| 290 | <xsl:choose>
|
---|
| 291 | <xsl:when test="contains(string(),'BUILD32')">
|
---|
| 292 | <xsl:choose>
|
---|
| 293 | <xsl:when test="$sparc = '1' or $sparc = '2'">
|
---|
| 294 | <xsl:text>-m32 -mcpu=ultrasparc -mtune=ultrasparc</xsl:text>
|
---|
| 295 | </xsl:when>
|
---|
| 296 | <xsl:when test="$sparc = '3'">
|
---|
| 297 | <xsl:text>-m32 -mcpu=ultrasparc3 -mtune=ultrasparc3</xsl:text>
|
---|
| 298 | </xsl:when>
|
---|
| 299 | </xsl:choose>
|
---|
| 300 | </xsl:when>
|
---|
| 301 | <xsl:when test="contains(string(),'BUILD64')">
|
---|
| 302 | <xsl:choose>
|
---|
| 303 | <xsl:when test="$sparc = '1' or $sparc = '2'">
|
---|
| 304 | <xsl:text>-m64 -mcpu=ultrasparc -mtune=ultrasparc</xsl:text>
|
---|
| 305 | </xsl:when>
|
---|
| 306 | <xsl:when test="$sparc = '3'">
|
---|
| 307 | <xsl:text>-m64 -mcpu=ultrasparc3 -mtune=ultrasparc3</xsl:text>
|
---|
| 308 | </xsl:when>
|
---|
| 309 | </xsl:choose>
|
---|
| 310 | </xsl:when>
|
---|
| 311 | <xsl:when test="contains(string(),'GCCTARGET')">
|
---|
| 312 | <xsl:choose>
|
---|
| 313 | <xsl:when test="$sparc = '1' or $sparc = '2'">
|
---|
| 314 | <xsl:text>-mcpu=ultrasparc -mtune=ultrasparc</xsl:text>
|
---|
| 315 | </xsl:when>
|
---|
| 316 | <xsl:when test="$sparc = '3'">
|
---|
| 317 | <xsl:text>-mcpu=ultrasparc3 -mtune=ultrasparc3</xsl:text>
|
---|
| 318 | </xsl:when>
|
---|
| 319 | </xsl:choose>
|
---|
| 320 | </xsl:when>
|
---|
| 321 | </xsl:choose>
|
---|
| 322 | </xsl:when>
|
---|
[e676ffa] | 323 | <xsl:otherwise>
|
---|
| 324 | <xsl:text>**EDITME</xsl:text>
|
---|
| 325 | <xsl:apply-templates/>
|
---|
| 326 | <xsl:text>EDITME**</xsl:text>
|
---|
| 327 | </xsl:otherwise>
|
---|
| 328 | </xsl:choose>
|
---|
[a9490ab] | 329 | </xsl:template>
|
---|
| 330 |
|
---|
| 331 | </xsl:stylesheet>
|
---|