- Timestamp:
- 09/29/2007 11:12:24 AM (17 years ago)
- Branches:
- experimental
- Children:
- 7b50e2c
- Parents:
- 9ba7afe
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
LFS/lfs.xsl
r9ba7afe rbfcaaa0 12 12 <!-- Including common extensions templates --> 13 13 <xsl:include href="../XSL/user.xsl"/> 14 <xsl:include href="../XSL/custom-tools.xsl"/> 15 <xsl:include href="../XSL/blfs-tool.xsl"/> 14 16 15 17 <!-- ####################### PARAMETERS ################################### --> … … 49 51 50 52 <!-- ####################################################################### --> 51 52 <!-- ########### NAMED USER TEMPLATES TO ALLOW CUSTOMIZATIONS ############## -->53 <!-- ############ Maybe should be placed on a separate file ################ -->54 55 56 <!-- Hock for creating a custom tools directory containing scripts57 to be run after the system has been built58 (to be moved to a separate file) -->59 <xsl:template name="custom-tools">60 <!-- Fixed directory and ch_order values -->61 <xsl:variable name="basedir">custom-tools/20_</xsl:variable>62 <!-- Add an exsl:document block for each script to be created.63 This one is only a dummy example. You must replace "01" by64 the proper build order and "dummy" by the script name -->65 <exsl:document href="{$basedir}01-dummy" method="text">66 <xsl:call-template name="header"/>67 <xsl:text>68 PKG_PHASE=dummy69 PACKAGE=dummy70 VERSION=0.0.071 TARBALL=dummy-0.0.0.tar.bz272 </xsl:text>73 <xsl:call-template name="disk_usage"/>74 <xsl:call-template name="unpack"/>75 <xsl:text>76 cd $PKGDIR77 ./configure --prefix=/usr78 make79 make check80 make install81 </xsl:text>82 <xsl:call-template name="disk_usage"/>83 <xsl:call-template name="clean_sources"/>84 <xsl:call-template name="footer"/>85 </exsl:document>86 </xsl:template>87 88 89 <!-- ####################################################################### -->90 91 <!-- ########################### NAMED TEMPLATES ########################### -->92 93 <!-- Chapter directory name (the same used for HTML output) -->94 <xsl:template name="dirname">95 <xsl:variable name="pi-dir" select="processing-instruction('dbhtml')"/>96 <xsl:variable name="pi-dir-value" select="substring-after($pi-dir,'dir=')"/>97 <xsl:variable name="quote-dir" select="substring($pi-dir-value,1,1)"/>98 <xsl:variable name="dirname" select="substring-before(substring($pi-dir-value,2),$quote-dir)"/>99 <xsl:value-of select="$dirname"/>100 </xsl:template>101 102 103 <!-- Base file name (the same used for HTML output) -->104 <xsl:template name="filename">105 <xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/>106 <xsl:variable name="pi-file-value" select="substring-after($pi-file,'filename=')"/>107 <xsl:variable name="filename" select="substring-before(substring($pi-file-value,2),'.html')"/>108 <xsl:value-of select="$filename"/>109 </xsl:template>110 111 112 <!-- Script header -->113 <xsl:template name="header">114 <xsl:if test="not(@id='ch-system-chroot') and115 not(@id='ch-system-revisedchroot')">116 <!-- Set the shabang -->117 <xsl:choose>118 <xsl:when test="@id='ch-system-creatingdirs' or119 @id='ch-system-createfiles' or120 @id='ch-system-strippingagain'">121 <xsl:text>#!/tools/bin/bash
</xsl:text>122 </xsl:when>123 <xsl:otherwise>124 <xsl:text>#!/bin/bash
</xsl:text>125 </xsl:otherwise>126 </xsl:choose>127 <!-- Set +h -->128 <xsl:text>set +h
</xsl:text>129 <!-- Set -e -->130 <xsl:if test="not(@id='ch-tools-stripping') and131 not(@id='ch-system-strippingagain')">132 <xsl:text>set -e
</xsl:text>133 </xsl:if>134 <!-- Dump a time stamp -->135 <xsl:text>
echo -e "\n`date`\n"
</xsl:text>136 </xsl:if>137 </xsl:template>138 139 140 <!-- Dump current disk usage -->141 <xsl:template name="disk_usage">142 <xsl:if test="not(@id='ch-system-chroot') and143 not(@id='ch-system-revisedchroot')">144 <xsl:choose>145 <xsl:when test="ancestor::chapter[@id='chapter-temporary-tools']">146 <xsl:text>echo -e "\nKB: `du -skx --exclude=jhalfs --exclude=lost+found $LFS`\n"
</xsl:text>147 </xsl:when>148 <xsl:otherwise>149 <xsl:text>echo -e "\nKB: `du -skx --exclude=jhalfs --exclude=lost+found /`\n"
</xsl:text>150 </xsl:otherwise>151 </xsl:choose>152 </xsl:if>153 </xsl:template>154 155 156 <!-- Enter to the sources dir, clean it, unpack the tarball,157 and reset the seconds counter -->158 <xsl:template name="unpack">159 <xsl:text>cd </xsl:text>160 <xsl:if test="ancestor::chapter[@id='chapter-temporary-tools']">161 <xsl:text>$LFS</xsl:text>162 </xsl:if>163 <xsl:text>/sources164 PKGDIR=`tar -tf $TARBALL | head -n1 | sed -e 's@^./@@;s@/.*@@'`165 if [ -d $PKGDIR ]; then166 rm -rf $PKGDIR167 fi168 if [ -d ${PKGDIR%-*}-build ]; then169 rm -rf ${PKGDIR%-*}-build170 fi171 tar -xf $TARBALL172 SECONDS=0173 </xsl:text>174 </xsl:template>175 176 177 <!-- Extra previous commands needed by the book but not inside screen tags -->178 <xsl:template name="pre_commands">179 <xsl:if test="sect2[@role='installation']">180 <xsl:text>cd $PKGDIR
</xsl:text>181 </xsl:if>182 <xsl:if test="@id='ch-system-vim' and $vim-lang = 'y'">183 <xsl:text>tar -xf ../$TARBALL_1 --strip-components=1
</xsl:text>184 </xsl:if>185 </xsl:template>186 187 188 <!-- Extra post commands needed by the book but not inside screen tags -->189 <xsl:template name="post_commands">190 <xsl:if test="$testsuite='3' and @id='ch-tools-glibc'">191 <xsl:variable name="content" select="//userinput[@remap='locale-test']"/>192 <xsl:value-of select="substring-before($content,'/usr/lib/locale')"/>193 <xsl:text>/tools/lib/locale</xsl:text>194 <xsl:value-of select="substring-after($content,'/usr/lib/locale')"/>195 </xsl:if>196 </xsl:template>197 198 199 <!-- Remove sources and build dirs, skipping it from seconds meassurament -->200 <xsl:template name="clean_sources">201 <xsl:text>cd </xsl:text>202 <xsl:if test="ancestor::chapter[@id='chapter-temporary-tools']">203 <xsl:text>$LFS</xsl:text>204 </xsl:if>205 <xsl:text>/sources206 SECS=$SECONDS207 rm -rf $PKGDIR208 rm -rf ${PKGDIR%-*}-build209 SECONDS=$SECS210 </xsl:text>211 </xsl:template>212 213 214 <!-- Script footer -->215 <xsl:template name="footer">216 <!-- Dump the build time and exit -->217 <xsl:if test="not(@id='ch-system-chroot') and218 not(@id='ch-system-revisedchroot')">219 <xsl:text>220 echo -e "\n\nTotalseconds: $SECONDS\n"221 222 exit223 </xsl:text>224 </xsl:if>225 </xsl:template>226 227 228 <!-- Extra commads needed at the start of some screen block229 to allow automatization -->230 <xsl:template name="top_screen_build_fixes">231 <!-- Fix Udev reinstallation after a build failure or on iterative builds -->232 <xsl:if test="contains(string(),'firmware,udev')">233 <xsl:text>if [[ ! -d /lib/udev/devices ]] ; then
</xsl:text>234 </xsl:if>235 </xsl:template>236 237 238 <!-- Extra commads needed at the end of some screen block239 to allow automatization -->240 <xsl:template name="bottom_screen_build_fixes">241 <!-- Fix Udev reinstallation after a build failure or on iterative builds -->242 <xsl:if test="contains(string(),'firmware,udev')">243 <xsl:text>
fi</xsl:text>244 </xsl:if>245 <!-- Copying the kernel config file -->246 <xsl:if test="string() = 'make mrproper'">247 <xsl:text>
cp -v ../kernel-config .config</xsl:text>248 </xsl:if>249 <!-- Don't stop on strip run -->250 <xsl:if test="contains(string(),'strip --strip')">251 <xsl:text> || true</xsl:text>252 </xsl:if>253 </xsl:template>254 255 256 <!-- Extract a package name from a package URL -->257 <xsl:template name="package_name">258 <xsl:param name="url" select="foo"/>259 <xsl:param name="sub-url" select="substring-after($url,'/')"/>260 <xsl:choose>261 <xsl:when test="contains($sub-url,'/')">262 <xsl:call-template name="package_name">263 <xsl:with-param name="url" select="$sub-url"/>264 </xsl:call-template>265 </xsl:when>266 <xsl:otherwise>267 <xsl:value-of select="$sub-url"/>268 </xsl:otherwise>269 </xsl:choose>270 </xsl:template>271 272 273 <!-- Check if a package testsuite must be run -->274 <xsl:template name="run_this_test">275 <xsl:choose>276 <xsl:when test=".//userinput[@remap='test']">277 <xsl:choose>278 <!-- No testsuites run on level 0 -->279 <xsl:when test="$testsuite = '0'">0</xsl:when>280 <!-- On level 1, only final system toolchain testsuites are run -->281 <xsl:when test="$testsuite = '1' and282 not(@id='ch-system-gcc') and283 not(@id='ch-system-glibc') and284 not(@id='ch-system-binutils')">0</xsl:when>285 <!-- On level 2, temp tools testsuites are not run -->286 <xsl:when test="$testsuite = '2' and287 ../@id='chapter-temporary-tools'">0</xsl:when>288 <xsl:otherwise>1</xsl:otherwise>289 </xsl:choose>290 </xsl:when>291 <xsl:otherwise>0</xsl:otherwise>292 </xsl:choose>293 </xsl:template>294 295 296 <!-- Adds blfs-tool support scripts (to be moved to a separate file) -->297 <xsl:template name="blfs-tool">298 <!-- Fixed directory and ch_order values -->299 <xsl:variable name="basedir">blfs-tool-deps/30_</xsl:variable>300 <!-- One exsl:document block for each blfs-tool dependency301 TO BE WRITTEN -->302 <exsl:document href="{$basedir}01-dummy" method="text">303 <xsl:call-template name="header"/>304 <xsl:text>305 PKG_PHASE=dummy306 PACKAGE=dummy307 VERSION=0.0.0308 TARBALL=dummy-0.0.0.tar.bz2309 </xsl:text>310 <xsl:call-template name="disk_usage"/>311 <xsl:call-template name="unpack"/>312 <xsl:text>313 cd $PKGDIR314 ./configure --prefix=/usr315 make316 make check317 make install318 </xsl:text>319 <xsl:call-template name="disk_usage"/>320 <xsl:call-template name="clean_sources"/>321 <xsl:call-template name="footer"/>322 </exsl:document>323 </xsl:template>324 325 326 <!-- ######################################################################## -->327 53 328 54 <!-- ############################# MATCH TEMPLATES ########################## --> … … 468 194 <xsl:text>/jhalfs/test-logs/</xsl:text> 469 195 <xsl:value-of select="$testlogfile"/> 470 <xsl:text>
echo -e "\n`date`\n" >$TEST_LOG</xsl:text>196 <xsl:text>
echo -e "\n`date`\n" > $TEST_LOG</xsl:text> 471 197 </xsl:if> 472 198 <xsl:text>

</xsl:text> … … 623 349 </xsl:template> 624 350 351 352 <!-- ######################################################################## --> 353 354 <!-- ########################### NAMED TEMPLATES ########################### --> 355 356 <!-- Chapter directory name (the same used for HTML output) --> 357 <xsl:template name="dirname"> 358 <xsl:variable name="pi-dir" select="processing-instruction('dbhtml')"/> 359 <xsl:variable name="pi-dir-value" select="substring-after($pi-dir,'dir=')"/> 360 <xsl:variable name="quote-dir" select="substring($pi-dir-value,1,1)"/> 361 <xsl:variable name="dirname" select="substring-before(substring($pi-dir-value,2),$quote-dir)"/> 362 <xsl:value-of select="$dirname"/> 363 </xsl:template> 364 365 366 <!-- Base file name (the same used for HTML output) --> 367 <xsl:template name="filename"> 368 <xsl:variable name="pi-file" select="processing-instruction('dbhtml')"/> 369 <xsl:variable name="pi-file-value" select="substring-after($pi-file,'filename=')"/> 370 <xsl:variable name="filename" select="substring-before(substring($pi-file-value,2),'.html')"/> 371 <xsl:value-of select="$filename"/> 372 </xsl:template> 373 374 375 <!-- Script header --> 376 <xsl:template name="header"> 377 <xsl:if test="not(@id='ch-system-chroot') and 378 not(@id='ch-system-revisedchroot')"> 379 <!-- Set the shabang --> 380 <xsl:choose> 381 <xsl:when test="@id='ch-system-creatingdirs' or 382 @id='ch-system-createfiles' or 383 @id='ch-system-strippingagain'"> 384 <xsl:text>#!/tools/bin/bash
</xsl:text> 385 </xsl:when> 386 <xsl:otherwise> 387 <xsl:text>#!/bin/bash
</xsl:text> 388 </xsl:otherwise> 389 </xsl:choose> 390 <!-- Set +h --> 391 <xsl:text>set +h
</xsl:text> 392 <!-- Set -e --> 393 <xsl:if test="not(@id='ch-tools-stripping') and 394 not(@id='ch-system-strippingagain')"> 395 <xsl:text>set -e
</xsl:text> 396 </xsl:if> 397 <!-- Dump a time stamp --> 398 <xsl:text>
echo -e "\n`date`\n"
</xsl:text> 399 </xsl:if> 400 </xsl:template> 401 402 403 <!-- Dump current disk usage --> 404 <xsl:template name="disk_usage"> 405 <xsl:if test="not(@id='ch-system-chroot') and 406 not(@id='ch-system-revisedchroot')"> 407 <xsl:choose> 408 <xsl:when test="ancestor::chapter[@id='chapter-temporary-tools']"> 409 <xsl:text>echo -e "\nKB: `du -skx --exclude=jhalfs --exclude=lost+found $LFS`\n"
</xsl:text> 410 </xsl:when> 411 <xsl:otherwise> 412 <xsl:text>echo -e "\nKB: `du -skx --exclude=jhalfs --exclude=lost+found /`\n"
</xsl:text> 413 </xsl:otherwise> 414 </xsl:choose> 415 </xsl:if> 416 </xsl:template> 417 418 419 <!-- Enter to the sources dir, clean it, unpack the tarball, 420 and reset the seconds counter --> 421 <xsl:template name="unpack"> 422 <xsl:text>cd </xsl:text> 423 <xsl:if test="ancestor::chapter[@id='chapter-temporary-tools']"> 424 <xsl:text>$LFS</xsl:text> 425 </xsl:if> 426 <xsl:text>/sources 427 PKGDIR=`tar -tf $TARBALL | head -n1 | sed -e 's@^./@@;s@/.*@@'` 428 if [ -d $PKGDIR ]; then 429 rm -rf $PKGDIR 430 fi 431 if [ -d ${PKGDIR%-*}-build ]; then 432 rm -rf ${PKGDIR%-*}-build 433 fi 434 tar -xf $TARBALL 435 SECONDS=0 436 </xsl:text> 437 </xsl:template> 438 439 440 <!-- Extra previous commands needed by the book but not inside screen tags --> 441 <xsl:template name="pre_commands"> 442 <xsl:if test="sect2[@role='installation']"> 443 <xsl:text>cd $PKGDIR
</xsl:text> 444 </xsl:if> 445 <xsl:if test="@id='ch-system-vim' and $vim-lang = 'y'"> 446 <xsl:text>tar -xf ../$TARBALL_1 --strip-components=1
</xsl:text> 447 </xsl:if> 448 </xsl:template> 449 450 451 <!-- Extra post commands needed by the book but not inside screen tags --> 452 <xsl:template name="post_commands"> 453 <xsl:if test="$testsuite='3' and @id='ch-tools-glibc'"> 454 <xsl:variable name="content" select="//userinput[@remap='locale-test']"/> 455 <xsl:value-of select="substring-before($content,'/usr/lib/locale')"/> 456 <xsl:text>/tools/lib/locale</xsl:text> 457 <xsl:value-of select="substring-after($content,'/usr/lib/locale')"/> 458 </xsl:if> 459 </xsl:template> 460 461 462 <!-- Remove sources and build dirs, skipping it from seconds meassurament --> 463 <xsl:template name="clean_sources"> 464 <xsl:text>cd </xsl:text> 465 <xsl:if test="ancestor::chapter[@id='chapter-temporary-tools']"> 466 <xsl:text>$LFS</xsl:text> 467 </xsl:if> 468 <xsl:text>/sources 469 SECS=$SECONDS 470 rm -rf $PKGDIR 471 rm -rf ${PKGDIR%-*}-build 472 SECONDS=$SECS 473 </xsl:text> 474 </xsl:template> 475 476 477 <!-- Script footer --> 478 <xsl:template name="footer"> 479 <!-- Dump the build time and exit --> 480 <xsl:if test="not(@id='ch-system-chroot') and 481 not(@id='ch-system-revisedchroot')"> 482 <xsl:text> 483 echo -e "\n\nTotalseconds: $SECONDS\n" 484 485 exit 486 </xsl:text> 487 </xsl:if> 488 </xsl:template> 489 490 491 <!-- Extra commads needed at the start of some screen block 492 to allow automatization --> 493 <xsl:template name="top_screen_build_fixes"> 494 <!-- Fix Udev reinstallation after a build failure or on iterative builds --> 495 <xsl:if test="contains(string(),'firmware,udev')"> 496 <xsl:text>if [[ ! -d /lib/udev/devices ]] ; then
</xsl:text> 497 </xsl:if> 498 </xsl:template> 499 500 501 <!-- Extra commads needed at the end of some screen block 502 to allow automatization --> 503 <xsl:template name="bottom_screen_build_fixes"> 504 <!-- Fix Udev reinstallation after a build failure or on iterative builds --> 505 <xsl:if test="contains(string(),'firmware,udev')"> 506 <xsl:text>
fi</xsl:text> 507 </xsl:if> 508 <!-- Copying the kernel config file --> 509 <xsl:if test="string() = 'make mrproper'"> 510 <xsl:text>
cp -v ../kernel-config .config</xsl:text> 511 </xsl:if> 512 <!-- Don't stop on strip run --> 513 <xsl:if test="contains(string(),'strip --strip')"> 514 <xsl:text> || true</xsl:text> 515 </xsl:if> 516 </xsl:template> 517 518 519 <!-- Extract a package name from a package URL --> 520 <xsl:template name="package_name"> 521 <xsl:param name="url" select="foo"/> 522 <xsl:param name="sub-url" select="substring-after($url,'/')"/> 523 <xsl:choose> 524 <xsl:when test="contains($sub-url,'/')"> 525 <xsl:call-template name="package_name"> 526 <xsl:with-param name="url" select="$sub-url"/> 527 </xsl:call-template> 528 </xsl:when> 529 <xsl:otherwise> 530 <xsl:value-of select="$sub-url"/> 531 </xsl:otherwise> 532 </xsl:choose> 533 </xsl:template> 534 535 536 <!-- Check if a package testsuite must be run --> 537 <xsl:template name="run_this_test"> 538 <xsl:choose> 539 <xsl:when test=".//userinput[@remap='test']"> 540 <xsl:choose> 541 <!-- No testsuites run on level 0 --> 542 <xsl:when test="$testsuite = '0'">0</xsl:when> 543 <!-- On level 1, only final system toolchain testsuites are run --> 544 <xsl:when test="$testsuite = '1' and 545 not(@id='ch-system-gcc') and 546 not(@id='ch-system-glibc') and 547 not(@id='ch-system-binutils')">0</xsl:when> 548 <!-- On level 2, temp tools testsuites are not run --> 549 <xsl:when test="$testsuite = '2' and 550 ../@id='chapter-temporary-tools'">0</xsl:when> 551 <xsl:otherwise>1</xsl:otherwise> 552 </xsl:choose> 553 </xsl:when> 554 <xsl:otherwise>0</xsl:otherwise> 555 </xsl:choose> 556 </xsl:template> 557 625 558 </xsl:stylesheet>
Note:
See TracChangeset
for help on using the changeset viewer.