[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 |
|
---|
[5c575e1] | 19 | <!-- What kernel serie must be used? -->
|
---|
| 20 | <xsl:param name="kernel" select="2.6"/>
|
---|
| 21 |
|
---|
[877cc6a] | 22 | <!-- Is the host kernel using grsecurity? -->
|
---|
[401f81e] | 23 | <xsl:param name="grsecurity_host" select="n"/>
|
---|
[877cc6a] | 24 |
|
---|
| 25 | <!-- Run test suites?
|
---|
| 26 | 0 = none
|
---|
| 27 | 1 = only chapter06 Glibc, GCC and Binutils testsuites
|
---|
| 28 | 2 = all chapter06 testsuites
|
---|
[28f4756] | 29 | 3 = alias to 2
|
---|
| 30 | -->
|
---|
[877cc6a] | 31 | <xsl:param name="testsuite" select="1"/>
|
---|
| 32 |
|
---|
[28f4756] | 33 | <!-- Bomb on test suites failures?
|
---|
[401f81e] | 34 | n = no, I want to build the full system and review the logs
|
---|
| 35 | y = yes, bomb at the first test suite failure to can review the build dir
|
---|
[28f4756] | 36 | -->
|
---|
[401f81e] | 37 | <xsl:param name="bomb-testsuite" select="n"/>
|
---|
[28f4756] | 38 |
|
---|
[877cc6a] | 39 | <!-- Time zone -->
|
---|
[a229600] | 40 | <xsl:param name="timezone" select="GMT"/>
|
---|
[877cc6a] | 41 |
|
---|
| 42 | <!-- Page size -->
|
---|
| 43 | <xsl:param name="page" select="letter"/>
|
---|
| 44 |
|
---|
| 45 | <!-- Locale settings -->
|
---|
[a229600] | 46 | <xsl:param name="lang" select="C"/>
|
---|
[877cc6a] | 47 |
|
---|
| 48 | <xsl:template match="/">
|
---|
| 49 | <xsl:apply-templates select="//sect1"/>
|
---|
| 50 | </xsl:template>
|
---|
| 51 |
|
---|
| 52 | <xsl:template match="sect1">
|
---|
| 53 | <xsl:if test="(../@id='chapter-temporary-tools' or
|
---|
| 54 | ../@id='chapter-building-system' or
|
---|
| 55 | ../@id='chapter-bootable') and
|
---|
| 56 | ((@condition=$model or not(@condition)) and
|
---|
[5c575e1] | 57 | ((@vendor=$kernel or not(@vendor)) and
|
---|
[877cc6a] | 58 | count(descendant::screen/userinput) > 0 and
|
---|
| 59 | count(descendant::screen/userinput) >
|
---|
[6d48bb7] | 60 | count(descendant::screen[@role='nodump'])))">
|
---|
[877cc6a] | 61 | <!-- The dirs names -->
|
---|
| 62 | <xsl:variable name="pi-dir" select="../processing-instruction('dbhtml')"/>
|
---|
| 63 | <xsl:variable name="pi-dir-value" select="substring-after($pi-dir,'dir=')"/>
|
---|
| 64 | <xsl:variable name="quote-dir" select="substring($pi-dir-value,1,1)"/>
|
---|
| 65 | <xsl:variable name="dirname" select="substring-before(substring($pi-dir-value,2),$quote-dir)"/>
|
---|
| 66 | <!-- The file names -->
|
---|
| 67 | <xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/>
|
---|
| 68 | <xsl:variable name="pi-file-value" select="substring-after($pi-file,'filename=')"/>
|
---|
| 69 | <xsl:variable name="filename" select="substring-before(substring($pi-file-value,2),'.html')"/>
|
---|
| 70 | <!-- The build order -->
|
---|
| 71 | <xsl:variable name="position" select="position()"/>
|
---|
| 72 | <xsl:variable name="order">
|
---|
| 73 | <xsl:choose>
|
---|
| 74 | <xsl:when test="string-length($position) = 1">
|
---|
| 75 | <xsl:text>00</xsl:text>
|
---|
| 76 | <xsl:value-of select="$position"/>
|
---|
| 77 | </xsl:when>
|
---|
| 78 | <xsl:when test="string-length($position) = 2">
|
---|
| 79 | <xsl:text>0</xsl:text>
|
---|
| 80 | <xsl:value-of select="$position"/>
|
---|
| 81 | </xsl:when>
|
---|
| 82 | <xsl:otherwise>
|
---|
| 83 | <xsl:value-of select="$position"/>
|
---|
| 84 | </xsl:otherwise>
|
---|
| 85 | </xsl:choose>
|
---|
| 86 | </xsl:variable>
|
---|
| 87 | <!-- Creating dirs and files -->
|
---|
| 88 | <exsl:document href="{$dirname}/{$order}-{$filename}" method="text">
|
---|
[1330ebc] | 89 | <xsl:choose>
|
---|
| 90 | <xsl:when test="@id='ch-system-creatingdirs' or
|
---|
[7d6fe10] | 91 | @id='ch-system-createfiles' or
|
---|
[1a39790] | 92 | @id='ch-system-changingowner' or
|
---|
[7d6fe10] | 93 | @id='ch-system-strippingagain'">
|
---|
[1330ebc] | 94 | <xsl:text>#!/tools/bin/bash
set +h
</xsl:text>
|
---|
| 95 | </xsl:when>
|
---|
| 96 | <xsl:otherwise>
|
---|
| 97 | <xsl:text>#!/bin/bash
set +h
</xsl:text>
|
---|
| 98 | </xsl:otherwise>
|
---|
| 99 | </xsl:choose>
|
---|
[5f4982d] | 100 | <xsl:if test="not(@id='ch-tools-stripping') and
|
---|
| 101 | not(@id='ch-system-strippingagain')">
|
---|
| 102 | <xsl:text>set -e
</xsl:text>
|
---|
| 103 | </xsl:if>
|
---|
| 104 | <xsl:text>
</xsl:text>
|
---|
[a9d3a9a] | 105 | <xsl:if test="(sect2[@role='installation'])">
|
---|
[877cc6a] | 106 | <xsl:text>cd $PKGDIR
</xsl:text>
|
---|
[5e83595] | 107 | <xsl:if test="@id='ch-system-uclibc'">
|
---|
[877cc6a] | 108 | <xsl:text>pushd ../; tar -xvf gettext-&gettext-version;.*; popd; 
</xsl:text>
|
---|
| 109 | </xsl:if>
|
---|
[d81c640] | 110 |
|
---|
[4d15d7f] | 111 | <!-- SVN toolchain format, from inside ./sources dir unpack binutils and gcc -->
|
---|
[d81c640] | 112 | <xsl:if test="@id='ch-tools-embryo-toolchain' or
|
---|
| 113 | @id='ch-tools-cocoon-toolchain' or
|
---|
| 114 | @id='ch-system-butterfly-toolchain'">
|
---|
| 115 | <xsl:text>tar -xvf gcc-core-&gcc-version;.*; 
</xsl:text>
|
---|
| 116 | <xsl:text>tar -xvf binutils-&binutils-version;.*; 
</xsl:text>
|
---|
[877cc6a] | 117 | </xsl:if>
|
---|
[30d1215] | 118 | <xsl:if test="@id='ch-tools-cocoon-toolchain' or
|
---|
| 119 | @id='ch-system-butterfly-toolchain'">
|
---|
| 120 | <xsl:text>tar -xvf gcc-g++-&gcc-version;.*; 
</xsl:text>
|
---|
| 121 | </xsl:if>
|
---|
[d81c640] | 122 | <!-- ONLY butterfly has a testsuite -->
|
---|
[b2489fb] | 123 | <xsl:if test="@id='ch-system-butterfly-toolchain' and $testsuite != '0'">
|
---|
[d81c640] | 124 | <xsl:text>tar -xvf gcc-testsuite-&gcc-version;.*; 
</xsl:text>
|
---|
[877cc6a] | 125 | </xsl:if>
|
---|
[4d15d7f] | 126 | <!-- END SVN toolchain format -->
|
---|
| 127 |
|
---|
| 128 | <!-- 2.4-branch toolchain -->
|
---|
| 129 | <xsl:if test="@id='ch-tools-gcc-pass2' or @id='ch-system-gcc'">
|
---|
| 130 | <xsl:text>pushd ../; tar -xvf gcc-g++-&gcc-version;.*; popd; 
</xsl:text>
|
---|
| 131 | </xsl:if>
|
---|
| 132 | <xsl:if test="@id='ch-system-gcc' and $testsuite != '0'">
|
---|
| 133 | <xsl:text>pushd ../; tar -xvf gcc-testsuite-&gcc-version;.*; popd; 
</xsl:text>
|
---|
| 134 | </xsl:if>
|
---|
| 135 | <!-- END 2.4-branch toolchain -->
|
---|
[d81c640] | 136 |
|
---|
[a9d3a9a] | 137 | <!-- temporary
|
---|
[877cc6a] | 138 | <xsl:if test="@id='bootable-bootscripts'">
|
---|
| 139 | <xsl:text>pushd ../; tar -xvf blfs-bootscripts-&blfs-bootscripts-version;.* ; popd; 
</xsl:text>
|
---|
| 140 | </xsl:if>
|
---|
[a9d3a9a] | 141 | -->
|
---|
[877cc6a] | 142 | </xsl:if>
|
---|
| 143 | <xsl:apply-templates select=".//para/userinput | .//screen"/>
|
---|
| 144 | <xsl:text>exit</xsl:text>
|
---|
| 145 | </exsl:document>
|
---|
| 146 | </xsl:if>
|
---|
| 147 | </xsl:template>
|
---|
| 148 |
|
---|
| 149 | <xsl:template match="screen">
|
---|
| 150 | <xsl:if test="(@condition=$model or not(@condition)) and
|
---|
[5c575e1] | 151 | (@vendor=$kernel or not(@vendor)) and
|
---|
[877cc6a] | 152 | child::* = userinput and not(@role = 'nodump')">
|
---|
| 153 | <xsl:apply-templates select="userinput" mode="screen"/>
|
---|
| 154 | </xsl:if>
|
---|
| 155 | </xsl:template>
|
---|
| 156 |
|
---|
| 157 | <xsl:template match="para/userinput">
|
---|
| 158 | <xsl:if test="(contains(string(),'test') or
|
---|
[d81c640] | 159 | contains(string(),'check')) and
|
---|
| 160 | ($testsuite = '2' or $testsuite = '3')">
|
---|
[28f4756] | 161 | <xsl:choose>
|
---|
[401f81e] | 162 | <xsl:when test="$bomb-testsuite = 'n'">
|
---|
[28f4756] | 163 | <xsl:value-of select="substring-before(string(),'make')"/>
|
---|
| 164 | <xsl:text>make -k</xsl:text>
|
---|
| 165 | <xsl:value-of select="substring-after(string(),'make')"/>
|
---|
| 166 | <xsl:text> >> $TEST_LOG 2>&1 || true
</xsl:text>
|
---|
| 167 | </xsl:when>
|
---|
| 168 | <xsl:otherwise>
|
---|
| 169 | <xsl:apply-templates/>
|
---|
[a1f1969] | 170 | <xsl:text> >> $TEST_LOG 2>&1</xsl:text>
|
---|
| 171 | <xsl:if test="contains(string(),' -k ')">
|
---|
| 172 | <xsl:text> || true</xsl:text>
|
---|
| 173 | </xsl:if>
|
---|
| 174 | <xsl:text>
</xsl:text>
|
---|
[28f4756] | 175 | </xsl:otherwise>
|
---|
| 176 | </xsl:choose>
|
---|
[877cc6a] | 177 | </xsl:if>
|
---|
| 178 | </xsl:template>
|
---|
| 179 |
|
---|
| 180 | <xsl:template match="userinput" mode="screen">
|
---|
| 181 | <xsl:choose>
|
---|
| 182 | <!-- Estandarized package formats -->
|
---|
| 183 | <xsl:when test="contains(string(),'tar.gz')">
|
---|
| 184 | <xsl:value-of select="substring-before(string(),'tar.gz')"/>
|
---|
| 185 | <xsl:text>tar.*</xsl:text>
|
---|
| 186 | <xsl:value-of select="substring-after(string(),'tar.gz')"/>
|
---|
| 187 | <xsl:text>
</xsl:text>
|
---|
| 188 | </xsl:when>
|
---|
| 189 | <!-- grsecurity kernel in the host? -->
|
---|
| 190 | <xsl:when test="ancestor::sect1[@id='ch-system-kernfs'] and
|
---|
| 191 | contains(string(),'sysctl')
|
---|
[401f81e] | 192 | and $grsecurity_host ='n'"/>
|
---|
[37002ae] | 193 | <!-- We need to have /dev/console and /dev/null availables before
|
---|
| 194 | entering to the chroot -->
|
---|
| 195 | <xsl:when test="ancestor::sect1[@id='ch-system-devices'] and
|
---|
| 196 | contains(string(),'600 /dev/console')"/>
|
---|
[4d15d7f] | 197 | <!-- Fix MAKEDEV installation in 2.4-branch -->
|
---|
| 198 | <xsl:when test="ancestor::sect1[@id='ch-system-devices'] and
|
---|
| 199 | contains(string(),'bzcat MAKEDEV')">
|
---|
| 200 | <xsl:text>bzcat /sources/</xsl:text>
|
---|
| 201 | <xsl:value-of select="substring-after(string(),'bzcat ')"/>
|
---|
| 202 | <xsl:text>
</xsl:text>
|
---|
| 203 | </xsl:when>
|
---|
[05760bc] | 204 | <!-- Setting $LANG for /etc/profile -->
|
---|
[877cc6a] | 205 | <xsl:when test="ancestor::sect1[@id='bootable-profile'] and
|
---|
| 206 | contains(string(),'export LANG=')">
|
---|
[05760bc] | 207 | <xsl:value-of select="substring-before(string(),'export LANG=')"/>
|
---|
| 208 | <xsl:text>export LANG=</xsl:text>
|
---|
[877cc6a] | 209 | <xsl:value-of select="$lang"/>
|
---|
[05760bc] | 210 | <xsl:value-of select="substring-after(string(),'CC]')"/>
|
---|
[877cc6a] | 211 | <xsl:text>
</xsl:text>
|
---|
| 212 | </xsl:when>
|
---|
| 213 | <!-- Fixing bootscripts installation -->
|
---|
[a9d3a9a] | 214 |
|
---|
| 215 | <!-- temporary
|
---|
[877cc6a] | 216 | <xsl:when test="ancestor::sect1[@id='bootable-bootscripts'] and
|
---|
| 217 | string() = 'make install'">
|
---|
| 218 | <xsl:text>make install
</xsl:text>
|
---|
| 219 | <xsl:text>cd ../blfs-bootscripts-&blfs-bootscripts-version;
</xsl:text>
|
---|
| 220 | </xsl:when>
|
---|
[a9d3a9a] | 221 | -->
|
---|
[f4caf9c] | 222 | <!-- Compile the keymap into the kernel has been dissabled -->
|
---|
| 223 | <xsl:when test="contains(string(),'defkeymap')"/>
|
---|
[877cc6a] | 224 | <!-- Copying the kernel config file -->
|
---|
| 225 | <xsl:when test="string() = 'make mrproper'">
|
---|
| 226 | <xsl:text>make mrproper
</xsl:text>
|
---|
| 227 | <xsl:text>cp -v /sources/kernel-config .config
</xsl:text>
|
---|
| 228 | </xsl:when>
|
---|
| 229 | <!-- No interactive commands are needed if the .config file is the proper one -->
|
---|
| 230 | <xsl:when test="string() = 'make menuconfig'"/>
|
---|
| 231 | <!-- For uClibc we need to cd to the Gettext package -->
|
---|
| 232 | <xsl:when test="contains(string(),'cd gettext-runtime/')">
|
---|
| 233 | <xsl:text>cd ../gettext-*/gettext-runtime</xsl:text>
|
---|
| 234 | <xsl:value-of select="substring-after(string(),'gettext-runtime')"/>
|
---|
| 235 | <xsl:text>
</xsl:text>
|
---|
| 236 | </xsl:when>
|
---|
| 237 | <!-- The Coreutils and Module-Init-Tools test suites are optional -->
|
---|
[a229600] | 238 | <xsl:when test="(ancestor::sect1[@id='ch-system-coreutils'] or
|
---|
[877cc6a] | 239 | ancestor::sect1[@id='ch-system-module-init-tools']) and
|
---|
| 240 | (contains(string(),'check') or
|
---|
| 241 | contains(string(),'distclean') or
|
---|
[a229600] | 242 | contains(string(),'dummy'))">
|
---|
| 243 | <xsl:choose>
|
---|
| 244 | <xsl:when test="$testsuite = '0' or $testsuite = '1'"/>
|
---|
| 245 | <xsl:otherwise>
|
---|
[28f4756] | 246 | <xsl:if test="not(contains(string(),'check'))">
|
---|
| 247 | <xsl:apply-templates/>
|
---|
| 248 | <xsl:text>
</xsl:text>
|
---|
| 249 | </xsl:if>
|
---|
[a229600] | 250 | <xsl:if test="contains(string(),'check')">
|
---|
[28f4756] | 251 | <xsl:choose>
|
---|
[401f81e] | 252 | <xsl:when test="$bomb-testsuite = 'n'">
|
---|
[28f4756] | 253 | <xsl:value-of select="substring-before(string(),'check')"/>
|
---|
| 254 | <xsl:text>-k check</xsl:text>
|
---|
| 255 | <xsl:value-of select="substring-after(string(),'check')"/>
|
---|
| 256 | <xsl:text> >> $TEST_LOG 2>&1 || true
</xsl:text>
|
---|
| 257 | </xsl:when>
|
---|
| 258 | <xsl:otherwise>
|
---|
| 259 | <xsl:apply-templates/>
|
---|
[a1f1969] | 260 | <xsl:text> >> $TEST_LOG 2>&1</xsl:text>
|
---|
| 261 | <xsl:if test="contains(string(),' -k ')">
|
---|
| 262 | <xsl:text> || true</xsl:text>
|
---|
| 263 | </xsl:if>
|
---|
| 264 | <xsl:text>
</xsl:text>
|
---|
[28f4756] | 265 | </xsl:otherwise>
|
---|
| 266 | </xsl:choose>
|
---|
[a229600] | 267 | </xsl:if>
|
---|
| 268 | </xsl:otherwise>
|
---|
| 269 | </xsl:choose>
|
---|
| 270 | </xsl:when>
|
---|
[4d15d7f] | 271 | <!-- Fixing butterfly and 2.4-branch toolchain plus other packages test suites run -->
|
---|
[ff43bb8] | 272 | <xsl:when test="string() = 'make -k check'
|
---|
| 273 | or string() = 'make check'
|
---|
| 274 | or string() = 'make tests'">
|
---|
[877cc6a] | 275 | <xsl:choose>
|
---|
[4d15d7f] | 276 | <xsl:when test="((ancestor::sect1[@id='ch-system-butterfly-toolchain']
|
---|
| 277 | or ancestor::sect1[@id='ch-system-gcc'] or
|
---|
| 278 | ancestor::sect1[@id='ch-system-binutils'])
|
---|
[ff43bb8] | 279 | and $testsuite != '0') or
|
---|
| 280 | $testsuite = '2' or $testsuite = '3'">
|
---|
[28f4756] | 281 | <xsl:choose>
|
---|
[401f81e] | 282 | <xsl:when test="$bomb-testsuite = 'n'">
|
---|
[ff43bb8] | 283 | <xsl:text>make -k check >> $TEST_LOG 2>&1 || true
</xsl:text>
|
---|
[28f4756] | 284 | </xsl:when>
|
---|
| 285 | <xsl:otherwise>
|
---|
[ff43bb8] | 286 | <xsl:apply-templates/>
|
---|
[f98695c] | 287 | <xsl:text> >> $TEST_LOG 2>&1</xsl:text>
|
---|
[a1f1969] | 288 | <xsl:if test="contains(string(),' -k ')">
|
---|
| 289 | <xsl:text> || true</xsl:text>
|
---|
| 290 | </xsl:if>
|
---|
[f98695c] | 291 | <xsl:text>
</xsl:text>
|
---|
[28f4756] | 292 | </xsl:otherwise>
|
---|
| 293 | </xsl:choose>
|
---|
[877cc6a] | 294 | </xsl:when>
|
---|
| 295 | </xsl:choose>
|
---|
| 296 | </xsl:when>
|
---|
[d81c640] | 297 | <!-- Fixing Glbc test suite -->
|
---|
| 298 | <xsl:when test="contains(string(),'glibc-check-log')">
|
---|
[877cc6a] | 299 | <xsl:choose>
|
---|
| 300 | <xsl:when test="$testsuite != '0'">
|
---|
[ff43bb8] | 301 | <xsl:value-of select="substring-before(string(),'2>&1')"/>
|
---|
| 302 | <xsl:text>>> $TEST_LOG 2>&1 || true
</xsl:text>
|
---|
[877cc6a] | 303 | </xsl:when>
|
---|
| 304 | </xsl:choose>
|
---|
| 305 | </xsl:when>
|
---|
[39f5f3e] | 306 | <!-- Fixing Butterfly sanity checks -->
|
---|
| 307 | <xsl:when test="contains(string(),'./fortify-test')
|
---|
| 308 | or contains(string(),'./ssp-test')">
|
---|
[b6f6212] | 309 | <xsl:text>! </xsl:text>
|
---|
[39f5f3e] | 310 | <xsl:apply-templates/>
|
---|
| 311 | <xsl:text>
</xsl:text>
|
---|
| 312 | </xsl:when>
|
---|
[ff43bb8] | 313 | <!-- Don't stop on strip run -->
|
---|
[85077e7] | 314 | <xsl:when test="contains(string(),'strip ')">
|
---|
[877cc6a] | 315 | <xsl:apply-templates/>
|
---|
| 316 | <xsl:text> || true
</xsl:text>
|
---|
| 317 | </xsl:when>
|
---|
| 318 | <!-- The rest of commands -->
|
---|
| 319 | <xsl:otherwise>
|
---|
| 320 | <xsl:apply-templates/>
|
---|
| 321 | <xsl:text>
</xsl:text>
|
---|
| 322 | </xsl:otherwise>
|
---|
| 323 | </xsl:choose>
|
---|
| 324 | </xsl:template>
|
---|
| 325 |
|
---|
[d81c640] | 326 | <xsl:template match="literal">
|
---|
[5c575e1] | 327 | <xsl:if test="(@condition=$model or not(@condition)) and
|
---|
| 328 | (@vendor=$kernel or not(@vendor))">
|
---|
[d81c640] | 329 | <xsl:apply-templates/>
|
---|
| 330 | </xsl:if>
|
---|
| 331 | </xsl:template>
|
---|
| 332 |
|
---|
[877cc6a] | 333 | <xsl:template match="replaceable">
|
---|
| 334 | <xsl:choose>
|
---|
| 335 | <xsl:when test="ancestor::sect1[@id='ch-system-glibc'] or
|
---|
| 336 | ancestor::sect1[@id='ch-system-uclibc']">
|
---|
| 337 | <xsl:value-of select="$timezone"/>
|
---|
| 338 | </xsl:when>
|
---|
| 339 | <xsl:when test="ancestor::sect1[@id='ch-system-groff']">
|
---|
| 340 | <xsl:value-of select="$page"/>
|
---|
| 341 | </xsl:when>
|
---|
| 342 | <xsl:otherwise>
|
---|
| 343 | <xsl:text>**EDITME</xsl:text>
|
---|
| 344 | <xsl:apply-templates/>
|
---|
| 345 | <xsl:text>EDITME**</xsl:text>
|
---|
| 346 | </xsl:otherwise>
|
---|
| 347 | </xsl:choose>
|
---|
| 348 | </xsl:template>
|
---|
| 349 |
|
---|
| 350 | </xsl:stylesheet>
|
---|