Author: pierre
Date: Fri Jan 12 11:04:19 2018
New Revision: 4025

Log:
Add .la file removal to LFS and BLFS scripts

Modified:
   jhalfs/trunk/BLFS/gen_pkg_book.sh
   jhalfs/trunk/BLFS/xsl/gen_config.xsl
   jhalfs/trunk/BLFS/xsl/scripts.xsl
   jhalfs/trunk/Config.in
   jhalfs/trunk/LFS/lfs.xsl
   jhalfs/trunk/LFS/master.sh
   jhalfs/trunk/common/libs/func_book_parser
   jhalfs/trunk/common/libs/func_install_blfs
   jhalfs/trunk/common/libs/func_validate_configs.sh
   jhalfs/trunk/jhalfs

Modified: jhalfs/trunk/BLFS/gen_pkg_book.sh
==============================================================================
--- jhalfs/trunk/BLFS/gen_pkg_book.sh   Fri Jan 12 08:10:54 2018        (r4024)
+++ jhalfs/trunk/BLFS/gen_pkg_book.sh   Fri Jan 12 11:04:19 2018        (r4025)
@@ -50,6 +50,7 @@
       optDependency=* | \
       MAIL_SERVER=*   | \
       WRAP_INSTALL=*  | \
+      DEL_LA_FILES=*  | \
       SUDO=*  )  eval ${REPLY} # Define/set a global variable..
                       continue ;;
     esac
@@ -69,13 +70,14 @@
   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 @@
 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.

Modified: jhalfs/trunk/BLFS/xsl/gen_config.xsl
==============================================================================
--- jhalfs/trunk/BLFS/xsl/gen_config.xsl        Fri Jan 12 08:10:54 2018        
(r4024)
+++ jhalfs/trunk/BLFS/xsl/gen_config.xsl        Fri Jan 12 11:04:19 2018        
(r4025)
@@ -68,6 +68,13 @@
                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>
 

Modified: jhalfs/trunk/BLFS/xsl/scripts.xsl
==============================================================================
--- jhalfs/trunk/BLFS/xsl/scripts.xsl   Fri Jan 12 08:10:54 2018        (r4024)
+++ jhalfs/trunk/BLFS/xsl/scripts.xsl   Fri Jan 12 11:04:19 2018        (r4025)
@@ -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 @@
           </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>

Modified: jhalfs/trunk/Config.in
==============================================================================
--- jhalfs/trunk/Config.in      Fri Jan 12 08:10:54 2018        (r4024)
+++ jhalfs/trunk/Config.in      Fri Jan 12 11:04:19 2018        (r4025)
@@ -931,6 +931,13 @@
         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

Modified: jhalfs/trunk/LFS/lfs.xsl
==============================================================================
--- jhalfs/trunk/LFS/lfs.xsl    Fri Jan 12 08:10:54 2018        (r4024)
+++ jhalfs/trunk/LFS/lfs.xsl    Fri Jan 12 11:04:19 2018        (r4025)
@@ -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 @@
                            (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 @@
         </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 @@
             </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'">
@@ -880,6 +891,40 @@
       </xsl:otherwise>
     </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="''"/>

Modified: jhalfs/trunk/LFS/master.sh
==============================================================================
--- jhalfs/trunk/LFS/master.sh  Fri Jan 12 08:10:54 2018        (r4024)
+++ jhalfs/trunk/LFS/master.sh  Fri Jan 12 11:04:19 2018        (r4025)
@@ -85,7 +85,9 @@
 #      *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

Modified: jhalfs/trunk/common/libs/func_book_parser
==============================================================================
--- jhalfs/trunk/common/libs/func_book_parser   Fri Jan 12 08:10:54 2018        
(r4024)
+++ jhalfs/trunk/common/libs/func_book_parser   Fri Jan 12 11:04:19 2018        
(r4025)
@@ -170,6 +170,8 @@
                  --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"         \

Modified: jhalfs/trunk/common/libs/func_install_blfs
==============================================================================
--- jhalfs/trunk/common/libs/func_install_blfs  Fri Jan 12 08:10:54 2018        
(r4024)
+++ jhalfs/trunk/common/libs/func_install_blfs  Fri Jan 12 11:04:19 2018        
(r4025)
@@ -131,6 +131,7 @@
 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)

Modified: jhalfs/trunk/common/libs/func_validate_configs.sh
==============================================================================
--- jhalfs/trunk/common/libs/func_validate_configs.sh   Fri Jan 12 08:10:54 
2018        (r4024)
+++ jhalfs/trunk/common/libs/func_validate_configs.sh   Fri Jan 12 11:04:19 
2018        (r4025)
@@ -41,7 +41,7 @@
   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"

Modified: jhalfs/trunk/jhalfs
==============================================================================
--- jhalfs/trunk/jhalfs Fri Jan 12 08:10:54 2018        (r4024)
+++ jhalfs/trunk/jhalfs Fri Jan 12 11:04:19 2018        (r4025)
@@ -129,6 +129,7 @@
 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}
-- 
http://lists.linuxfromscratch.org/listinfo/alfs-log
Unsubscribe: See the above information page

Reply via email to