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

View file

@ -68,6 +68,13 @@ config WRAP_INSTALL
between "wrapInstall '" and "' ; packInstall" functions, between "wrapInstall '" and "' ; packInstall" functions,
where wrapInstall is used to set up a LD_PRELOAD library (for where wrapInstall is used to set up a LD_PRELOAD library (for
example using porg), and packInstall makes the package tarball 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:text>
</xsl:template> </xsl:template>

View file

@ -25,9 +25,20 @@
"porg style" package management --> "porg style" package management -->
<xsl:param name="wrap-install" select="'n'"/> <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)? --> <!-- Build as user (y) or as root (n)? -->
<xsl:param name="sudo" select="'y'"/> <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:template match="/">
<xsl:apply-templates select="//sect1"/> <xsl:apply-templates select="//sect1"/>
</xsl:template> </xsl:template>
@ -431,6 +442,12 @@ wrapInstall '
</xsl:if> </xsl:if>
<xsl:apply-templates mode="root"/> <xsl:apply-templates mode="root"/>
<xsl:if test="not(following-sibling::screen[1][@role='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 <xsl:if test="$wrap-install = 'y' and
ancestor::sect2[@role='installation']"> ancestor::sect2[@role='installation']">
<xsl:text>'&#xA;packInstall</xsl:text> <xsl:text>'&#xA;packInstall</xsl:text>

View file

@ -931,6 +931,13 @@ depends !BOOK_BLFS
default n default n
depends on !BOOK_CLFS3 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 config NO_PROGRESS_BAR
bool "DO NOT use/display progress_bar " bool "DO NOT use/display progress_bar "
default n default n

View file

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

View file

@ -85,7 +85,9 @@ chapter5_Makefiles() {
# *expect) [[ "${TEST}" = "0" ]] && continue ;; # *expect) [[ "${TEST}" = "0" ]] && continue ;;
# *dejagnu) [[ "${TEST}" = "0" ]] && continue ;; # *dejagnu) [[ "${TEST}" = "0" ]] && continue ;;
# *check) [[ "${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" ]] && \ *glibc) [[ "${TEST}" = "3" ]] && \
sed -i 's@/usr/lib/locale@/tools/lib/locale@' $file ;; sed -i 's@/usr/lib/locale@/tools/lib/locale@' $file ;;
esac esac

View file

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

View file

@ -131,6 +131,7 @@ MAIL_SERVER=sendmail
optDependency=2 optDependency=2
SUDO=n SUDO=n
WRAP_INSTALL=$WRAP_INSTALL WRAP_INSTALL=$WRAP_INSTALL
DEL_LA_FILES=$DEL_LA_FILES
EOF EOF
# Generates the scripts for the blfs tools dependencies (in ./scripts) # 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" local -r CLFS3_book="$BOOK_common $BOOK_clfsX PLATFORM MIPS_LEVEL"
# Build Settings by book # 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 HLFS_build="$BUILD_chroot $BUILD_common"
local -r CLFS_build="$BUILD_chroot VIMLANG $BUILD_common" local -r CLFS_build="$BUILD_chroot VIMLANG $BUILD_common"
local -r CLFS2_build="STRIP 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} STRIP=${STRIP:=n}
REPORT=${REPORT:=n} REPORT=${REPORT:=n}
VIMLANG=${VIMLANG:-n} VIMLANG=${VIMLANG:-n}
DEL_LA_FILES=${DEL_LA_FILES:-n}
FULL_LOCALE=${FULL_LOCALE:-n} FULL_LOCALE=${FULL_LOCALE:-n}
GRSECURITY_HOST=${GRSECURITY_HOST:-n} GRSECURITY_HOST=${GRSECURITY_HOST:-n}
CUSTOM_TOOLS=${CUSTOM_TOOLS:-n} CUSTOM_TOOLS=${CUSTOM_TOOLS:-n}