- Timestamp:
- 02/05/2018 06:12:17 PM (6 years ago)
- Branches:
- ablfs-more, legacy, trunk
- Children:
- 7bc70cd
- Parents:
- ad747ed
- Location:
- BLFS
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
BLFS/gen_pkg_book.sh
rad747ed r67c3df4 52 52 WRAP_INSTALL=* | \ 53 53 DEL_LA_FILES=* | \ 54 STATS=* | \ 54 55 SUDO=* ) eval ${REPLY} # Define/set a global variable.. 55 56 continue ;; … … 72 73 WRAP_INSTALL=${WRAP_INSTALL:-n} 73 74 DEL_LA_FILES=${DEL_LA_FILES:-n} 75 STATS=${STATS:-n} 74 76 } 75 77 … … 95 97 # 96 98 #--------------------------# 97 generate_deps() { #99 generate_deps() { # 98 100 #--------------------------# 99 101 … … 200 202 echo -en "\n\tGenerating the build scripts ...\n" 201 203 rm -rf scripts 204 if test $STATS = y; then 205 LIST_STAT="${TARGET[*]}" 206 else 207 LIST_STAT="" 208 fi 202 209 xsltproc --xinclude --nonet \ 203 210 --stringparam sudo "$SUDO" \ 204 211 --stringparam wrap-install "$WRAP_INSTALL" \ 205 212 --stringparam del-la-files "$DEL_LA_FILES" \ 213 --stringparam list-stat "$LIST_STAT" \ 206 214 -o ./scripts/ ${MakeScripts} \ 207 215 ${BookXml} -
BLFS/xsl/gen_config.xsl
rad747ed r67c3df4 80 80 This option should be active on any system mixing libtool 81 81 and meson build systems. ImageMagick .la files are preserved. 82 83 config STATS 84 bool "Generate statistics for the requested package(s)" 85 default n 86 help 87 If you want timing and memory footprint statistics to be 88 generated for the packages you build (not their dependencies), 89 set this option to y. 82 90 </xsl:text> 83 91 </xsl:template> -
BLFS/xsl/scripts.xsl
rad747ed r67c3df4 26 26 <xsl:param name="wrap-install" select="'n'"/> 27 27 28 <!-- list of packages needing stats --> 29 <xsl:param name="list-stat" select="''"/> 30 28 31 <!-- Remove libtool .la files --> 29 32 <xsl:param name="del-la-files" select="'y'"/> … … 40 43 41 44 </xsl:variable> 45 46 <xsl:variable name="list-stat-norm" 47 select="concat(' ', normalize-space($list-stat),' ')"/> 48 42 49 <xsl:template match="/"> 43 50 <xsl:apply-templates select="//sect1"/> … … 97 104 98 105 </xsl:text> 106 107 <!-- If stats are requested, include some definitions and intitializations --> 108 <xsl:if test="contains($list-stat-norm,concat(' ',@id,' '))"> 109 <xsl:text>INFOLOG=$(pwd)/info-${PKG_DIR} 110 TESTLOG=$(pwd)/test-${PKG_DIR} 111 unset MAKEFLAGS 112 #MAKEFLAGS=-j4 113 echo MAKEFLAGS: $MAKEFLAGS > $INFOLOG 114 > $TESTLOG 115 PKG_DEST=${BUILD_DIR}/dest 116 rm -rf $PKG_DEST 117 118 </xsl:text> 119 </xsl:if> 99 120 <!-- Download code and build commands --> 100 121 <xsl:apply-templates select="sect2"/> … … 141 162 </xsl:if> 142 163 <xsl:text>rm -rf 143 case $PACKAGE in 164 165 </xsl:text> 166 <!-- If stats are requested, insert the start size --> 167 <xsl:if test="contains($list-stat-norm,concat(' ',../@id,' '))"> 168 <xsl:text>echo Start Size: $(sudo du -skx --exclude home /) >> $INFOLOG 169 170 </xsl:text> 171 </xsl:if> 172 173 <xsl:text>case $PACKAGE in 144 174 *.tar.gz|*.tar.bz2|*.tar.xz|*.tgz|*.tar.lzma) 145 175 tar -xvf $SRC_DIR/$PACKAGE > unpacked … … 170 200 cd $JH_UNPACKDIR
 171 201 </xsl:text> 202 <!-- If stats are requested, insert the start time --> 203 <xsl:if test="contains($list-stat-norm,concat(' ',../@id,' '))"> 204 <xsl:text>echo Start Time: ${SECONDS} >> $INFOLOG 205 206 </xsl:text> 207 </xsl:if> 208 172 209 <xsl:apply-templates select=".//screen | .//para/command"/> 173 210 <xsl:if test="$sudo = 'y'"> … … 422 459 <xsl:if test="child::* = userinput and not(@role = 'nodump')"> 423 460 <xsl:choose> 424 <xsl:when test="@role = 'root'"> 425 <xsl:if test="not(preceding-sibling::screen[1][@role='root'])"> 426 <xsl:if test="$sudo = 'y'"> 427 <xsl:text>sudo -E sh << ROOT_EOF
</xsl:text> 428 </xsl:if> 429 <xsl:if test="$wrap-install = 'y' and 461 <!-- First the case of installation instructions --> 462 <xsl:when test="@role = 'root' and 430 463 ancestor::sect2[@role='installation'] and 431 464 not(contains(string(),'useradd')) and 432 465 not(contains(string(),'groupadd'))"> 466 <xsl:if test="not(preceding-sibling::screen[1][@role='root'])"> 467 <xsl:if test="contains($list-stat-norm, 468 concat(' ', 469 ancestor::sect1/@id, 470 ' '))"> 471 <xsl:call-template name="output-destdir"/> 472 </xsl:if> 473 <xsl:if test="$sudo = 'y'"> 474 <xsl:text>sudo -E sh << ROOT_EOF
</xsl:text> 475 </xsl:if> 476 <xsl:if test="$wrap-install = 'y'"> 433 477 <xsl:text>if [ -r "$JH_PACK_INSTALL" ]; then 434 478 source $JH_PACK_INSTALL … … 442 486 <xsl:apply-templates mode="root"/> 443 487 <xsl:if test="not(following-sibling::screen[1][@role='root'])"> 444 <xsl:if test="$del-la-files = 'y' and 445 ancestor::sect2[@role='installation'] and 446 not(contains(string(),'useradd')) and 447 not(contains(string(),'groupadd'))"> 488 <xsl:if test="$del-la-files = 'y'"> 448 489 <xsl:call-template name="output-root"> 449 490 <xsl:with-param name="out-string" select="$la-files-instr"/> 450 491 </xsl:call-template> 451 492 </xsl:if> 452 <xsl:if test="$wrap-install = 'y' and 453 ancestor::sect2[@role='installation'] and 454 not(contains(string(),'useradd')) and 455 not(contains(string(),'groupadd'))"> 493 <xsl:if test="$wrap-install = 'y'"> 456 494 <xsl:text>'
packInstall</xsl:text> 457 495 </xsl:if> … … 461 499 </xsl:if> 462 500 </xsl:when> 501 <!-- then the case of other instructions run as root (configuration mainly) --> 502 <xsl:when test="@role = 'root'"> 503 <xsl:if test="not(preceding-sibling::screen[1][@role='root'])"> 504 <xsl:if test="$sudo = 'y'"> 505 <xsl:text>sudo -E sh << ROOT_EOF
</xsl:text> 506 </xsl:if> 507 </xsl:if> 508 <xsl:apply-templates mode="root"/> 509 <xsl:if test="not(following-sibling::screen[1][@role='root'])"> 510 <xsl:if test="$sudo = 'y'"> 511 <xsl:text>
ROOT_EOF</xsl:text> 512 </xsl:if> 513 </xsl:if> 514 </xsl:when> 515 <!-- then all the instructions run as user --> 463 516 <xsl:otherwise> 464 517 <xsl:apply-templates select="userinput"/> … … 535 588 <xsl:template match="para/command"> 536 589 <xsl:variable name="ns" select="normalize-space(string())"/> 537 <xsl:if test="(contains($ns,'test') or 538 contains($ns,'check'))"> 539 <xsl:text>#</xsl:text> 540 <xsl:value-of select="substring-before($ns,'make ')"/> 541 <xsl:text>make </xsl:text> 542 <xsl:if test="not(contains($ns,'-k'))"> 543 <xsl:text>-k </xsl:text> 590 <xsl:if test="contains($ns,'test') or 591 contains($ns,'check')"> 592 <xsl:choose> 593 <xsl:when test="contains($list-stat-norm, 594 concat(' ',ancestor::sect1/@id,' '))"> 595 <xsl:text> 596 echo Time after make: ${SECONDS} >> $INFOLOG 597 echo Size after make: $(sudo du -skx --exclude home /) >> $INFOLOG 598 echo Time before test: ${SECONDS} >> $INFOLOG 599 </xsl:text> 600 </xsl:when> 601 <xsl:otherwise> 602 <xsl:text>#</xsl:text> 603 </xsl:otherwise> 604 </xsl:choose> 605 <xsl:choose> 606 <xsl:when test="contains($ns,'make')"> 607 <xsl:value-of select="substring-before($ns,'make ')"/> 608 <xsl:text>make </xsl:text> 609 <xsl:if test="not(contains($ns,'-k'))"> 610 <xsl:text>-k </xsl:text> 611 </xsl:if> 612 <xsl:value-of select="substring-after($ns,'make ')"/> 613 </xsl:when> 614 <xsl:otherwise> 615 <xsl:copy-of select="$ns"/> 616 </xsl:otherwise> 617 </xsl:choose> 618 <xsl:if test="contains($list-stat-norm, 619 concat(' ',ancestor::sect1/@id,' '))"> 620 <xsl:text> >> $TESTLOG 2>&1</xsl:text> 544 621 </xsl:if> 545 <xsl:value-of select="substring-after($ns,'make ')"/>546 622 <xsl:text> || true
</xsl:text> 547 623 </xsl:if> … … 638 714 </xsl:template> 639 715 716 <xsl:template name="output-destdir"> 717 <!-- Hopefully, the current node is the first screen with role equal to root. 718 We first output stats, since we are only called if stats are needed. 719 then we output DESTDIR instructions,etc --> 720 <xsl:text> 721 echo Time after tests: ${SECONDS} >> $INFOLOG 722 echo Size after tests: $(sudo du -skx --exclude home /) >> $INFOLOG 723 echo Time before install: ${SECONDS} >> $INFOLOG 724 </xsl:text> 725 <xsl:apply-templates 726 select="userinput|following-sibling::screen[@role='root']/userinput" 727 mode="destdir"/> 728 <xsl:text> 729 echo Time after install: ${SECONDS} >> $INFOLOG 730 echo Size after install: $(sudo du -skx --exclude home /) >> $INFOLOG 731 </xsl:text> 732 </xsl:template> 733 734 <xsl:template match="userinput" mode="destdir"> 735 <xsl:choose> 736 <xsl:when test="./literal"> 737 <xsl:call-template name="outputpkgdest"> 738 <xsl:with-param name="outputstring" select="text()[1]"/> 739 </xsl:call-template> 740 <xsl:apply-templates select="literal"/> 741 <xsl:call-template name="outputpkgdest"> 742 <xsl:with-param name="outputstring" select="text()[2]"/> 743 </xsl:call-template> 744 </xsl:when> 745 <xsl:otherwise> 746 <xsl:call-template name="outputpkgdest"> 747 <xsl:with-param name="outputstring" select="string()"/> 748 </xsl:call-template> 749 </xsl:otherwise> 750 </xsl:choose> 751 <xsl:text>
</xsl:text> 752 </xsl:template> 753 754 <xsl:template name="outputpkgdest"> 755 <xsl:param name="outputstring" select="'foo'"/> 756 <xsl:choose> 757 <xsl:when test="contains($outputstring,'make ')"> 758 <xsl:choose> 759 <xsl:when test="not(starts-with($outputstring,'make'))"> 760 <xsl:call-template name="outputpkgdest"> 761 <xsl:with-param name="outputstring" 762 select="substring-before($outputstring,'make')"/> 763 </xsl:call-template> 764 <xsl:call-template name="outputpkgdest"> 765 <xsl:with-param 766 name="outputstring" 767 select="substring-after($outputstring, 768 substring-before($outputstring,'make'))"/> 769 </xsl:call-template> 770 </xsl:when> 771 <xsl:otherwise> 772 <xsl:text>make DESTDIR=$PKG_DEST</xsl:text> 773 <xsl:call-template name="outputpkgdest"> 774 <xsl:with-param 775 name="outputstring" 776 select="substring-after($outputstring,'make')"/> 777 </xsl:call-template> 778 </xsl:otherwise> 779 </xsl:choose> 780 </xsl:when> 781 <xsl:when test="contains($outputstring,'ninja install')"> 782 <xsl:choose> 783 <xsl:when test="not(starts-with($outputstring,'ninja install'))"> 784 <xsl:call-template name="outputpkgdest"> 785 <xsl:with-param name="outputstring" 786 select="substring-before($outputstring,'ninja install')"/> 787 </xsl:call-template> 788 <xsl:call-template name="outputpkgdest"> 789 <xsl:with-param 790 name="outputstring" 791 select="substring-after($outputstring, 792 substring-before($outputstring,'ninja install'))"/> 793 </xsl:call-template> 794 </xsl:when> 795 <xsl:otherwise> 796 <xsl:text>DESTDIR=$PKG_DEST ninja</xsl:text> 797 <xsl:call-template name="outputpkgdest"> 798 <xsl:with-param 799 name="outputstring" 800 select="substring-after($outputstring,'ninja')"/> 801 </xsl:call-template> 802 </xsl:otherwise> 803 </xsl:choose> 804 </xsl:when> 805 <xsl:otherwise> <!-- no make nor ninja in this string --> 806 <xsl:choose> 807 <xsl:when test="contains($outputstring,'>/') and 808 not(contains(substring-before($outputstring,'>/'),' /'))"> 809 <xsl:value-of select="substring-before($outputstring,'>/')"/> 810 <xsl:text>>$PKG_DEST/</xsl:text> 811 <xsl:call-template name="outputpkgdest"> 812 <xsl:with-param name="outputstring" select="substring-after($outputstring,'>/')"/> 813 </xsl:call-template> 814 </xsl:when> 815 <xsl:when test="contains($outputstring,' /')"> 816 <xsl:value-of select="substring-before($outputstring,' /')"/> 817 <xsl:text> $PKG_DEST/</xsl:text> 818 <xsl:call-template name="outputpkgdest"> 819 <xsl:with-param name="outputstring" select="substring-after($outputstring,' /')"/> 820 </xsl:call-template> 821 </xsl:when> 822 <xsl:otherwise> 823 <xsl:value-of select="$outputstring"/> 824 </xsl:otherwise> 825 </xsl:choose> 826 </xsl:otherwise> 827 </xsl:choose> 828 </xsl:template> 829 640 830 </xsl:stylesheet>
Note:
See TracChangeset
for help on using the changeset viewer.