Migrated optimizations support to XSL-based code.
This commit is contained in:
parent
dfa51ee1dd
commit
e2dfa2c90f
12 changed files with 508 additions and 304 deletions
25
LFS/lfs.xsl
25
LFS/lfs.xsl
|
@ -10,9 +10,10 @@
|
||||||
<!-- XSLT stylesheet to create shell scripts from LFS books. -->
|
<!-- XSLT stylesheet to create shell scripts from LFS books. -->
|
||||||
|
|
||||||
<!-- Including common extensions templates -->
|
<!-- Including common extensions templates -->
|
||||||
<xsl:include href="../XSL/user.xsl"/>
|
|
||||||
<xsl:include href="../XSL/custom-tools.xsl"/>
|
|
||||||
<xsl:include href="../XSL/blfs-tool.xsl"/>
|
<xsl:include href="../XSL/blfs-tool.xsl"/>
|
||||||
|
<xsl:include href="../XSL/custom-tools.xsl"/>
|
||||||
|
<xsl:include href="../XSL/optimize.xsl"/>
|
||||||
|
<xsl:include href="../XSL/user.xsl"/>
|
||||||
|
|
||||||
<!-- ####################### PARAMETERS ################################### -->
|
<!-- ####################### PARAMETERS ################################### -->
|
||||||
|
|
||||||
|
@ -48,6 +49,13 @@
|
||||||
<!-- blfs-tool support -->
|
<!-- blfs-tool support -->
|
||||||
<xsl:param name="blfs-tool">n</xsl:param>
|
<xsl:param name="blfs-tool">n</xsl:param>
|
||||||
|
|
||||||
|
<!-- optimize support level
|
||||||
|
0 = none
|
||||||
|
1 = not for temporary tools
|
||||||
|
2 = all packages
|
||||||
|
-->
|
||||||
|
<xsl:param name="optimize">0</xsl:param>
|
||||||
|
|
||||||
|
|
||||||
<!-- ####################################################################### -->
|
<!-- ####################################################################### -->
|
||||||
|
|
||||||
|
@ -176,7 +184,7 @@
|
||||||
<!-- Used to set and initialize the testuite log file -->
|
<!-- Used to set and initialize the testuite log file -->
|
||||||
<xsl:param name="testlogfile" select="foo"/>
|
<xsl:param name="testlogfile" select="foo"/>
|
||||||
<xsl:param name="run_this_test" select="foo"/>
|
<xsl:param name="run_this_test" select="foo"/>
|
||||||
<!-- Build phase (base file name) to be used for PM -->
|
<!-- Build phase (base file name) to be used for PM and optimize -->
|
||||||
<xsl:param name="phase" select="foo"/>
|
<xsl:param name="phase" select="foo"/>
|
||||||
<xsl:text>
PKG_PHASE=</xsl:text>
|
<xsl:text>
PKG_PHASE=</xsl:text>
|
||||||
<xsl:value-of select="$phase"/>
|
<xsl:value-of select="$phase"/>
|
||||||
|
@ -186,6 +194,17 @@
|
||||||
<xsl:apply-templates select="productnumber"/>
|
<xsl:apply-templates select="productnumber"/>
|
||||||
<!-- Tarball name -->
|
<!-- Tarball name -->
|
||||||
<xsl:apply-templates select="address"/>
|
<xsl:apply-templates select="address"/>
|
||||||
|
<!-- Add optimization envars -->
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="$optimize = '0'"/>
|
||||||
|
<xsl:when test="$optimize = '1' and ancestor::chapter[@id='chapter-temporary-tools']"/>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<xsl:call-template name="optimize">
|
||||||
|
<xsl:with-param name="package" select="$phase"/>
|
||||||
|
</xsl:call-template>
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
|
<!-- Set and initialize testsuite log file -->
|
||||||
<xsl:if test="$run_this_test = '1'">
|
<xsl:if test="$run_this_test = '1'">
|
||||||
<xsl:text>
TEST_LOG=</xsl:text>
|
<xsl:text>
TEST_LOG=</xsl:text>
|
||||||
<xsl:if test="ancestor::chapter[@id='chapter-temporary-tools']">
|
<xsl:if test="ancestor::chapter[@id='chapter-temporary-tools']">
|
||||||
|
|
485
XSL/optimize.xsl
Normal file
485
XSL/optimize.xsl
Normal file
|
@ -0,0 +1,485 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
|
||||||
|
<!-- $Id$ -->
|
||||||
|
|
||||||
|
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||||
|
version="1.0">
|
||||||
|
|
||||||
|
<!-- ####################### PARAMETERS ################################### -->
|
||||||
|
|
||||||
|
<!-- ###### MAKEFLAGS ###### -->
|
||||||
|
|
||||||
|
<!-- Should MAKEFLAGS be set? y = yes, n = no -->
|
||||||
|
<xsl:param name="set_makeflags">y</xsl:param>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Jobs control level. Left it empty for no jobs control -->
|
||||||
|
<xsl:param name="jobs">-j3</xsl:param>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Jobs control black-listed packages. One in each line.
|
||||||
|
NOTE: This and other similar parameters uses the PKG_PHASE value -->
|
||||||
|
<xsl:param name="no_jobs">
|
||||||
|
keep_this_line
|
||||||
|
autoconf
|
||||||
|
dejagnu
|
||||||
|
gettext
|
||||||
|
groff
|
||||||
|
man-db
|
||||||
|
keep_this_line
|
||||||
|
</xsl:param>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Additional make flags. -->
|
||||||
|
<xsl:param name="makeflags"></xsl:param>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Additional make flags black-listed packages. One in each line. -->
|
||||||
|
<xsl:param name="no_mkflags">
|
||||||
|
keep_this_line
|
||||||
|
keep_this_line
|
||||||
|
</xsl:param>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ############################ -->
|
||||||
|
|
||||||
|
<!-- ###### COMPILER FLAGS ###### -->
|
||||||
|
|
||||||
|
<!-- Should compiler envars be set? y = yes, n = no -->
|
||||||
|
<xsl:param name="set_buildflags">y</xsl:param>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Compiler optimizations black-listed packages. One in each line. -->
|
||||||
|
<xsl:param name="no_buildflags">
|
||||||
|
keep_this_line
|
||||||
|
binutils
|
||||||
|
binutils-pass1
|
||||||
|
binutils-pass2
|
||||||
|
gcc
|
||||||
|
gcc-pass1
|
||||||
|
gcc-pass2
|
||||||
|
glibc
|
||||||
|
grub
|
||||||
|
keep_this_line
|
||||||
|
</xsl:param>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Default envars setting. Left empty to not set a variable. -->
|
||||||
|
|
||||||
|
<!-- Default CFLAGS -->
|
||||||
|
<xsl:param name="cflags">-O3 -pipe</xsl:param>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Default CXXFLAGS -->
|
||||||
|
<xsl:param name="cxxflags">$CFLAGS</xsl:param>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Default OTHER_CFLAGS -->
|
||||||
|
<xsl:param name="other_cflags">$CFLAGS</xsl:param>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Default OTHER_CXXFLAGS -->
|
||||||
|
<xsl:param name="other_cxxflags">$CXXFLAGS</xsl:param>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Default LDFLAGS -->
|
||||||
|
<xsl:param name="ldflags"></xsl:param>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Default OTHER_LDFLAGS -->
|
||||||
|
<xsl:param name="other_ldflags"></xsl:param>
|
||||||
|
|
||||||
|
<!-- -->
|
||||||
|
|
||||||
|
<!-- By-package additional settings. A pair "package value" on each line.
|
||||||
|
The values set here will be added to the ones set above -->
|
||||||
|
|
||||||
|
<!-- Extra CFLAGS -->
|
||||||
|
<xsl:param name="extra_cflags">
|
||||||
|
zlib -fPIC
|
||||||
|
</xsl:param>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Extra CXXFLAGS -->
|
||||||
|
<xsl:param name="extra_cxxflags">
|
||||||
|
</xsl:param>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Extra OTHER_CFLAGS -->
|
||||||
|
<xsl:param name="extra_other_cflags">
|
||||||
|
</xsl:param>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Extra OTHER_CXXFLAGS -->
|
||||||
|
<xsl:param name="extra_other_cxxflags">
|
||||||
|
</xsl:param>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Extra LDFLAGS -->
|
||||||
|
<xsl:param name="extra_ldflags">
|
||||||
|
</xsl:param>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Extra OTHER_LDFLAGS -->
|
||||||
|
<xsl:param name="extra_other_ldflags">
|
||||||
|
</xsl:param>
|
||||||
|
|
||||||
|
<!-- -->
|
||||||
|
|
||||||
|
<!-- By-package settings. A pair "package value" on each line.
|
||||||
|
The values set here will override the ones set above -->
|
||||||
|
|
||||||
|
<!-- Extra CFLAGS -->
|
||||||
|
<xsl:param name="override_cflags">
|
||||||
|
</xsl:param>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Extra CXXFLAGS -->
|
||||||
|
<xsl:param name="override_cxxflags">
|
||||||
|
</xsl:param>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Extra OTHER_CFLAGS -->
|
||||||
|
<xsl:param name="override_other_cflags">
|
||||||
|
</xsl:param>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Extra OTHER_CXXFLAGS -->
|
||||||
|
<xsl:param name="override_other_cxxflags">
|
||||||
|
</xsl:param>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Extra LDFLAGS -->
|
||||||
|
<xsl:param name="override_ldflags">
|
||||||
|
</xsl:param>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Extra OTHER_LDFLAGS -->
|
||||||
|
<xsl:param name="override_other_ldflags">
|
||||||
|
</xsl:param>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- ######################################################################## -->
|
||||||
|
|
||||||
|
<!-- ########################### NAMED TEMPLATES ########################### -->
|
||||||
|
|
||||||
|
<!-- Master optimizations template -->
|
||||||
|
<xsl:template name="optimize">
|
||||||
|
<xsl:param name="package" select="foo"/>
|
||||||
|
<xsl:text>

</xsl:text>
|
||||||
|
<xsl:if test="$set_makeflags = 'y'">
|
||||||
|
<xsl:call-template name="makeflags">
|
||||||
|
<xsl:with-param name="package" select="$package"/>
|
||||||
|
</xsl:call-template>
|
||||||
|
</xsl:if>
|
||||||
|
<xsl:if test="$set_buildflags = 'y' and
|
||||||
|
not(contains(normalize-space($no_buildflags),concat(' ',$package,' ')))">
|
||||||
|
<xsl:call-template name="buildflags">
|
||||||
|
<xsl:with-param name="package" select="$package"/>
|
||||||
|
</xsl:call-template>
|
||||||
|
</xsl:if>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- MAKEFLAGS template -->
|
||||||
|
<xsl:template name="makeflags">
|
||||||
|
<xsl:param name="package" select="foo"/>
|
||||||
|
<!-- Test if jobs control must be set -->
|
||||||
|
<xsl:variable name="set_jobs">
|
||||||
|
<xsl:if test="$jobs != '' and
|
||||||
|
not(contains(normalize-space($no_jobs),concat(' ',$package,' ')))">1</xsl:if>
|
||||||
|
</xsl:variable>
|
||||||
|
<!-- Test if additional make flags must be set -->
|
||||||
|
<xsl:variable name="add_mkflags">
|
||||||
|
<xsl:if test="$makeflags != '' and
|
||||||
|
not(contains(normalize-space($no_mkflags),concat(' ',$package,' ')))">1</xsl:if>
|
||||||
|
</xsl:variable>
|
||||||
|
<!-- Write the envar -->
|
||||||
|
<xsl:if test="$set_jobs = '1' or $add_mkflags = '1'">
|
||||||
|
<xsl:text>MAKEFLAGS="</xsl:text>
|
||||||
|
<!-- Write jobs control value -->
|
||||||
|
<xsl:if test="$set_jobs = '1'">
|
||||||
|
<xsl:value-of select="$jobs"/>
|
||||||
|
</xsl:if>
|
||||||
|
<!-- If both values will be written, be sure that are space separated -->
|
||||||
|
<xsl:if test="$set_jobs = '1' and $add_mkflags = '1'">
|
||||||
|
<xsl:text> </xsl:text>
|
||||||
|
</xsl:if>
|
||||||
|
<!-- Write additional make flags value -->
|
||||||
|
<xsl:if test="$add_mkflags = '1'">
|
||||||
|
<xsl:value-of select="$makeflags"/>
|
||||||
|
</xsl:if>
|
||||||
|
<xsl:text>"
</xsl:text>
|
||||||
|
</xsl:if>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Master compiler flags template -->
|
||||||
|
<xsl:template name="buildflags">
|
||||||
|
<xsl:param name="package" select="foo"/>
|
||||||
|
<xsl:if test="$cflags != ''">
|
||||||
|
<xsl:call-template name="cflags">
|
||||||
|
<xsl:with-param name="package" select="$package"/>
|
||||||
|
</xsl:call-template>
|
||||||
|
</xsl:if>
|
||||||
|
<xsl:if test="$cxxflags != ''">
|
||||||
|
<xsl:call-template name="cxxflags">
|
||||||
|
<xsl:with-param name="package" select="$package"/>
|
||||||
|
</xsl:call-template>
|
||||||
|
</xsl:if>
|
||||||
|
<xsl:if test="$other_cflags != ''">
|
||||||
|
<xsl:call-template name="other_cflags">
|
||||||
|
<xsl:with-param name="package" select="$package"/>
|
||||||
|
</xsl:call-template>
|
||||||
|
</xsl:if>
|
||||||
|
<xsl:if test="$other_cxxflags != ''">
|
||||||
|
<xsl:call-template name="other_cxxflags">
|
||||||
|
<xsl:with-param name="package" select="$package"/>
|
||||||
|
</xsl:call-template>
|
||||||
|
</xsl:if>
|
||||||
|
<xsl:if test="$ldflags != ''">
|
||||||
|
<xsl:call-template name="ldflags">
|
||||||
|
<xsl:with-param name="package" select="$package"/>
|
||||||
|
</xsl:call-template>
|
||||||
|
</xsl:if>
|
||||||
|
<xsl:if test="$other_ldflags != ''">
|
||||||
|
<xsl:call-template name="other_ldflags">
|
||||||
|
<xsl:with-param name="package" select="$package"/>
|
||||||
|
</xsl:call-template>
|
||||||
|
</xsl:if>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- CFLAGS template -->
|
||||||
|
<xsl:template name="cflags">
|
||||||
|
<xsl:param name="package" select="foo"/>
|
||||||
|
<!-- Find the override value, if any -->
|
||||||
|
<xsl:variable name="override">
|
||||||
|
<xsl:call-template name="lookup.key">
|
||||||
|
<xsl:with-param name="key" select="$package"/>
|
||||||
|
<xsl:with-param name="table" select="normalize-space($override_cflags)"/>
|
||||||
|
</xsl:call-template>
|
||||||
|
</xsl:variable>
|
||||||
|
<!-- Find the extra settings, if any -->
|
||||||
|
<xsl:variable name="extra">
|
||||||
|
<xsl:call-template name="lookup.key">
|
||||||
|
<xsl:with-param name="key" select="$package"/>
|
||||||
|
<xsl:with-param name="table" select="normalize-space($extra_cflags)"/>
|
||||||
|
</xsl:call-template>
|
||||||
|
</xsl:variable>
|
||||||
|
<!-- Writte the envar -->
|
||||||
|
<xsl:text>CFLAGS="</xsl:text>
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="$override != ''">
|
||||||
|
<xsl:value-of select="$override"/>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<xsl:value-of select="$cflags"/>
|
||||||
|
<xsl:if test="$extra != ''">
|
||||||
|
<xsl:value-of select="concat(' ',$extra)"/>
|
||||||
|
</xsl:if>
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
|
<xsl:text>"
</xsl:text>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- CXXFLAGS template -->
|
||||||
|
<xsl:template name="cxxflags">
|
||||||
|
<xsl:param name="package" select="foo"/>
|
||||||
|
<!-- Find the override value, if any -->
|
||||||
|
<xsl:variable name="override">
|
||||||
|
<xsl:call-template name="lookup.key">
|
||||||
|
<xsl:with-param name="key" select="$package"/>
|
||||||
|
<xsl:with-param name="table" select="normalize-space($override_cxxflags)"/>
|
||||||
|
</xsl:call-template>
|
||||||
|
</xsl:variable>
|
||||||
|
<!-- Find the extra settings, if any -->
|
||||||
|
<xsl:variable name="extra">
|
||||||
|
<xsl:call-template name="lookup.key">
|
||||||
|
<xsl:with-param name="key" select="$package"/>
|
||||||
|
<xsl:with-param name="table" select="normalize-space($extra_cxxflags)"/>
|
||||||
|
</xsl:call-template>
|
||||||
|
</xsl:variable>
|
||||||
|
<!-- Writte the envar -->
|
||||||
|
<xsl:text>CXXFLAGS="</xsl:text>
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="$override != ''">
|
||||||
|
<xsl:value-of select="$override"/>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<xsl:value-of select="$cxxflags"/>
|
||||||
|
<xsl:if test="$extra != ''">
|
||||||
|
<xsl:value-of select="concat(' ',$extra)"/>
|
||||||
|
</xsl:if>
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
|
<xsl:text>"
</xsl:text>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- OTHER_CFLAGS template -->
|
||||||
|
<xsl:template name="other_cflags">
|
||||||
|
<xsl:param name="package" select="foo"/>
|
||||||
|
<!-- Find the override value, if any -->
|
||||||
|
<xsl:variable name="override">
|
||||||
|
<xsl:call-template name="lookup.key">
|
||||||
|
<xsl:with-param name="key" select="$package"/>
|
||||||
|
<xsl:with-param name="table" select="normalize-space($override_other_cflags)"/>
|
||||||
|
</xsl:call-template>
|
||||||
|
</xsl:variable>
|
||||||
|
<!-- Find the extra settings, if any -->
|
||||||
|
<xsl:variable name="extra">
|
||||||
|
<xsl:call-template name="lookup.key">
|
||||||
|
<xsl:with-param name="key" select="$package"/>
|
||||||
|
<xsl:with-param name="table" select="normalize-space($extra_other_cflags)"/>
|
||||||
|
</xsl:call-template>
|
||||||
|
</xsl:variable>
|
||||||
|
<!-- Writte the envar -->
|
||||||
|
<xsl:text>OTHER_CFLAGS="</xsl:text>
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="$override != ''">
|
||||||
|
<xsl:value-of select="$override"/>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<xsl:value-of select="$other_cflags"/>
|
||||||
|
<xsl:if test="$extra != ''">
|
||||||
|
<xsl:value-of select="concat(' ',$extra)"/>
|
||||||
|
</xsl:if>
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
|
<xsl:text>"
</xsl:text>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- OTHER_CXXFLAGS template -->
|
||||||
|
<xsl:template name="other_cxxflags">
|
||||||
|
<xsl:param name="package" select="foo"/>
|
||||||
|
<!-- Find the override value, if any -->
|
||||||
|
<xsl:variable name="override">
|
||||||
|
<xsl:call-template name="lookup.key">
|
||||||
|
<xsl:with-param name="key" select="$package"/>
|
||||||
|
<xsl:with-param name="table" select="normalize-space($override_other_cxxflags)"/>
|
||||||
|
</xsl:call-template>
|
||||||
|
</xsl:variable>
|
||||||
|
<!-- Find the extra settings, if any -->
|
||||||
|
<xsl:variable name="extra">
|
||||||
|
<xsl:call-template name="lookup.key">
|
||||||
|
<xsl:with-param name="key" select="$package"/>
|
||||||
|
<xsl:with-param name="table" select="normalize-space($extra_other_cxxflags)"/>
|
||||||
|
</xsl:call-template>
|
||||||
|
</xsl:variable>
|
||||||
|
<!-- Writte the envar -->
|
||||||
|
<xsl:text>OTHER_CXXFLAGS="</xsl:text>
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="$override != ''">
|
||||||
|
<xsl:value-of select="$override"/>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<xsl:value-of select="$other_cxxflags"/>
|
||||||
|
<xsl:if test="$extra != ''">
|
||||||
|
<xsl:value-of select="concat(' ',$extra)"/>
|
||||||
|
</xsl:if>
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
|
<xsl:text>"
</xsl:text>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- LDFLAGS template -->
|
||||||
|
<xsl:template name="ldflags">
|
||||||
|
<xsl:param name="package" select="foo"/>
|
||||||
|
<!-- Find the override value, if any -->
|
||||||
|
<xsl:variable name="override">
|
||||||
|
<xsl:call-template name="lookup.key">
|
||||||
|
<xsl:with-param name="key" select="$package"/>
|
||||||
|
<xsl:with-param name="table" select="normalize-space($override_ldflags)"/>
|
||||||
|
</xsl:call-template>
|
||||||
|
</xsl:variable>
|
||||||
|
<!-- Find the extra settings, if any -->
|
||||||
|
<xsl:variable name="extra">
|
||||||
|
<xsl:call-template name="lookup.key">
|
||||||
|
<xsl:with-param name="key" select="$package"/>
|
||||||
|
<xsl:with-param name="table" select="normalize-space($extra_ldflags)"/>
|
||||||
|
</xsl:call-template>
|
||||||
|
</xsl:variable>
|
||||||
|
<!-- Writte the envar -->
|
||||||
|
<xsl:text>LDFLAGS="</xsl:text>
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="$override != ''">
|
||||||
|
<xsl:value-of select="$override"/>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<xsl:value-of select="$ldflags"/>
|
||||||
|
<xsl:if test="$extra != ''">
|
||||||
|
<xsl:value-of select="concat(' ',$extra)"/>
|
||||||
|
</xsl:if>
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
|
<xsl:text>"
</xsl:text>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- OTHER_LDFLAGS template -->
|
||||||
|
<xsl:template name="other_ldflags">
|
||||||
|
<xsl:param name="package" select="foo"/>
|
||||||
|
<!-- Find the override value, if any -->
|
||||||
|
<xsl:variable name="override">
|
||||||
|
<xsl:call-template name="lookup.key">
|
||||||
|
<xsl:with-param name="key" select="$package"/>
|
||||||
|
<xsl:with-param name="table" select="normalize-space($override_other_ldflags)"/>
|
||||||
|
</xsl:call-template>
|
||||||
|
</xsl:variable>
|
||||||
|
<!-- Find the extra settings, if any -->
|
||||||
|
<xsl:variable name="extra">
|
||||||
|
<xsl:call-template name="lookup.key">
|
||||||
|
<xsl:with-param name="key" select="$package"/>
|
||||||
|
<xsl:with-param name="table" select="normalize-space($extra_other_ldflags)"/>
|
||||||
|
</xsl:call-template>
|
||||||
|
</xsl:variable>
|
||||||
|
<!-- Writte the envar -->
|
||||||
|
<xsl:text>OTHER_LDFLAGS="</xsl:text>
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="$override != ''">
|
||||||
|
<xsl:value-of select="$override"/>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<xsl:value-of select="$other_ldflags"/>
|
||||||
|
<xsl:if test="$extra != ''">
|
||||||
|
<xsl:value-of select="concat(' ',$extra)"/>
|
||||||
|
</xsl:if>
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
|
<xsl:text>"
</xsl:text>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Parses a table-like param finding a pair key-value.
|
||||||
|
Copied from DocBook-XSL -->
|
||||||
|
<xsl:template name="lookup.key">
|
||||||
|
<xsl:param name="key" select="''"/>
|
||||||
|
<xsl:param name="table" select="''"/>
|
||||||
|
<xsl:if test="contains($table, ' ')">
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="substring-before($table, ' ') = $key">
|
||||||
|
<xsl:variable name="rest" select="substring-after($table, ' ')"/>
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="contains($rest, ' ')">
|
||||||
|
<xsl:value-of select="substring-before($rest, ' ')"/>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<xsl:value-of select="$rest"/>
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<xsl:call-template name="lookup.key">
|
||||||
|
<xsl:with-param name="key" select="$key"/>
|
||||||
|
<xsl:with-param name="table" select="substring-after(substring-after($table,' '), ' ')"/>
|
||||||
|
</xsl:call-template>
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
|
</xsl:if>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
</xsl:stylesheet>
|
|
@ -146,6 +146,7 @@ extract_commands() { #
|
||||||
--stringparam lang $LANG \
|
--stringparam lang $LANG \
|
||||||
--stringparam custom-tools $CUSTOM_TOOLS \
|
--stringparam custom-tools $CUSTOM_TOOLS \
|
||||||
--stringparam blfs-tool $BLFS_TOOL \
|
--stringparam blfs-tool $BLFS_TOOL \
|
||||||
|
--stringparam optimize $OPTIMIZE \
|
||||||
-o ./${PROGNAME}-commands/ $XSL $BOOK/index.xml >>$LOGDIR/$LOG 2>&1
|
-o ./${PROGNAME}-commands/ $XSL $BOOK/index.xml >>$LOGDIR/$LOG 2>&1
|
||||||
;;
|
;;
|
||||||
*) echo -n " ${L_arrow}${BOLD}${PROGNAME}${R_arrow} book invalid, terminate build... "
|
*) echo -n " ${L_arrow}${BOLD}${PROGNAME}${R_arrow} book invalid, terminate build... "
|
||||||
|
|
19
jhalfs
19
jhalfs
|
@ -266,22 +266,6 @@ if [[ "$COMPARE" = "y" ]]; then
|
||||||
[[ $VERBOSITY > 0 ]] && echo "OK"
|
[[ $VERBOSITY > 0 ]] && echo "OK"
|
||||||
fi
|
fi
|
||||||
#
|
#
|
||||||
# optimize module
|
|
||||||
if [[ "$OPTIMIZE" != "0" ]]; then
|
|
||||||
[[ $VERBOSITY > 0 ]] && echo -n "Loading optimization module..."
|
|
||||||
source optimize/optimize_functions
|
|
||||||
[[ $? > 0 ]] && echo " optimize/optimize_functions did not load.." && exit
|
|
||||||
[[ $VERBOSITY > 0 ]] && echo "OK"
|
|
||||||
#
|
|
||||||
# optimize configurations
|
|
||||||
[[ $VERBOSITY > 0 ]] && echo -n "Loading optimization config..."
|
|
||||||
source optimize/opt_config
|
|
||||||
[[ $? > 0 ]] && echo " optimize/opt_config did not load.." && exit
|
|
||||||
[[ $VERBOSITY > 0 ]] && echo "OK"
|
|
||||||
# Validate optimize settings, if required
|
|
||||||
validate_opt_settings
|
|
||||||
fi
|
|
||||||
#
|
|
||||||
|
|
||||||
if [[ "$REBUILD_MAKEFILE" = "n" ]] ; then
|
if [[ "$REBUILD_MAKEFILE" = "n" ]] ; then
|
||||||
|
|
||||||
|
@ -327,9 +311,6 @@ if [[ "$REBUILD_MAKEFILE" = "n" ]] ; then
|
||||||
validate_config > $JHALFSDIR/jhalfs.config
|
validate_config > $JHALFSDIR/jhalfs.config
|
||||||
fi
|
fi
|
||||||
#
|
#
|
||||||
# Copy optimize files, if needed
|
|
||||||
[[ "$OPTIMIZE" != "0" ]] && cp optimize/opt_override $JHALFSDIR/
|
|
||||||
#
|
|
||||||
# Copy compare files, if needed
|
# Copy compare files, if needed
|
||||||
if [[ "$COMPARE" = "y" ]]; then
|
if [[ "$COMPARE" = "y" ]]; then
|
||||||
mkdir -p $JHALFSDIR/extras
|
mkdir -p $JHALFSDIR/extras
|
||||||
|
|
|
@ -1,53 +0,0 @@
|
||||||
#####
|
|
||||||
#
|
|
||||||
# optimization configuration file
|
|
||||||
#
|
|
||||||
#####
|
|
||||||
#
|
|
||||||
#$Id$
|
|
||||||
#
|
|
||||||
|
|
||||||
#--- Extra flags passed to the packages make commands
|
|
||||||
# "unset" will cause the variable to be not set
|
|
||||||
# instead of just set to null.
|
|
||||||
MAKEFLAGS="-j3"
|
|
||||||
|
|
||||||
#--- List of packages that have issues with jobs control.
|
|
||||||
# This list may be different for you.
|
|
||||||
# If your MAKEFLAGS don't contains a -jX option, you can set
|
|
||||||
# a empty list here.
|
|
||||||
BLACK_LIST="autoconf dejagnu gettext groff man-db"
|
|
||||||
|
|
||||||
#--- Default optimization mode
|
|
||||||
# This mode is overridden by definitions in opt_override;
|
|
||||||
# in this way, packages can be tuned independently. For example,
|
|
||||||
# if you have trouble building a package in the mode set here, add
|
|
||||||
# the package to opt_override with a different mode.
|
|
||||||
#
|
|
||||||
# Not set here combined modes of form defOpt_myMode.
|
|
||||||
# Combined modes of form modeA_modeB can be set here.
|
|
||||||
DEF_OPT_MODE=O3pipe
|
|
||||||
|
|
||||||
|
|
||||||
#--- Active optimization variables
|
|
||||||
# Variables listed here will be set as defined in the appropriate
|
|
||||||
# file in opt_config.d/; others will be ignored.
|
|
||||||
ACTIVE_OPT_VARS="CFLAGS CXXFLAGS LDFLAGS \
|
|
||||||
OTHER_CFLAGS OTHER_CXXFLAGS OTHER_LDFLAGS"
|
|
||||||
|
|
||||||
#--- Load optimization modes
|
|
||||||
# To add modes, create a working template..
|
|
||||||
# cp opt_config.d/O3pipe opt_config.d/newMode
|
|
||||||
# ..and edit it as desired.
|
|
||||||
#
|
|
||||||
# To inherit another mode and add to it, see opt_config.d/O3pipe_march
|
|
||||||
# or opt_config.d/defOpt_fPIC as examples for two different ways of
|
|
||||||
# doing it. Given opt_config.d/modeA_modeB_modeC, modeB inherits
|
|
||||||
# the optimizations of modeA by sourcing it, and modeC inherits those
|
|
||||||
# of modeB (which includes those of modeA).
|
|
||||||
#
|
|
||||||
# Add packages that are to use this mode to opt_override with:
|
|
||||||
# echo 'myPkg newMode' >> opt_override
|
|
||||||
for mode in optimize/opt_config.d/* ; do
|
|
||||||
source $mode
|
|
||||||
done
|
|
|
@ -1,22 +0,0 @@
|
||||||
#
|
|
||||||
#$Id$
|
|
||||||
#
|
|
||||||
#####
|
|
||||||
#
|
|
||||||
# MODE O3pipe configuration
|
|
||||||
#
|
|
||||||
# Usage: - Apply optimization string to each variable
|
|
||||||
# - "unset" will cause the variable to be not set
|
|
||||||
# instead of just set to null.
|
|
||||||
#
|
|
||||||
# Use this as an example for cunstomized modes
|
|
||||||
#
|
|
||||||
#####
|
|
||||||
|
|
||||||
CFLAGS_O3pipe="-O3 -pipe"
|
|
||||||
CXXFLAGS_O3pipe=$CFLAGS_O3pipe
|
|
||||||
LDFLAGS_O3pipe="unset"
|
|
||||||
|
|
||||||
OTHER_CFLAGS_O3pipe=$CFLAGS_O3pipe
|
|
||||||
OTHER_CXXFLAGS_O3pipe=$CXXFLAGS_O3pipe
|
|
||||||
OTHER_LDFLAGS_O3pipe=$LDFLAGS_O3pipe
|
|
|
@ -1,25 +0,0 @@
|
||||||
#
|
|
||||||
#$Id$
|
|
||||||
#
|
|
||||||
#####
|
|
||||||
#
|
|
||||||
# MODE O3pipe_march configuration
|
|
||||||
#
|
|
||||||
# Usage: - Apply optimization string to each variable
|
|
||||||
# - "unset" will cause the variable to be not set
|
|
||||||
# instead of just set to null.
|
|
||||||
#
|
|
||||||
# Use this as an example for modeA_modeB combined modes
|
|
||||||
#
|
|
||||||
#####
|
|
||||||
|
|
||||||
# Inherit optimizations from O3pipe
|
|
||||||
source optimize/opt_config.d/O3pipe
|
|
||||||
|
|
||||||
CFLAGS_O3pipe_march=$CFLAGS_O3pipe" -march=pentium4"
|
|
||||||
CXXFLAGS_O3pipe_march=$CFLAGS_O3pipe" -march=pentium4"
|
|
||||||
LDFLAGS_O3pipe_march=$LDFLAGS_O3pipe
|
|
||||||
|
|
||||||
OTHER_CFLAGS_O3pipe_march=$CFLAGS_O3pipe" -march=pentium4"
|
|
||||||
OTHER_CXXFLAGS_O3pipe_march=$CXXFLAGS_O3pipe" -march=pentium4"
|
|
||||||
OTHER_LDFLAGS_O3pipe_march=$LDFLAGS_O3pipe
|
|
|
@ -1,36 +0,0 @@
|
||||||
#
|
|
||||||
#$Id$
|
|
||||||
#
|
|
||||||
#####
|
|
||||||
#
|
|
||||||
# MODE defOpt_fPIC configuration
|
|
||||||
#
|
|
||||||
# WARNING: Do not edit this mode unless you know what you are
|
|
||||||
# doing. It's required to build Zlib.
|
|
||||||
#
|
|
||||||
# Usage: - Apply optimization string to each variable
|
|
||||||
# - "unset" will cause the variable to be not set
|
|
||||||
# instead of just set to null.
|
|
||||||
#
|
|
||||||
# Use this as an example for defOpt_myMode combined modes
|
|
||||||
#
|
|
||||||
#####
|
|
||||||
|
|
||||||
# Inherit optimizations from DEF_OPT_MODE
|
|
||||||
source optimize/opt_config.d/${DEF_OPT_MODE}
|
|
||||||
|
|
||||||
# Append " -fPIC" to default *C{,XX}FLAGS and retain other defaults
|
|
||||||
for OPT_VAR in $ACTIVE_OPT_VARS ; do
|
|
||||||
case $OPT_VAR in
|
|
||||||
CFLAGS | CXXFLAGS | OTHER_CFLAGS | OTHER_CXXFLAGS)
|
|
||||||
if [[ "$(eval "echo \$${OPT_VAR}_${DEF_OPT_MODE}")" != "unset" ]] ; then
|
|
||||||
eval ${OPT_VAR}_defOpt_fPIC=\$${OPT_VAR}_${DEF_OPT_MODE}\" -fPIC\"
|
|
||||||
else
|
|
||||||
eval ${OPT_VAR}_defOpt_fPIC="unset"
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
eval ${OPT_VAR}_defOpt_fPIC=\$${OPT_VAR}_${DEF_OPT_MODE}
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
|
@ -1,27 +0,0 @@
|
||||||
#
|
|
||||||
#$Id$
|
|
||||||
#
|
|
||||||
#####
|
|
||||||
#
|
|
||||||
# MODE noOpt configuration
|
|
||||||
#
|
|
||||||
# WARNING: Do not edit this mode unless you know what you are
|
|
||||||
# doing. By default, this is set to disable optimization
|
|
||||||
# of packages known to have build or runtime failure.
|
|
||||||
#
|
|
||||||
# Also, if you what to use MAKEFLAGS but no build
|
|
||||||
# optimizations, set this mode in DEF_OPT_MODE
|
|
||||||
#
|
|
||||||
# Usage: - Apply optimization string to each variable
|
|
||||||
# - "unset" will cause the variable to be not set
|
|
||||||
# instead of being just set to null.
|
|
||||||
#
|
|
||||||
#####
|
|
||||||
|
|
||||||
CFLAGS_noOpt="unset"
|
|
||||||
CXXFLAGS_noOpt="unset"
|
|
||||||
LDFLAGS_noOpt="unset"
|
|
||||||
|
|
||||||
OTHER_CFLAGS_noOpt="unset"
|
|
||||||
OTHER_CXXFLAGS_noOpt="unset"
|
|
||||||
OTHER_LDFLAGS_noOpt="unset"
|
|
|
@ -1,23 +0,0 @@
|
||||||
#
|
|
||||||
#$Id$
|
|
||||||
#
|
|
||||||
#####
|
|
||||||
#
|
|
||||||
# MODE noOpt_noSymbols configuration
|
|
||||||
#
|
|
||||||
# Usage: - Apply optimization string to each variable
|
|
||||||
# - "unset" will cause the variable to be not set
|
|
||||||
# instead of just set to null.
|
|
||||||
#
|
|
||||||
# NOTE: If using this mode in DEF_OPT_MODE (alone or combined with
|
|
||||||
# other modes) please set STRIP=0 in common/config
|
|
||||||
#
|
|
||||||
#####
|
|
||||||
|
|
||||||
CFLAGS_noSymbols="-s"
|
|
||||||
CXXFLAGS_noSymbols=$CFLAGS_noSymbols
|
|
||||||
LDFLAGS_noSymbols="-s"
|
|
||||||
|
|
||||||
OTHER_CFLAGS_noSymbols=$CFLAGS_noSymbols
|
|
||||||
OTHER_CXXFLAGS_noSymbols=$CXXFLAGS_noSymbols
|
|
||||||
OTHER_LDFLAGS_noSymbols=$LDFLAGS_noSymbols
|
|
|
@ -1,5 +0,0 @@
|
||||||
binutils noOpt
|
|
||||||
gcc noOpt
|
|
||||||
glibc noOpt
|
|
||||||
grub noOpt
|
|
||||||
zlib defOpt_fPIC
|
|
|
@ -1,91 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# $Id$
|
|
||||||
|
|
||||||
set +e
|
|
||||||
|
|
||||||
|
|
||||||
#----------------------------------#
|
|
||||||
validate_opt_settings() { # Show optimize setting and wait user agreement
|
|
||||||
#----------------------------------#
|
|
||||||
local OPT_VAR optVal
|
|
||||||
|
|
||||||
echo -e "\t\t${RED}${BOLD}WARNING:${OFF}\n"
|
|
||||||
echo -e "${BOLD}The use of build optimizations may be dangerous.\n"
|
|
||||||
echo -e "You should know what you are doing and be sure that the"
|
|
||||||
echo -e "optimization settings listed below are what you want.\n"
|
|
||||||
echo -e "If there are build issues or the system doesn't work as"
|
|
||||||
echo -e "expected, please rebuild without optimizations before"
|
|
||||||
echo -e "asking for support.${OFF}\n"
|
|
||||||
|
|
||||||
echo -e "MAKEFLAGS: ${L_arrow}${BOLD}${MAKEFLAGS}${OFF}${R_arrow}"
|
|
||||||
[[ "$MAKEFLAGS" = "unset" ]] && echo
|
|
||||||
[[ "$MAKEFLAGS" != "unset" ]] && \
|
|
||||||
echo -e "BLACK_LIST: ${L_arrow}${BOLD}${BLACK_LIST}${OFF}${R_arrow}\n"
|
|
||||||
|
|
||||||
echo -e "DEF_OPT_MODE: ${L_arrow}${BOLD}${DEF_OPT_MODE}${OFF}${R_arrow}\n"
|
|
||||||
|
|
||||||
for OPT_VAR in $ACTIVE_OPT_VARS ; do
|
|
||||||
eval optVal=\$${OPT_VAR}_${DEF_OPT_MODE}
|
|
||||||
echo -e "${OPT_VAR}: ${L_arrow}${BOLD}${optVal}${OFF}${R_arrow}"
|
|
||||||
done
|
|
||||||
|
|
||||||
echo -e "\nOverridden packages:"
|
|
||||||
cat optimize/opt_override
|
|
||||||
echo "${nl_}${SD_BORDER}${nl_}"
|
|
||||||
|
|
||||||
echo -n "Are you happy with these optimization settings? yes/no (no): "
|
|
||||||
read ANSWER
|
|
||||||
if [ x$ANSWER != "xyes" ] ; then
|
|
||||||
echo "${nl_}Fix the optimization options and rerun the script.${nl_}"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
echo "${nl_}${SD_BORDER}${nl_}"
|
|
||||||
}
|
|
||||||
|
|
||||||
#----------------------------------#
|
|
||||||
wrt_optimize() { # Apply pkg specific opt's to build
|
|
||||||
#----------------------------------#
|
|
||||||
local pkg=$1
|
|
||||||
local optMode optVal OPT_VAR
|
|
||||||
|
|
||||||
optMode=`awk -v pkg="$pkg" '$1 == pkg { print $2 }' $JHALFSDIR/opt_override`
|
|
||||||
if [[ "$optMode" = "" ]] ; then
|
|
||||||
optMode=$DEF_OPT_MODE;
|
|
||||||
fi
|
|
||||||
|
|
||||||
for OPT_VAR in $ACTIVE_OPT_VARS ; do
|
|
||||||
eval optVal=\$${OPT_VAR}_$optMode
|
|
||||||
|
|
||||||
if [[ "$optVal" != "unset" ]]; then
|
|
||||||
(
|
|
||||||
cat << EOF
|
|
||||||
@echo "export $OPT_VAR=\"$optVal\"" >> envars
|
|
||||||
EOF
|
|
||||||
) >> $MKFILE.tmp
|
|
||||||
else
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
#----------------------------------#
|
|
||||||
wrt_makeflags() { # Apply MAKEFLAGS to build
|
|
||||||
#----------------------------------#
|
|
||||||
local pkg=$1
|
|
||||||
local MKF
|
|
||||||
|
|
||||||
if [[ "$BLACK_LIST" =~ ${pkg} ]]; then
|
|
||||||
MKF=unset
|
|
||||||
else
|
|
||||||
MKF=$MAKEFLAGS
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "$MKF" != "unset" ]]; then
|
|
||||||
(
|
|
||||||
cat << EOF
|
|
||||||
@echo "export MAKEFLAGS=\"$MAKEFLAGS\"" >> envars
|
|
||||||
EOF
|
|
||||||
) >> $MKFILE.tmp
|
|
||||||
fi
|
|
||||||
}
|
|
Reference in a new issue