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