Add .la file removal to LFS and BLFS scripts

This commit is contained in:
Pierre Labastie 2018-01-12 19:04:19 +00:00
parent 5637b53ba7
commit dc7fd7b7ba
10 changed files with 94 additions and 9 deletions

View file

@ -50,6 +50,7 @@ parse_configuration() { #
optDependency=* | \
MAIL_SERVER=* | \
WRAP_INSTALL=* | \
DEL_LA_FILES=* | \
SUDO=* ) eval ${REPLY} # Define/set a global variable..
continue ;;
esac
@ -69,13 +70,14 @@ parse_configuration() { #
DEP_LEVEL=$optDependency
SUDO=${SUDO:-n}
WRAP_INSTALL=${WRAP_INSTALL:-n}
DEL_LA_FILES=${DEL_LA_FILES:-n}
}
#--------------------------#
validate_configuration() { #
#--------------------------#
local -r dotSTR=".................."
local -r PARAM_LIST="DEP_LEVEL SUDO MAIL_SERVER WRAP_INSTALL"
local -r PARAM_LIST="DEP_LEVEL SUDO MAIL_SERVER WRAP_INSTALL DEL_LA_FILES"
local -r PARAM_VALS='${config_param}${dotSTR:${#config_param}} ${L_arrow}${BOLD}${!config_param}${OFF}${R_arrow}'
local config_param
local -i index
@ -189,6 +191,7 @@ rm -rf scripts
xsltproc --xinclude --nonet \
--stringparam sudo "$SUDO" \
--stringparam wrap-install "$WRAP_INSTALL" \
--stringparam del-la-files "$DEL_LA_FILES" \
-o ./scripts/ ${MakeScripts} \
${BookXml}
# Make the scripts executable.

View file

@ -68,6 +68,13 @@ config WRAP_INSTALL
between "wrapInstall '" and "' ; packInstall" functions,
where wrapInstall is used to set up a LD_PRELOAD library (for
example using porg), and packInstall makes the package tarball
config DEL_LA_FILES
bool "Remove libtool .la files after package installation"
default y
help
This option should be active on any system mixing libtool
and meson build systems. ImageMagick .la files are preserved.
</xsl:text>
</xsl:template>

View file

@ -25,9 +25,20 @@
"porg style" package management -->
<xsl:param name="wrap-install" select="'n'"/>
<!-- Remove libtool .la files -->
<xsl:param name="del-la-files" select="'y'"/>
<!-- Build as user (y) or as root (n)? -->
<xsl:param name="sudo" select="'y'"/>
<!-- simple instructions for removing .la files. -->
<xsl:variable name="la-files-instr">
for libdir in /lib /usr/lib $(find /opt -name lib); do
find $libdir -name \*.la ! -path \*ImageMagick\* -delete
done
</xsl:variable>
<xsl:template match="/">
<xsl:apply-templates select="//sect1"/>
</xsl:template>
@ -431,6 +442,12 @@ wrapInstall '
</xsl:if>
<xsl:apply-templates mode="root"/>
<xsl:if test="not(following-sibling::screen[1][@role='root'])">
<xsl:if test="$del-la-files = 'y' and
ancestor::sect2[@role='installation']">
<xsl:call-template name="output-root">
<xsl:with-param name="out-string" select="$la-files-instr"/>
</xsl:call-template>
</xsl:if>
<xsl:if test="$wrap-install = 'y' and
ancestor::sect2[@role='installation']">
<xsl:text>'&#xA;packInstall</xsl:text>

View file

@ -931,6 +931,13 @@ depends !BOOK_BLFS
default n
depends on !BOOK_CLFS3
config DEL_LA_FILES
bool "Remove libtool .la files
default y
help
#-- Remove files libxxx.la installed by libtool. For a rationale
# see https://blog.flameeyes.eu/tags/lafiles/
config NO_PROGRESS_BAR
bool "DO NOT use/display progress_bar "
default n

View file

@ -44,6 +44,12 @@
<!-- Install vim-lang package? OBSOLETE should always be 'n'-->
<xsl:param name="vim-lang" select="'n'"/>
<!-- Should we strip excutables and libraries? -->
<xsl:param name='strip' select="'n'"/>
<!-- Should we remove .la files after chapter 5 and chapter 6? -->
<xsl:param name='del-la-files' select="'y'"/>
<!-- Time zone -->
<xsl:param name="timezone" select="'GMT'"/>
@ -232,11 +238,11 @@ esac
(not(@revision) or
@revision=$revision)]/userinput[@remap = 'install']"/>
<xsl:if test="ancestor::chapter[@id != 'chapter-temporary-tools'] and
$pkgmngt = 'y' and
descendant::screen[not(@role) or
@role != 'nodump']/userinput[
@remap='install']">
<xsl:choose>
<xsl:when test="$pkgmngt='n'"/>
<xsl:when test="$wrap-install='y'">
<xsl:if test="../@id = 'ch-system-man-pages'">
<!-- these files are provided by the shadow package -->
@ -417,10 +423,15 @@ exit
</xsl:call-template>
</xsl:when>
<!-- End of test instructions -->
<!-- Don't stop on strip run -->
<xsl:when test="contains(string(),'strip ')">
<xsl:apply-templates/>
<xsl:text> || true&#xA;</xsl:text>
<!-- If the instructions contain "strip ", it may mean they contain also .la
file removal (and possibly other clean up). We therefore call a template
to comment them out appropriately and also to not stop if stripping
fails. -->
<xsl:when test="contains(string(),'strip ') or
contains(string(),'\*.la')">
<xsl:call-template name="comment-strip">
<xsl:with-param name="instructions" select="string()"/>
</xsl:call-template>
</xsl:when>
<!-- Package management -->
<!-- Add $PKG_DEST to installation commands -->
@ -480,7 +491,7 @@ exit
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
</xsl:when> <!-- @remap='install' -->
<!-- if package management, we should make an independant package for
tzdata. -->
<xsl:when test="contains(string(),'tzdata') and $pkgmngt='y'">
@ -881,6 +892,40 @@ DNS=</xsl:text>
</xsl:choose>
</xsl:template>
<xsl:template name="comment-strip">
<xsl:param name="instructions" select="''"/>
<xsl:choose>
<xsl:when test="contains($instructions,'&#xA;')">
<xsl:call-template name="comment-strip">
<xsl:with-param name="instructions"
select="substring-before($instructions,'&#xA;')"/>
</xsl:call-template>
<xsl:call-template name="comment-strip">
<xsl:with-param name="instructions"
select="substring-after($instructions,'&#xA;')"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="contains($instructions,'\*.la')">
<xsl:if test="$del-la-files='n'">
<xsl:text># </xsl:text>
</xsl:if>
<xsl:value-of select="$instructions"/>
<xsl:text>&#xA;</xsl:text>
</xsl:when>
<xsl:when test="contains($instructions,'strip ')">
<xsl:if test="$strip='n'">
<xsl:text># </xsl:text>
</xsl:if>
<xsl:value-of select="$instructions"/>
<xsl:text> || true&#xA;</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$instructions"/>
<xsl:text>&#xA;</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="comment-test">
<xsl:param name="instructions" select="''"/>
<xsl:choose>

View file

@ -85,7 +85,9 @@ chapter5_Makefiles() {
# *expect) [[ "${TEST}" = "0" ]] && continue ;;
# *dejagnu) [[ "${TEST}" = "0" ]] && continue ;;
# *check) [[ "${TEST}" = "0" ]] && continue ;;
*stripping) [[ "${STRIP}" = "n" ]] && continue ;;
# We now do that in LFS.xsl, because stripping.xml contains other cleaning
# instructions
# *stripping) [[ "${STRIP}" = "n" ]] && continue ;;
*glibc) [[ "${TEST}" = "3" ]] && \
sed -i 's@/usr/lib/locale@/tools/lib/locale@' $file ;;
esac

View file

@ -170,6 +170,8 @@ extract_commands() { #
--stringparam testsuite "$TEST" \
--stringparam bomb-testsuite "$BOMB_TEST" \
--stringparam vim-lang "$VIMLANG" \
--stringparam strip "$STRIP" \
--stringparam del-la-files "$DEL_LA_FILES" \
--stringparam full-locale "$FULL_LOCALE" \
--stringparam timezone "$TIMEZONE" \
--stringparam page "$PAGE" \

View file

@ -131,6 +131,7 @@ MAIL_SERVER=sendmail
optDependency=2
SUDO=n
WRAP_INSTALL=$WRAP_INSTALL
DEL_LA_FILES=$DEL_LA_FILES
EOF
# Generates the scripts for the blfs tools dependencies (in ./scripts)

View file

@ -41,7 +41,7 @@ inline_doc
local -r CLFS3_book="$BOOK_common $BOOK_clfsX PLATFORM MIPS_LEVEL"
# Build Settings by book
local -r LFS_build="$BUILD_chroot VIMLANG $BUILD_common PKGMNGT FULL_LOCALE WRAP_INSTALL"
local -r LFS_build="$BUILD_chroot VIMLANG DEL_LA_FILES $BUILD_common PKGMNGT FULL_LOCALE WRAP_INSTALL"
local -r HLFS_build="$BUILD_chroot $BUILD_common"
local -r CLFS_build="$BUILD_chroot VIMLANG $BUILD_common"
local -r CLFS2_build="STRIP VIMLANG $BUILD_common"

1
jhalfs
View file

@ -129,6 +129,7 @@ BOMB_TEST=${BOMB_TEST:-n}
STRIP=${STRIP:=n}
REPORT=${REPORT:=n}
VIMLANG=${VIMLANG:-n}
DEL_LA_FILES=${DEL_LA_FILES:-n}
FULL_LOCALE=${FULL_LOCALE:-n}
GRSECURITY_HOST=${GRSECURITY_HOST:-n}
CUSTOM_TOOLS=${CUSTOM_TOOLS:-n}