[0170229] | 1 | <?xml version="1.0"?>
|
---|
| 2 |
|
---|
[3a5c9cc] | 3 | <!-- $Id$ -->
|
---|
| 4 |
|
---|
[0170229] | 5 | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
---|
| 6 | xmlns:exsl="http://exslt.org/common"
|
---|
| 7 | extension-element-prefixes="exsl"
|
---|
| 8 | version="1.0">
|
---|
| 9 |
|
---|
| 10 | <!-- XSLT stylesheet to create shell scripts from LFS books. -->
|
---|
| 11 |
|
---|
[3778352] | 12 | <!-- ####################### PARAMETERS ################################### -->
|
---|
| 13 |
|
---|
[6db1464] | 14 | <!-- Run test suites?
|
---|
| 15 | 0 = none
|
---|
| 16 | 1 = only chapter06 Glibc, GCC and Binutils testsuites
|
---|
| 17 | 2 = all chapter06 testsuites
|
---|
[056486c] | 18 | 3 = all chapter05 and chapter06 testsuites
|
---|
| 19 | -->
|
---|
[c0f8256] | 20 | <xsl:param name="testsuite">1</xsl:param>
|
---|
[0170229] | 21 |
|
---|
[056486c] | 22 | <!-- Bomb on test suites failures?
|
---|
[47fddc8] | 23 | n = no, I want to build the full system and review the logs
|
---|
| 24 | y = yes, bomb at the first test suite failure to can review the build dir
|
---|
[056486c] | 25 | -->
|
---|
[c0f8256] | 26 | <xsl:param name="bomb-testsuite">n</xsl:param>
|
---|
[056486c] | 27 |
|
---|
[0170229] | 28 | <!-- Install vim-lang package? -->
|
---|
[c0f8256] | 29 | <xsl:param name="vim-lang">y</xsl:param>
|
---|
[0170229] | 30 |
|
---|
[ad71d98] | 31 | <!-- Time zone -->
|
---|
[c0f8256] | 32 | <xsl:param name="timezone">GMT</xsl:param>
|
---|
[ad71d98] | 33 |
|
---|
| 34 | <!-- Page size -->
|
---|
[c0f8256] | 35 | <xsl:param name="page">letter</xsl:param>
|
---|
[ad71d98] | 36 |
|
---|
[3778352] | 37 | <!-- Locale setting -->
|
---|
[c0f8256] | 38 | <xsl:param name="lang">C</xsl:param>
|
---|
| 39 |
|
---|
| 40 | <!-- Custom tools support -->
|
---|
| 41 | <xsl:param name="custom-tools">n</xsl:param>
|
---|
| 42 |
|
---|
| 43 | <!-- blfs-tool support -->
|
---|
| 44 | <xsl:param name="blfs-tool">n</xsl:param>
|
---|
[d87b293] | 45 |
|
---|
[13b4ab5] | 46 |
|
---|
| 47 | <!-- ####################################################################### -->
|
---|
| 48 |
|
---|
| 49 | <!-- ########### NAMED USER TEMPLATES TO ALLOW CUSTOMIZATIONS ############## -->
|
---|
| 50 |
|
---|
| 51 | <!-- Hock for user header additions -->
|
---|
| 52 | <xsl:template name="user_header">
|
---|
| 53 | <xsl:text>
</xsl:text>
|
---|
| 54 | </xsl:template>
|
---|
| 55 |
|
---|
| 56 |
|
---|
[570c9f3] | 57 | <!-- Hock for user envars or extra commands after unpacking the tarball
|
---|
| 58 | but before cd into the sources dir -->
|
---|
[13b4ab5] | 59 | <xsl:template name="user_pre_commands">
|
---|
| 60 | <xsl:text>
</xsl:text>
|
---|
| 61 | </xsl:template>
|
---|
| 62 |
|
---|
| 63 |
|
---|
[570c9f3] | 64 | <!-- Hock for user footer additions before remove sources dir -->
|
---|
[13b4ab5] | 65 | <xsl:template name="user_footer">
|
---|
| 66 | <xsl:text>
</xsl:text>
|
---|
| 67 | </xsl:template>
|
---|
| 68 |
|
---|
| 69 |
|
---|
[097df00] | 70 | <!-- Hock for inserting scripts before a selected one -->
|
---|
| 71 | <xsl:template name="insert_script_before">
|
---|
| 72 | <!-- Inherited values -->
|
---|
| 73 | <xsl:param name="reference" select="foo"/>
|
---|
| 74 | <xsl:param name="order" select="foo"/>
|
---|
[570c9f3] | 75 | <!-- Added a string to be sure that this scripts are run
|
---|
[097df00] | 76 | before the selected one -->
|
---|
| 77 | <xsl:variable name="insert_order" select="concat($order,'_0')"/>
|
---|
| 78 | <!-- Add an xsl:if block for each referenced sect1 you want
|
---|
| 79 | to insert scripts before -->
|
---|
| 80 | <xsl:if test="$reference = 'ID_of_selected_sect1'">
|
---|
| 81 | <!-- Add an exsl:document block for each script to be inserted
|
---|
[570c9f3] | 82 | at this point of the build. This one is only a dummy example. -->
|
---|
[097df00] | 83 | <exsl:document href="{$insert_order}01-dummy" method="text">
|
---|
| 84 | <xsl:call-template name="header"/>
|
---|
| 85 | <xsl:text>
|
---|
| 86 | PKG_PHASE=dummy
|
---|
| 87 | PACKAGE=dummy
|
---|
| 88 | VERSION=0.0.0
|
---|
| 89 | TARBALL=dummy-0.0.0.tar.bz2
|
---|
[570c9f3] | 90 | </xsl:text>
|
---|
| 91 | <xsl:call-template name="unpack"/>
|
---|
| 92 | <xsl:text>
|
---|
[097df00] | 93 | cd $PKGDIR
|
---|
| 94 | ./configure --prefix=/usr
|
---|
| 95 | make
|
---|
| 96 | make check
|
---|
| 97 | make install
|
---|
| 98 | </xsl:text>
|
---|
[570c9f3] | 99 | <xsl:call-template name="clean_sources"/>
|
---|
[097df00] | 100 | <xsl:call-template name="footer"/>
|
---|
| 101 | </exsl:document>
|
---|
| 102 | </xsl:if>
|
---|
| 103 | </xsl:template>
|
---|
| 104 |
|
---|
| 105 |
|
---|
| 106 | <!-- Hock for inserting scripts after a selected one -->
|
---|
| 107 | <xsl:template name="insert_script_after">
|
---|
| 108 | <!-- Inherited values -->
|
---|
| 109 | <xsl:param name="reference" select="foo"/>
|
---|
| 110 | <xsl:param name="order" select="foo"/>
|
---|
[570c9f3] | 111 | <!-- Added a string to be sure that this scripts are run
|
---|
[097df00] | 112 | after the selected one -->
|
---|
| 113 | <xsl:variable name="insert_order" select="concat($order,'_z')"/>
|
---|
| 114 | <!-- Add an xsl:if block for each referenced sect1 you want
|
---|
| 115 | to insert scripts after -->
|
---|
| 116 | <xsl:if test="$reference = 'ID_of_selected_sect1'">
|
---|
| 117 | <!-- Add an exsl:document block for each script to be inserted
|
---|
| 118 | at this point of the build. This one is only a dummy example. -->
|
---|
| 119 | <exsl:document href="{$insert_order}01-dummy" method="text">
|
---|
| 120 | <xsl:call-template name="header"/>
|
---|
| 121 | <xsl:text>
|
---|
| 122 | PKG_PHASE=dummy
|
---|
| 123 | PACKAGE=dummy
|
---|
| 124 | VERSION=0.0.0
|
---|
| 125 | TARBALL=dummy-0.0.0.tar.bz2
|
---|
[570c9f3] | 126 | </xsl:text>
|
---|
| 127 | <xsl:call-template name="unpack"/>
|
---|
| 128 | <xsl:text>
|
---|
[097df00] | 129 | cd $PKGDIR
|
---|
| 130 | ./configure --prefix=/usr
|
---|
| 131 | make
|
---|
| 132 | make check
|
---|
| 133 | make install
|
---|
| 134 | </xsl:text>
|
---|
[570c9f3] | 135 | <xsl:call-template name="clean_sources"/>
|
---|
[097df00] | 136 | <xsl:call-template name="footer"/>
|
---|
| 137 | </exsl:document>
|
---|
| 138 | </xsl:if>
|
---|
| 139 | </xsl:template>
|
---|
| 140 |
|
---|
| 141 |
|
---|
[c0f8256] | 142 | <!-- Hock for creating a custom tools directory containing scripts
|
---|
| 143 | to be run after the system has been built -->
|
---|
| 144 | <xsl:template name="custom-tools">
|
---|
[097df00] | 145 | <!-- Fixed directory and ch_order values -->
|
---|
[c0f8256] | 146 | <xsl:variable name="basedir">custom-tools/20_</xsl:variable>
|
---|
[097df00] | 147 | <!-- Add an exsl:document block for each script to be created.
|
---|
[c0f8256] | 148 | This one is only a dummy example. You must replace "01" by
|
---|
| 149 | the proper build order and "dummy" by the script name -->
|
---|
| 150 | <exsl:document href="{$basedir}01-dummy" method="text">
|
---|
| 151 | <xsl:call-template name="header"/>
|
---|
| 152 | <xsl:text>
|
---|
| 153 | PKG_PHASE=dummy
|
---|
| 154 | PACKAGE=dummy
|
---|
| 155 | VERSION=0.0.0
|
---|
| 156 | TARBALL=dummy-0.0.0.tar.bz2
|
---|
[570c9f3] | 157 | </xsl:text>
|
---|
| 158 | <xsl:call-template name="unpack"/>
|
---|
| 159 | <xsl:text>
|
---|
[c0f8256] | 160 | cd $PKGDIR
|
---|
| 161 | ./configure --prefix=/usr
|
---|
| 162 | make
|
---|
| 163 | make check
|
---|
| 164 | make install
|
---|
| 165 | </xsl:text>
|
---|
[570c9f3] | 166 | <xsl:call-template name="clean_sources"/>
|
---|
[c0f8256] | 167 | <xsl:call-template name="footer"/>
|
---|
| 168 | </exsl:document>
|
---|
| 169 | </xsl:template>
|
---|
| 170 |
|
---|
| 171 |
|
---|
[3778352] | 172 | <!-- ####################################################################### -->
|
---|
| 173 |
|
---|
| 174 | <!-- ########################### NAMED TEMPLATES ########################### -->
|
---|
| 175 |
|
---|
| 176 | <!-- Chapter directory name (the same used for HTML output) -->
|
---|
| 177 | <xsl:template name="dirname">
|
---|
| 178 | <xsl:variable name="pi-dir" select="processing-instruction('dbhtml')"/>
|
---|
| 179 | <xsl:variable name="pi-dir-value" select="substring-after($pi-dir,'dir=')"/>
|
---|
| 180 | <xsl:variable name="quote-dir" select="substring($pi-dir-value,1,1)"/>
|
---|
| 181 | <xsl:variable name="dirname" select="substring-before(substring($pi-dir-value,2),$quote-dir)"/>
|
---|
| 182 | <xsl:value-of select="$dirname"/>
|
---|
| 183 | </xsl:template>
|
---|
| 184 |
|
---|
| 185 |
|
---|
| 186 | <!-- Base file name (the same used for HTML output) -->
|
---|
| 187 | <xsl:template name="filename">
|
---|
| 188 | <xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/>
|
---|
| 189 | <xsl:variable name="pi-file-value" select="substring-after($pi-file,'filename=')"/>
|
---|
| 190 | <xsl:variable name="filename" select="substring-before(substring($pi-file-value,2),'.html')"/>
|
---|
| 191 | <xsl:value-of select="$filename"/>
|
---|
| 192 | </xsl:template>
|
---|
| 193 |
|
---|
| 194 |
|
---|
| 195 | <!-- Script header -->
|
---|
| 196 | <xsl:template name="header">
|
---|
[13b4ab5] | 197 | <!-- Set the shabang -->
|
---|
[3778352] | 198 | <xsl:choose>
|
---|
| 199 | <xsl:when test="@id='ch-system-creatingdirs' or
|
---|
| 200 | @id='ch-system-createfiles' or
|
---|
| 201 | @id='ch-system-strippingagain'">
|
---|
| 202 | <xsl:text>#!/tools/bin/bash
</xsl:text>
|
---|
| 203 | </xsl:when>
|
---|
| 204 | <xsl:otherwise>
|
---|
| 205 | <xsl:text>#!/bin/bash
</xsl:text>
|
---|
| 206 | </xsl:otherwise>
|
---|
| 207 | </xsl:choose>
|
---|
[13b4ab5] | 208 | <!-- Set +h -->
|
---|
[3778352] | 209 | <xsl:text>set +h
</xsl:text>
|
---|
[13b4ab5] | 210 | <!-- Set -e -->
|
---|
[3778352] | 211 | <xsl:if test="not(@id='ch-tools-stripping') and
|
---|
| 212 | not(@id='ch-system-strippingagain')">
|
---|
| 213 | <xsl:text>set -e
</xsl:text>
|
---|
| 214 | </xsl:if>
|
---|
| 215 | <xsl:text>
</xsl:text>
|
---|
| 216 | </xsl:template>
|
---|
| 217 |
|
---|
| 218 |
|
---|
[570c9f3] | 219 | <!-- Enter to the sources dir, clean it, and unpack the tarball -->
|
---|
| 220 | <xsl:template name="unpack">
|
---|
| 221 | <xsl:choose>
|
---|
| 222 | <xsl:when test="ancestor::chapter[@id='chapter-temporary-tools']">
|
---|
| 223 | <xsl:text>cd $SRCDIR</xsl:text>
|
---|
| 224 | </xsl:when>
|
---|
| 225 | <xsl:otherwise>
|
---|
| 226 | <xsl:text>cd /sources</xsl:text>
|
---|
| 227 | </xsl:otherwise>
|
---|
| 228 | </xsl:choose>
|
---|
| 229 | <xsl:text>
|
---|
| 230 | PKGDIR=`tar -tf $TARBALL | head -n1 | sed -e 's@^./@@;s@/.*@@'`
|
---|
| 231 | if [ -d $PKGDIR ]; then
|
---|
| 232 | rm -rf $PKGDIR
|
---|
| 233 | fi
|
---|
| 234 | if [ -d ${PKGDIR%-*}-build ]; then
|
---|
| 235 | rm -rf ${PKGDIR%-*}-build
|
---|
| 236 | fi
|
---|
| 237 | tar -xf $TARBALL
|
---|
| 238 | </xsl:text>
|
---|
| 239 | </xsl:template>
|
---|
| 240 |
|
---|
| 241 |
|
---|
[3778352] | 242 | <!-- Extra previous commands needed by the book but not inside screen tags -->
|
---|
| 243 | <xsl:template name="pre_commands">
|
---|
| 244 | <xsl:if test="sect2[@role='installation']">
|
---|
| 245 | <xsl:text>cd $PKGDIR
</xsl:text>
|
---|
| 246 | </xsl:if>
|
---|
| 247 | <xsl:if test="@id='ch-system-vim' and $vim-lang = 'y'">
|
---|
[570c9f3] | 248 | <xsl:text>tar -xf ../$TARBALL_1 --strip-components=1
</xsl:text>
|
---|
[3778352] | 249 | </xsl:if>
|
---|
| 250 | </xsl:template>
|
---|
| 251 |
|
---|
| 252 |
|
---|
| 253 | <!-- Extra post commands needed by the book but not inside screen tags -->
|
---|
| 254 | <xsl:template name="post_commands">
|
---|
| 255 | <xsl:if test="$testsuite='3' and @id='ch-tools-glibc'">
|
---|
[8533c26] | 256 | <xsl:variable name="content" select="//userinput[@remap='locale-test']"/>
|
---|
| 257 | <xsl:value-of select="substring-before($content,'/usr/lib/locale')"/>
|
---|
| 258 | <xsl:text>/tools/lib/locale</xsl:text>
|
---|
| 259 | <xsl:value-of select="substring-after($content,'/usr/lib/locale')"/>
|
---|
[3778352] | 260 | </xsl:if>
|
---|
| 261 | </xsl:template>
|
---|
| 262 |
|
---|
| 263 |
|
---|
[570c9f3] | 264 | <!-- Remove sources and build dirs -->
|
---|
| 265 | <xsl:template name="clean_sources">
|
---|
| 266 | <xsl:choose>
|
---|
| 267 | <xsl:when test="ancestor::chapter[@id='chapter-temporary-tools']">
|
---|
| 268 | <xsl:text>cd $SRCDIR</xsl:text>
|
---|
| 269 | </xsl:when>
|
---|
| 270 | <xsl:otherwise>
|
---|
| 271 | <xsl:text>cd /sources</xsl:text>
|
---|
| 272 | </xsl:otherwise>
|
---|
| 273 | </xsl:choose>
|
---|
| 274 | <xsl:text>
|
---|
| 275 | rm -rf $PKGDIR
|
---|
| 276 | rm -rf ${PKGDIR%-*}-build
|
---|
| 277 | </xsl:text>
|
---|
| 278 | </xsl:template>
|
---|
| 279 |
|
---|
| 280 |
|
---|
[3778352] | 281 | <!-- Script footer -->
|
---|
| 282 | <xsl:template name="footer">
|
---|
[13b4ab5] | 283 | <!-- Dump the build time -->
|
---|
[3778352] | 284 | <xsl:if test="not(@id='ch-system-chroot') and
|
---|
| 285 | not(@id='ch-system-revisedchroot')">
|
---|
[13b4ab5] | 286 | <xsl:text>

echo -e "\n\nTotalseconds: $SECONDS\n"
</xsl:text>
|
---|
[3778352] | 287 | </xsl:if>
|
---|
[13b4ab5] | 288 | <!-- Exit -->
|
---|
| 289 | <xsl:text>
exit
</xsl:text>
|
---|
| 290 | </xsl:template>
|
---|
[3778352] | 291 |
|
---|
[13b4ab5] | 292 |
|
---|
[fa1b640] | 293 | <!-- Extra commads needed at the start of some screen block
|
---|
| 294 | to allow automatization -->
|
---|
| 295 | <xsl:template name="top_screen_build_fixes">
|
---|
| 296 | <!-- Fix Udev reinstallation after a build failure or on iterative builds -->
|
---|
| 297 | <xsl:if test="contains(string(),'firmware,udev')">
|
---|
| 298 | <xsl:text>if [[ ! -d /lib/udev/devices ]] ; then
</xsl:text>
|
---|
| 299 | </xsl:if>
|
---|
| 300 | </xsl:template>
|
---|
| 301 |
|
---|
| 302 |
|
---|
| 303 | <!-- Extra commads needed at the end of some screen block
|
---|
| 304 | to allow automatization -->
|
---|
| 305 | <xsl:template name="bottom_screen_build_fixes">
|
---|
| 306 | <!-- Fix Udev reinstallation after a build failure or on iterative builds -->
|
---|
| 307 | <xsl:if test="contains(string(),'firmware,udev')">
|
---|
| 308 | <xsl:text>
fi</xsl:text>
|
---|
| 309 | </xsl:if>
|
---|
| 310 | <!-- Copying the kernel config file -->
|
---|
| 311 | <xsl:if test="string() = 'make mrproper'">
|
---|
| 312 | <xsl:text>
cp -v ../kernel-config .config</xsl:text>
|
---|
| 313 | </xsl:if>
|
---|
| 314 | <!-- Don't stop on strip run -->
|
---|
| 315 | <xsl:if test="contains(string(),'strip --strip')">
|
---|
| 316 | <xsl:text> || true</xsl:text>
|
---|
| 317 | </xsl:if>
|
---|
| 318 | </xsl:template>
|
---|
| 319 |
|
---|
| 320 |
|
---|
[13b4ab5] | 321 | <!-- Extract a package name from a package URL -->
|
---|
| 322 | <xsl:template name="package_name">
|
---|
| 323 | <xsl:param name="url" select="foo"/>
|
---|
| 324 | <xsl:param name="sub-url" select="substring-after($url,'/')"/>
|
---|
| 325 | <xsl:choose>
|
---|
| 326 | <xsl:when test="contains($sub-url,'/')">
|
---|
| 327 | <xsl:call-template name="package_name">
|
---|
| 328 | <xsl:with-param name="url" select="$sub-url"/>
|
---|
| 329 | </xsl:call-template>
|
---|
| 330 | </xsl:when>
|
---|
| 331 | <xsl:otherwise>
|
---|
| 332 | <xsl:value-of select="$sub-url"/>
|
---|
| 333 | </xsl:otherwise>
|
---|
| 334 | </xsl:choose>
|
---|
[3778352] | 335 | </xsl:template>
|
---|
| 336 |
|
---|
[13b4ab5] | 337 |
|
---|
[c0f8256] | 338 | <!-- Adds blfs-tool support scripts -->
|
---|
| 339 | <xsl:template name="blfs-tool">
|
---|
[097df00] | 340 | <!-- Fixed directory and ch_order values -->
|
---|
[c0f8256] | 341 | <xsl:variable name="basedir">blfs-tool-deps/30_</xsl:variable>
|
---|
| 342 | <!-- One exsl:document block for each blfs-tool dependency
|
---|
| 343 | TO BE WRITTEN -->
|
---|
| 344 | <exsl:document href="{$basedir}01-dummy" method="text">
|
---|
| 345 | <xsl:call-template name="header"/>
|
---|
| 346 | <xsl:text>
|
---|
| 347 | PKG_PHASE=dummy
|
---|
| 348 | PACKAGE=dummy
|
---|
| 349 | VERSION=0.0.0
|
---|
| 350 | TARBALL=dummy-0.0.0.tar.bz2
|
---|
[570c9f3] | 351 | </xsl:text>
|
---|
| 352 | <xsl:call-template name="unpack"/>
|
---|
| 353 | <xsl:text>
|
---|
[c0f8256] | 354 | cd $PKGDIR
|
---|
| 355 | ./configure --prefix=/usr
|
---|
| 356 | make
|
---|
| 357 | make check
|
---|
| 358 | make install
|
---|
| 359 | </xsl:text>
|
---|
[570c9f3] | 360 | <xsl:call-template name="clean_sources"/>
|
---|
[c0f8256] | 361 | <xsl:call-template name="footer"/>
|
---|
| 362 | </exsl:document>
|
---|
| 363 | </xsl:template>
|
---|
| 364 |
|
---|
| 365 |
|
---|
[3778352] | 366 | <!-- ######################################################################## -->
|
---|
| 367 |
|
---|
| 368 | <!-- ############################# MATCH TEMPLATES ########################## -->
|
---|
| 369 |
|
---|
| 370 | <!-- Root element -->
|
---|
[0170229] | 371 | <xsl:template match="/">
|
---|
[13b4ab5] | 372 | <!-- Start processing at chapter level -->
|
---|
[3778352] | 373 | <xsl:apply-templates select="//chapter"/>
|
---|
[c0f8256] | 374 | <!-- Process custom tools scripts -->
|
---|
| 375 | <xsl:if test="$custom-tools = 'y'">
|
---|
| 376 | <xsl:call-template name="custom-tools"/>
|
---|
| 377 | </xsl:if>
|
---|
| 378 | <!-- Process blfs-tool scripts -->
|
---|
| 379 | <xsl:if test="$blfs-tool = 'y'">
|
---|
| 380 | <xsl:call-template name="blfs-tool"/>
|
---|
| 381 | </xsl:if>
|
---|
[0170229] | 382 | </xsl:template>
|
---|
| 383 |
|
---|
[3778352] | 384 |
|
---|
| 385 | <!-- chapter -->
|
---|
| 386 | <xsl:template match="chapter">
|
---|
| 387 | <xsl:if test="@id='chapter-temporary-tools' or @id='chapter-building-system'
|
---|
| 388 | or @id='chapter-bootscripts' or @id='chapter-bootable'">
|
---|
| 389 | <!-- The dir name -->
|
---|
| 390 | <xsl:variable name="dirname">
|
---|
| 391 | <xsl:call-template name="dirname"/>
|
---|
| 392 | </xsl:variable>
|
---|
| 393 | <!-- The chapter order position -->
|
---|
| 394 | <xsl:variable name="ch_position" select="position()"/>
|
---|
| 395 | <xsl:variable name="ch_order">
|
---|
[0170229] | 396 | <xsl:choose>
|
---|
[3778352] | 397 | <xsl:when test="string-length($ch_position) = 1">
|
---|
[0170229] | 398 | <xsl:text>0</xsl:text>
|
---|
[3778352] | 399 | <xsl:value-of select="$ch_position"/>
|
---|
[0170229] | 400 | </xsl:when>
|
---|
| 401 | <xsl:otherwise>
|
---|
[3778352] | 402 | <xsl:value-of select="$ch_position"/>
|
---|
[0170229] | 403 | </xsl:otherwise>
|
---|
| 404 | </xsl:choose>
|
---|
| 405 | </xsl:variable>
|
---|
[13b4ab5] | 406 | <!-- Process the childrens -->
|
---|
[3778352] | 407 | <xsl:apply-templates select="sect1">
|
---|
| 408 | <xsl:with-param name="ch_order" select="$ch_order"/>
|
---|
| 409 | <xsl:with-param name="dirname" select="$dirname"/>
|
---|
| 410 | </xsl:apply-templates>
|
---|
| 411 | </xsl:if>
|
---|
| 412 | </xsl:template>
|
---|
| 413 |
|
---|
| 414 |
|
---|
| 415 | <!-- sect1 -->
|
---|
| 416 | <xsl:template match="sect1">
|
---|
| 417 | <!-- Inherited chapter order -->
|
---|
| 418 | <xsl:param name="ch_order" select="foo"/>
|
---|
| 419 | <!-- Inherited dir name -->
|
---|
| 420 | <xsl:param name="dirname" select="foo"/>
|
---|
[e213e4c] | 421 | <!-- Process only files with actual build commands -->
|
---|
[3778352] | 422 | <xsl:if test="count(descendant::screen/userinput) > 0 and
|
---|
| 423 | count(descendant::screen/userinput) >
|
---|
| 424 | count(descendant::screen[@role='nodump'])">
|
---|
| 425 | <!-- Base file name -->
|
---|
| 426 | <xsl:variable name="filename">
|
---|
| 427 | <xsl:call-template name="filename"/>
|
---|
| 428 | </xsl:variable>
|
---|
| 429 | <!-- Sect1 order position -->
|
---|
| 430 | <xsl:variable name="sect1_position" select="position()"/>
|
---|
| 431 | <xsl:variable name="sect1_order">
|
---|
[0170229] | 432 | <xsl:choose>
|
---|
[3778352] | 433 | <xsl:when test="string-length($sect1_position) = 1">
|
---|
| 434 | <xsl:text>0</xsl:text>
|
---|
| 435 | <xsl:value-of select="$sect1_position"/>
|
---|
[0170229] | 436 | </xsl:when>
|
---|
| 437 | <xsl:otherwise>
|
---|
[3778352] | 438 | <xsl:value-of select="$sect1_position"/>
|
---|
[0170229] | 439 | </xsl:otherwise>
|
---|
| 440 | </xsl:choose>
|
---|
[3778352] | 441 | </xsl:variable>
|
---|
| 442 | <!-- Script build order -->
|
---|
[097df00] | 443 | <xsl:variable name="order" select="concat($dirname,'/',$ch_order,'_',$sect1_order)"/>
|
---|
| 444 | <!-- Hock to insert scripts before the current one -->
|
---|
| 445 | <xsl:call-template name="insert_script_before">
|
---|
| 446 | <xsl:with-param name="reference" select="@id"/>
|
---|
| 447 | <xsl:with-param name="order" select="$order"/>
|
---|
| 448 | </xsl:call-template>
|
---|
[3778352] | 449 | <!-- Creating dirs and files -->
|
---|
[097df00] | 450 | <exsl:document href="{$order}-{$filename}" method="text">
|
---|
[3778352] | 451 | <xsl:call-template name="header"/>
|
---|
[13b4ab5] | 452 | <xsl:call-template name="user_header"/>
|
---|
| 453 | <xsl:apply-templates select="sect1info[@condition='script']">
|
---|
| 454 | <xsl:with-param name="phase" select="$filename"/>
|
---|
| 455 | </xsl:apply-templates>
|
---|
[570c9f3] | 456 | <xsl:if test="sect2[@role='installation']">
|
---|
| 457 | <xsl:call-template name="unpack"/>
|
---|
| 458 | </xsl:if>
|
---|
[13b4ab5] | 459 | <xsl:call-template name="user_pre_commands"/>
|
---|
[3778352] | 460 | <xsl:call-template name="pre_commands"/>
|
---|
[9c9775f] | 461 | <xsl:apply-templates select=".//screen"/>
|
---|
[3778352] | 462 | <xsl:call-template name="post_commands"/>
|
---|
[13b4ab5] | 463 | <xsl:call-template name="user_footer"/>
|
---|
[570c9f3] | 464 | <xsl:if test="sect2[@role='installation']">
|
---|
| 465 | <xsl:call-template name="clean_sources"/>
|
---|
| 466 | </xsl:if>
|
---|
[3778352] | 467 | <xsl:call-template name="footer"/>
|
---|
[0170229] | 468 | </exsl:document>
|
---|
[097df00] | 469 | <!-- Hock to insert scripts after the current one -->
|
---|
| 470 | <xsl:call-template name="insert_script_after">
|
---|
| 471 | <xsl:with-param name="reference" select="@id"/>
|
---|
| 472 | <xsl:with-param name="order" select="$order"/>
|
---|
| 473 | </xsl:call-template>
|
---|
[0170229] | 474 | </xsl:if>
|
---|
| 475 | </xsl:template>
|
---|
| 476 |
|
---|
[3778352] | 477 |
|
---|
[13b4ab5] | 478 | <!-- sect1info -->
|
---|
| 479 | <xsl:template match="sect1info">
|
---|
| 480 | <!-- Build phase (base file name) to be used for PM -->
|
---|
| 481 | <xsl:param name="phase" select="foo"/>
|
---|
| 482 | <xsl:text>
PKG_PHASE=</xsl:text>
|
---|
| 483 | <xsl:value-of select="$phase"/>
|
---|
| 484 | <!-- Package name -->
|
---|
| 485 | <xsl:apply-templates select="productname"/>
|
---|
| 486 | <!-- Package version -->
|
---|
| 487 | <xsl:apply-templates select="productnumber"/>
|
---|
| 488 | <!-- Tarball name -->
|
---|
| 489 | <xsl:apply-templates select="address"/>
|
---|
| 490 | <xsl:text>

</xsl:text>
|
---|
| 491 | </xsl:template>
|
---|
| 492 |
|
---|
| 493 |
|
---|
| 494 | <!-- productname -->
|
---|
| 495 | <xsl:template match="productname">
|
---|
| 496 | <xsl:text>
PACKAGE=</xsl:text>
|
---|
| 497 | <xsl:apply-templates/>
|
---|
| 498 | </xsl:template>
|
---|
| 499 |
|
---|
| 500 |
|
---|
| 501 | <!-- productnumber -->
|
---|
| 502 | <xsl:template match="productnumber">
|
---|
| 503 | <xsl:text>
VERSION=</xsl:text>
|
---|
| 504 | <xsl:apply-templates/>
|
---|
| 505 | </xsl:template>
|
---|
| 506 |
|
---|
| 507 |
|
---|
| 508 | <!-- address -->
|
---|
| 509 | <xsl:template match="address">
|
---|
| 510 | <xsl:text>
TARBALL=</xsl:text>
|
---|
| 511 | <xsl:call-template name="package_name">
|
---|
| 512 | <xsl:with-param name="url">
|
---|
| 513 | <xsl:apply-templates/>
|
---|
| 514 | </xsl:with-param>
|
---|
| 515 | </xsl:call-template>
|
---|
| 516 | <xsl:apply-templates select="otheraddr" mode="tarball"/>
|
---|
| 517 | </xsl:template>
|
---|
[3778352] | 518 |
|
---|
| 519 |
|
---|
[13b4ab5] | 520 | <!-- otheraddr -->
|
---|
| 521 | <xsl:template match="otheraddr"/>
|
---|
| 522 | <xsl:template match="otheraddr" mode="tarball">
|
---|
| 523 | <xsl:text>
TARBALL_</xsl:text>
|
---|
| 524 | <xsl:value-of select="position()"/>
|
---|
| 525 | <xsl:text>=</xsl:text>
|
---|
| 526 | <xsl:call-template name="package_name">
|
---|
| 527 | <xsl:with-param name="url" select="."/>
|
---|
| 528 | </xsl:call-template>
|
---|
| 529 | </xsl:template>
|
---|
[3778352] | 530 |
|
---|
| 531 |
|
---|
[13b4ab5] | 532 | <!-- screen -->
|
---|
[0170229] | 533 | <xsl:template match="screen">
|
---|
[6db1464] | 534 | <xsl:if test="child::* = userinput and not(@role = 'nodump')">
|
---|
[fa1b640] | 535 | <xsl:call-template name="top_screen_build_fixes"/>
|
---|
| 536 | <xsl:apply-templates/>
|
---|
| 537 | <xsl:call-template name="bottom_screen_build_fixes"/>
|
---|
| 538 | <xsl:text>
</xsl:text>
|
---|
[0170229] | 539 | </xsl:if>
|
---|
| 540 | </xsl:template>
|
---|
| 541 |
|
---|
[13b4ab5] | 542 |
|
---|
[fa1b640] | 543 | <!-- userinput @remap='pre' -->
|
---|
| 544 | <xsl:template match="userinput[@remap='pre']">
|
---|
| 545 | <xsl:apply-templates select="." mode="pre"/>
|
---|
| 546 | </xsl:template>
|
---|
| 547 |
|
---|
| 548 |
|
---|
| 549 | <!-- userinput @remap='configure' -->
|
---|
| 550 | <xsl:template match="userinput[@remap='configure']">
|
---|
| 551 | <xsl:apply-templates select="." mode="configure"/>
|
---|
| 552 | </xsl:template>
|
---|
| 553 |
|
---|
| 554 |
|
---|
| 555 | <!-- userinput @remap='make' -->
|
---|
| 556 | <xsl:template match="userinput[@remap='make']">
|
---|
| 557 | <xsl:apply-templates select="." mode="make"/>
|
---|
| 558 | </xsl:template>
|
---|
| 559 |
|
---|
| 560 |
|
---|
| 561 | <!-- userinput @remap='test' -->
|
---|
| 562 | <xsl:template match="userinput[@remap='test']">
|
---|
| 563 | <xsl:apply-templates select="." mode="test"/>
|
---|
| 564 | </xsl:template>
|
---|
| 565 |
|
---|
| 566 |
|
---|
| 567 | <!-- userinput @remap='install' -->
|
---|
| 568 | <xsl:template match="userinput[@remap='install']">
|
---|
| 569 | <xsl:apply-templates select="." mode="install"/>
|
---|
| 570 | </xsl:template>
|
---|
| 571 |
|
---|
| 572 |
|
---|
| 573 | <!-- userinput @remap='adjust' -->
|
---|
| 574 | <xsl:template match="userinput[@remap='adjust']">
|
---|
| 575 | <xsl:apply-templates select="." mode="adjust"/>
|
---|
| 576 | </xsl:template>
|
---|
| 577 |
|
---|
| 578 |
|
---|
| 579 | <!-- userinput @remap='locale-test' -->
|
---|
| 580 | <xsl:template match="userinput[@remap='locale-test']">
|
---|
| 581 | <xsl:apply-templates select="." mode="locale-test"/>
|
---|
| 582 | </xsl:template>
|
---|
| 583 |
|
---|
| 584 |
|
---|
| 585 | <!-- userinput @remap='locale-full' -->
|
---|
| 586 | <xsl:template match="userinput[@remap='locale-full']">
|
---|
| 587 | <xsl:apply-templates select="." mode="locale-full"/>
|
---|
| 588 | </xsl:template>
|
---|
| 589 |
|
---|
| 590 |
|
---|
| 591 |
|
---|
| 592 | <!-- userinput without @remap -->
|
---|
[13b4ab5] | 593 | <xsl:template match="userinput">
|
---|
[0170229] | 594 | <xsl:choose>
|
---|
[fa1b640] | 595 | <xsl:when test="ancestor::sect2[@role='configuration']">
|
---|
| 596 | <xsl:apply-templates select="." mode="configuration_section"/>
|
---|
[e213e4c] | 597 | </xsl:when>
|
---|
| 598 | <xsl:otherwise>
|
---|
[fa1b640] | 599 | <xsl:apply-templates select="." mode="no_remap"/>
|
---|
[e213e4c] | 600 | </xsl:otherwise>
|
---|
| 601 | </xsl:choose>
|
---|
| 602 | </xsl:template>
|
---|
| 603 |
|
---|
| 604 |
|
---|
| 605 | <!-- replaceable -->
|
---|
| 606 | <xsl:template match="replaceable">
|
---|
| 607 | <xsl:choose>
|
---|
| 608 | <!-- Configuring the Time Zone -->
|
---|
| 609 | <xsl:when test="ancestor::sect2[@id='conf-glibc'] and string()='<xxx>'">
|
---|
| 610 | <xsl:value-of select="$timezone"/>
|
---|
| 611 | </xsl:when>
|
---|
| 612 | <!-- Set paper size for Groff build -->
|
---|
| 613 | <xsl:when test="string()='<paper_size>'">
|
---|
| 614 | <xsl:value-of select="$page"/>
|
---|
| 615 | </xsl:when>
|
---|
| 616 | <!-- LANG setting in /etc/profile -->
|
---|
| 617 | <xsl:when test="contains(string(),'<ll>_<CC>')">
|
---|
| 618 | <xsl:value-of select="$lang"/>
|
---|
| 619 | </xsl:when>
|
---|
| 620 | <xsl:otherwise>
|
---|
| 621 | <xsl:text>**EDITME</xsl:text>
|
---|
| 622 | <xsl:apply-templates/>
|
---|
| 623 | <xsl:text>EDITME**</xsl:text>
|
---|
| 624 | </xsl:otherwise>
|
---|
| 625 | </xsl:choose>
|
---|
| 626 | </xsl:template>
|
---|
| 627 |
|
---|
| 628 |
|
---|
| 629 | <!-- ######################################################################## -->
|
---|
| 630 |
|
---|
| 631 | <!-- ############################# MODE TEMPLATES ########################### -->
|
---|
| 632 |
|
---|
| 633 |
|
---|
| 634 | <!-- mode test -->
|
---|
| 635 | <xsl:template match="userinput" mode="test">
|
---|
| 636 | <xsl:choose>
|
---|
| 637 | <!-- No testsuites run on level 0 -->
|
---|
| 638 | <xsl:when test="$testsuite = '0'"/>
|
---|
| 639 | <!-- On level 1, only final system toolchain testsuites are run -->
|
---|
| 640 | <xsl:when test="$testsuite = '1' and
|
---|
| 641 | not(ancestor::sect1[@id='ch-system-gcc']) and
|
---|
| 642 | not(ancestor::sect1[@id='ch-system-glibc']) and
|
---|
| 643 | not(ancestor::sect1[@id='ch-system-binutils'])"/>
|
---|
| 644 | <!-- On level 2, temp tools testsuites are not run -->
|
---|
| 645 | <xsl:when test="$testsuite = '2' and
|
---|
| 646 | ancestor::chapter[@id='chapter-temporary-tools']"/>
|
---|
| 647 | <!-- Start testsuites command fixes -->
|
---|
| 648 | <xsl:otherwise>
|
---|
[e35e794] | 649 | <xsl:choose>
|
---|
[e213e4c] | 650 | <!-- Final system Glibc -->
|
---|
| 651 | <xsl:when test="contains(string(),'glibc-check-log')">
|
---|
| 652 | <xsl:value-of select="substring-before(string(),'2>&1')"/>
|
---|
| 653 | <xsl:text>>> $TEST_LOG 2>&1 || true</xsl:text>
|
---|
| 654 | </xsl:when>
|
---|
| 655 | <!-- Module-Init-Tools -->
|
---|
| 656 | <xsl:when test="ancestor::sect1[@id='ch-system-module-init-tools']
|
---|
| 657 | and contains(string(),'make check')">
|
---|
| 658 | <xsl:value-of select="substring-before(string(),' check')"/>
|
---|
| 659 | <xsl:if test="$bomb-testsuite = 'n'">
|
---|
| 660 | <xsl:text> -k</xsl:text>
|
---|
[e35e794] | 661 | </xsl:if>
|
---|
[e213e4c] | 662 | <xsl:text> check >> $TEST_LOG 2>&1</xsl:text>
|
---|
| 663 | <xsl:if test="$bomb-testsuite = 'n'">
|
---|
| 664 | <xsl:text> || true</xsl:text>
|
---|
[9c9775f] | 665 | </xsl:if>
|
---|
[e213e4c] | 666 | <xsl:value-of select="substring-after(string(),' check')"/>
|
---|
[6db1464] | 667 | </xsl:when>
|
---|
[e213e4c] | 668 | <!-- If the book uses -k, the testsuite should never bomb -->
|
---|
| 669 | <xsl:when test="contains(string(),'make -k ')">
|
---|
| 670 | <xsl:apply-templates select="." mode="default"/>
|
---|
| 671 | <xsl:text> >> $TEST_LOG 2>&1 || true</xsl:text>
|
---|
[6db1464] | 672 | </xsl:when>
|
---|
[e213e4c] | 673 | <!-- Extra commands in Binutils and GCC -->
|
---|
| 674 | <xsl:when test="contains(string(),'test_summary') or
|
---|
| 675 | contains(string(),'expect -c')">
|
---|
| 676 | <xsl:apply-templates select="." mode="default"/>
|
---|
| 677 | <xsl:text> >> $TEST_LOG</xsl:text>
|
---|
[6db1464] | 678 | </xsl:when>
|
---|
[e213e4c] | 679 | <!-- Remaining extra testsuite commads that don't need be hacked -->
|
---|
| 680 | <xsl:when test="not(contains(string(),'make '))">
|
---|
| 681 | <xsl:apply-templates select="." mode="default"/>
|
---|
| 682 | </xsl:when>
|
---|
| 683 | <!-- Normal testsites run -->
|
---|
[9c9775f] | 684 | <xsl:otherwise>
|
---|
| 685 | <xsl:choose>
|
---|
[e213e4c] | 686 | <!-- No bomb on failures -->
|
---|
[9c9775f] | 687 | <xsl:when test="$bomb-testsuite = 'n'">
|
---|
[e213e4c] | 688 | <xsl:value-of select="substring-before(string(),'make ')"/>
|
---|
| 689 | <xsl:text>make -k </xsl:text>
|
---|
| 690 | <xsl:value-of select="substring-after(string(),'make ')"/>
|
---|
| 691 | <xsl:text> >> $TEST_LOG 2>&1 || true</xsl:text>
|
---|
[9c9775f] | 692 | </xsl:when>
|
---|
[e213e4c] | 693 | <!-- Bomb at the first failure -->
|
---|
[9c9775f] | 694 | <xsl:otherwise>
|
---|
[e213e4c] | 695 | <xsl:apply-templates select="." mode="default"/>
|
---|
[9c9775f] | 696 | <xsl:text> >> $TEST_LOG 2>&1</xsl:text>
|
---|
| 697 | </xsl:otherwise>
|
---|
| 698 | </xsl:choose>
|
---|
| 699 | </xsl:otherwise>
|
---|
| 700 | </xsl:choose>
|
---|
[0170229] | 701 | </xsl:otherwise>
|
---|
| 702 | </xsl:choose>
|
---|
| 703 | </xsl:template>
|
---|
| 704 |
|
---|
[e213e4c] | 705 |
|
---|
| 706 | <!-- mode pre -->
|
---|
| 707 | <xsl:template match="userinput" mode="pre">
|
---|
| 708 | <xsl:apply-templates select="." mode="default"/>
|
---|
| 709 | </xsl:template>
|
---|
| 710 |
|
---|
| 711 |
|
---|
| 712 | <!-- mode configure -->
|
---|
| 713 | <xsl:template match="userinput" mode="configure">
|
---|
| 714 | <xsl:apply-templates select="." mode="default"/>
|
---|
| 715 | </xsl:template>
|
---|
| 716 |
|
---|
| 717 |
|
---|
| 718 | <!-- mode make -->
|
---|
| 719 | <xsl:template match="userinput" mode="make">
|
---|
| 720 | <xsl:apply-templates select="." mode="default"/>
|
---|
| 721 | </xsl:template>
|
---|
| 722 |
|
---|
| 723 |
|
---|
| 724 | <!-- mode install -->
|
---|
| 725 | <xsl:template match="userinput" mode="install">
|
---|
| 726 | <xsl:apply-templates select="." mode="default"/>
|
---|
| 727 | </xsl:template>
|
---|
| 728 |
|
---|
| 729 |
|
---|
| 730 | <!-- mode adjust -->
|
---|
| 731 | <xsl:template match="userinput" mode="adjust">
|
---|
| 732 | <xsl:apply-templates select="." mode="default"/>
|
---|
| 733 | </xsl:template>
|
---|
| 734 |
|
---|
| 735 |
|
---|
| 736 | <!-- mode locale-test -->
|
---|
| 737 | <xsl:template match="userinput" mode="locale-test">
|
---|
| 738 | <xsl:apply-templates select="." mode="default"/>
|
---|
| 739 | </xsl:template>
|
---|
| 740 |
|
---|
| 741 |
|
---|
| 742 | <!-- mode locale-full -->
|
---|
| 743 | <xsl:template match="userinput" mode="locale-full">
|
---|
| 744 | <xsl:apply-templates select="." mode="default"/>
|
---|
[0170229] | 745 | </xsl:template>
|
---|
| 746 |
|
---|
[fa1b640] | 747 |
|
---|
| 748 | <!-- mode configuration_section -->
|
---|
| 749 | <xsl:template match="userinput" mode="configuration_section">
|
---|
| 750 | <xsl:apply-templates select="." mode="default"/>
|
---|
| 751 | </xsl:template>
|
---|
| 752 |
|
---|
| 753 |
|
---|
| 754 | <!-- mode no_remap -->
|
---|
| 755 | <xsl:template match="userinput" mode="no_remap">
|
---|
| 756 | <xsl:apply-templates select="." mode="default"/>
|
---|
| 757 | </xsl:template>
|
---|
| 758 |
|
---|
| 759 |
|
---|
| 760 | <!-- mode default -->
|
---|
| 761 | <xsl:template match="userinput" mode="default">
|
---|
| 762 | <xsl:apply-templates/>
|
---|
| 763 | </xsl:template>
|
---|
| 764 |
|
---|
[0170229] | 765 | </xsl:stylesheet>
|
---|