I've reworked the patch to set LD_PRELOAD directly in the build shells. There's a big chance there is still some bugs in there, as I've only tested the LFS part.

The new patch is a bit more difficult to handle, and will probably need some updating as the books changes, but I think it's a better way to handle it. The test suites should now not be affected by the patch, and the failures compiling uClibc I've reported earlier should also be gone.

Manuel: You might want to glance over my xsl language, as I've never worked with xsl before, there's most likely prettier ways to handle things.

And I'm also curious to if you guys want to take over the patch when it's ready, or should I keep it updated. I realize you guys have lots of things to work on when you're starting on the BLFS part, so I'm happy to keep on working with my baby ;)

If anyone feels like testing the patch, I'd be happy for reports.
I'll start the LFS-uClibc part now to see if there's something I've missed.


Tor Olav
diff -Naur jhalfs-X-2467-orig/HLFS/hlfs.xsl jhalfs-X-2467-paco/HLFS/hlfs.xsl
--- jhalfs-X-2467-orig/HLFS/hlfs.xsl    2006-03-29 22:35:58.000000000 +0200
+++ jhalfs-X-2467-paco/HLFS/hlfs.xsl    2006-03-30 11:01:22.000000000 +0200
@@ -39,6 +39,9 @@
   <xsl:param name="lang" select="en_CA"/>
   <xsl:param name="lc_all" select="en_CA"/>
 
+  <!-- Use paco? -->
+  <xsl:param name="use_paco" select="1"/>
+
   <xsl:template match="/">
     <xsl:apply-templates select="//sect1"/>
   </xsl:template>
@@ -191,6 +194,10 @@
       <!-- Fixing bootscripts installation -->
       <xsl:when test="ancestor::[EMAIL PROTECTED]'bootable-bootscripts'] and
                 string() = 'make install'">
+        <!-- inserting LD_PRELOAD before installing bootscripts -->
+        <xsl:if test="$use_paco != '0'">
+          <xsl:text>export LD_PRELOAD=/usr/lib/libpaco-log.so&#xA;</xsl:text>
+        </xsl:if>
         <xsl:text>make install&#xA;</xsl:text>
         <xsl:text>cd 
../blfs-bootscripts-&blfs-bootscripts-version;&#xA;</xsl:text>
       </xsl:when>
@@ -206,6 +213,10 @@
       <xsl:when test="string() = 'make menuconfig'"/>
       <!-- For uClibc we need to cd to the Gettext package -->
       <xsl:when test="contains(string(),'cd gettext-runtime/')">
+        <!-- unset LD_PRELOAD before building gettext in uClibc -->
+        <xsl:if test="$use_paco != '0' and ancestor::[EMAIL 
PROTECTED]'chapter-building-system']">
+          <xsl:text>unset LD_PRELOAD&#xA;</xsl:text>
+        </xsl:if>
         <xsl:text>cd ../gettext-*/gettext-runtime</xsl:text>
         <xsl:value-of select="substring-after(string(),'gettext-runtime')"/>
         <xsl:text>&#xA;</xsl:text>
@@ -248,6 +259,79 @@
         <xsl:apply-templates/>
         <xsl:text> || true&#xA;</xsl:text>
       </xsl:when>
+      <!-- paco begin chapter06 -->
+      <xsl:when test="$use_paco != '0'">
+        <xsl:choose>
+          <!-- Binutils, DB, Iproute2, Grub, Sysvinit, and Udev -->
+          <xsl:when test="(ancestor::[EMAIL PROTECTED]'ch-system-binutils'] or
+                    ancestor::[EMAIL PROTECTED]'ch-system-vim'] or
+                    ancestor::[EMAIL PROTECTED]'ch-system-iproute2'] or
+                    ancestor::[EMAIL PROTECTED]'ch-system-grub'] or
+                    ancestor::[EMAIL PROTECTED]'ch-system-util-linux'] or
+                    ancestor::[EMAIL PROTECTED]'ch-system-sysvinit'] or
+                    ancestor::[EMAIL PROTECTED]'ch-system-udev']) and
+                    contains(string(),'make ') and
+                    contains(string(),' install')">
+            <xsl:text>export LD_PRELOAD=/usr/lib/libpaco-log.so&#xA;</xsl:text>
+            <xsl:apply-templates/>
+            <xsl:text>&#xA;</xsl:text>
+          </xsl:when>
+          <!-- uClibc -->
+          <xsl:when test="ancestor::[EMAIL PROTECTED]'ch-system-uclibc']">
+            <xsl:choose>
+              <xsl:when test="contains(string(),'make install')">
+                <xsl:value-of select="substring-before(string(),'make 
install')"/>
+                <xsl:text>export 
LD_PRELOAD=/usr/lib/libpaco-log.so&#xA;</xsl:text>
+                <xsl:text>make install&#xA;</xsl:text>
+                <xsl:text>unset LD_PRELOAD&#xA;</xsl:text>
+              </xsl:when>
+              <xsl:when test="contains(string(),'make -C utils install')">
+                <xsl:value-of select="substring-before(string(),'make -C utils 
install')"/>
+                <xsl:text>export 
LD_PRELOAD=/usr/lib/libpaco-log.so&#xA;</xsl:text>
+                <xsl:text>make -C utils install&#xA;</xsl:text>
+              </xsl:when>
+              <xsl:when test="contains(string(),'make -C intl/ install')">
+                <xsl:text>export 
LD_PRELOAD=/usr/lib/libpaco-log.so&#xA;</xsl:text>
+                <xsl:text>make -C intl/ install</xsl:text>
+                <xsl:value-of select="substring-after(string(),'make -C intl/ 
install')"/>
+              </xsl:when>
+              <xsl:otherwise>
+                <xsl:apply-templates/>
+                <xsl:text>&#xA;</xsl:text>
+              </xsl:otherwise>
+            </xsl:choose>
+          </xsl:when>
+          <!-- Linux-libc-headers -->
+          <xsl:when test="ancestor::[EMAIL 
PROTECTED]'ch-system-linux-libc-headers'] and
+                    contains(string(),'install ')">
+            <xsl:text>export LD_PRELOAD=/usr/lib/libpaco-log.so&#xA;</xsl:text>
+            <xsl:apply-templates/>
+            <xsl:text>&#xA;</xsl:text>
+          </xsl:when>
+          <!-- Mktemp -->
+          <xsl:when test="ancestor::[EMAIL PROTECTED]'ch-system-mktemp'] and
+                    contains(string(),'make install&#xA;')">
+            <xsl:text>export LD_PRELOAD=/usr/lib/libpaco-log.so&#xA;</xsl:text>
+            <xsl:apply-templates/>
+            <xsl:text>&#xA;</xsl:text>
+          </xsl:when>
+          <!-- The rest of chapter 06 commands -->
+          <xsl:when test="string() = 'make install' and
+                    ancestor::[EMAIL PROTECTED]'chapter-building-system']">
+            <xsl:text>export LD_PRELOAD=/usr/lib/libpaco-log.so&#xA;</xsl:text>
+            <xsl:apply-templates/>
+            <xsl:text>&#xA;</xsl:text>
+          </xsl:when>
+          <!-- chapter 08 kernel -->
+          <xsl:when test="ancestor::[EMAIL PROTECTED]'bootable-kernel'] and
+                    string() = 'make modules_install'">
+            <xsl:text>export LD_PRELOAD=/usr/lib/libpaco-log.so&#xA;</xsl:text>
+            <xsl:apply-templates/>
+            <xsl:text>&#xA;</xsl:text>
+          </xsl:when>
+        </xsl:choose>
+      </xsl:when>
+      <!-- paco end -->
       <!-- The rest of commands -->
       <xsl:otherwise>
         <xsl:apply-templates/>
diff -Naur jhalfs-X-2467-orig/HLFS/master.sh jhalfs-X-2467-paco/HLFS/master.sh
--- jhalfs-X-2467-orig/HLFS/master.sh   2006-03-29 22:35:58.000000000 +0200
+++ jhalfs-X-2467-paco/HLFS/master.sh   2006-03-29 22:36:27.000000000 +0200
@@ -376,7 +376,9 @@
         wrt_run_as_root "${this_script}" "${file}"
         ;;
       *)   # The rest of Chapter06
+        wrt_paco_prep
         wrt_run_as_chroot1 "${this_script}" "${file}"
+        wrt_paco_log "$name" "$vrs"
        ;;
     esac
     #
@@ -407,6 +409,13 @@
 
     # Keep the script file name for Makefile dependencies.
     PREV=$this_script
+
+    # Inserting paco build commands
+    case "${this_script}" in
+      *devices)      wrt_paco_inst "068.5" ;;
+      *readjusting)  wrt_paco_inst "073.5" ;;
+    esac
+
   done # end for file in chapter06/*
 
 }
@@ -469,6 +478,15 @@
           wrt_run_as_chroot2 "${this_script}" "${file}"
         fi
         ;;
+      *kernel)       wrt_paco_prep
+                     wrt_run_as_chroot2 "$this_script" "$file"
+                     version=`grep "^linux-version" $JHALFSDIR/packages | sed 
-e 's/.* //' -e 's/"//g'`
+                     wrt_paco_log "linux-kernel" "$version"
+        ;;
+      *bootscripts)  wrt_paco_prep
+                     wrt_run_as_chroot2 "$this_script" "$file"
+                     wrt_paco_log "hlfs-bootscripts"
+        ;;
       *)  # All other scripts
         wrt_run_as_chroot2 "${this_script}" "${file}"
         ;;
diff -Naur jhalfs-X-2467-orig/LFS/lfs.xsl jhalfs-X-2467-paco/LFS/lfs.xsl
--- jhalfs-X-2467-orig/LFS/lfs.xsl      2006-03-29 22:35:58.000000000 +0200
+++ jhalfs-X-2467-paco/LFS/lfs.xsl      2006-03-30 11:10:17.000000000 +0200
@@ -32,6 +32,9 @@
   <!-- Locale settings -->
   <xsl:param name="lang" select="en_CA"/>
 
+  <!-- Use paco? -->
+  <xsl:param name="use_paco" select="1"/>
+
   <xsl:template match="/">
     <xsl:apply-templates select="//sect1"/>
   </xsl:template>
@@ -190,6 +193,70 @@
         <xsl:apply-templates/>
         <xsl:text> || true&#xA;</xsl:text>
       </xsl:when>
+      <!-- paco begin -->
+      <xsl:when test="$use_paco != '0'">
+        <xsl:choose>
+          <!-- Binutils, DB, Iproute2, Grub, Sysvinit, and Udev -->
+          <xsl:when test="(ancestor::[EMAIL PROTECTED]'ch-system-binutils'] or
+                    ancestor::[EMAIL PROTECTED]'ch-system-db'] or
+                    ancestor::[EMAIL PROTECTED]'ch-system-iproute2'] or
+                    ancestor::[EMAIL PROTECTED]'ch-system-grub'] or
+                    ancestor::[EMAIL PROTECTED]'ch-system-sysvinit'] or
+                    ancestor::[EMAIL PROTECTED]'ch-system-udev']) and
+                    contains(string(),'make ') and
+                    contains(string(),' install')">
+            <xsl:text>export LD_PRELOAD=/usr/lib/libpaco-log.so&#xA;</xsl:text>
+            <xsl:apply-templates/>
+            <xsl:text>&#xA;</xsl:text>
+          </xsl:when>
+          <!-- Linux-libc-headers -->
+          <xsl:when test="ancestor::[EMAIL 
PROTECTED]'ch-system-linux-libc-headers'] and
+                    contains(string(),'install ')">
+            <xsl:text>export LD_PRELOAD=/usr/lib/libpaco-log.so&#xA;</xsl:text>
+            <xsl:apply-templates/>
+            <xsl:text>&#xA;</xsl:text>
+          </xsl:when>
+          <!-- Mktemp -->
+          <xsl:when test="ancestor::[EMAIL PROTECTED]'ch-system-mktemp'] and
+                    contains(string(),'make install&#xA;')">
+            <xsl:text>export LD_PRELOAD=/usr/lib/libpaco-log.so&#xA;</xsl:text>
+            <xsl:apply-templates/>
+            <xsl:text>&#xA;</xsl:text>
+          </xsl:when>
+          <!-- Unset LD_PRELOAD before second make in Zlib -->
+          <xsl:when test="ancestor::[EMAIL PROTECTED]'ch-system-zlib'] and
+                    contains(string(),'make clean')">
+            <xsl:text>unset LD_PRELOAD&#xA;</xsl:text>
+            <xsl:apply-templates/>
+            <xsl:text>&#xA;</xsl:text>
+          </xsl:when>
+          <!-- The rest of chapter 06 commands -->
+          <xsl:when test="string() = 'make install' and
+                    ancestor::[EMAIL PROTECTED]'chapter-building-system']">
+            <xsl:text>export LD_PRELOAD=/usr/lib/libpaco-log.so&#xA;</xsl:text>
+            <xsl:apply-templates/>
+            <xsl:text>&#xA;</xsl:text>
+          </xsl:when>
+          <!-- chapter 07 bootscripts -->
+          <xsl:when test="ancestor::[EMAIL 
PROTECTED]'ch-scripts-bootscripts']">
+            <xsl:text>export LD_PRELOAD=/usr/lib/libpaco-log.so&#xA;</xsl:text>
+            <xsl:apply-templates/>
+            <xsl:text>&#xA;</xsl:text>
+          </xsl:when>
+          <!-- chapter 08 kernel -->
+          <xsl:when test="ancestor::[EMAIL PROTECTED]'ch-bootable-kernel'] and
+                    string() = 'make modules_install'">
+            <xsl:text>export LD_PRELOAD=/usr/lib/libpaco-log.so&#xA;</xsl:text>
+            <xsl:apply-templates/>
+            <xsl:text>&#xA;</xsl:text>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:apply-templates/>
+            <xsl:text>&#xA;</xsl:text>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:when>
+      <!-- paco end -->
       <!-- The rest of commands -->
       <xsl:otherwise>
         <xsl:apply-templates/>
diff -Naur jhalfs-X-2467-orig/LFS/master.sh jhalfs-X-2467-paco/LFS/master.sh
--- jhalfs-X-2467-orig/LFS/master.sh    2006-03-29 22:35:58.000000000 +0200
+++ jhalfs-X-2467-paco/LFS/master.sh    2006-03-30 11:12:40.000000000 +0200
@@ -181,7 +181,9 @@
     # and not to use chroot.
     case "${this_script}" in
       *kernfs)  wrt_run_as_root    "${this_script}" "$file" ;;
-      *)        wrt_run_as_chroot1 "${this_script}" "$file" ;;
+      *)        wrt_paco_prep
+                wrt_run_as_chroot1 "${this_script}" "$file"
+                wrt_paco_log "$name" "$vrs" ;;
     esac
 
     # Remove the build directory(ies) except if the package build fails.
@@ -199,6 +201,13 @@
 
     # Keep the script file name for Makefile dependencies.
     PREV=${this_script}
+
+    # Inserting paco build commands
+    case "${this_script}" in
+      *devices)      wrt_paco_inst "065.5" ;;
+      *readjusting)  wrt_paco_inst "069.5" ;;
+    esac
+
   done # end for file in chapter06/*
 }
 
@@ -260,6 +269,14 @@
                 wrt_run_as_chroot2 "$this_script" "$file"
               fi
         ;;
+      *kernel)       wrt_paco_prep
+                     wrt_run_as_chroot2 "$this_script" "$file"
+                     wrt_paco_log "linux-kernel" "$vrs"
+        ;;
+      *bootscripts)  wrt_paco_prep
+                     wrt_run_as_chroot2 "$this_script" "$file"
+                     wrt_paco_log "lfs-bootscripts" "$vrs"
+        ;;
       *)        wrt_run_as_chroot2 "$this_script" "$file"
         ;;
     esac
diff -Naur jhalfs-X-2467-orig/common/common-functions 
jhalfs-X-2467-paco/common/common-functions
--- jhalfs-X-2467-orig/common/common-functions  2006-03-29 22:35:58.000000000 
+0200
+++ jhalfs-X-2467-paco/common/common-functions  2006-03-29 22:36:27.000000000 
+0200
@@ -624,6 +624,7 @@
                  --stringparam lc_all $LC_ALL \
                  --stringparam keymap $KEYMAP \
                  --stringparam grsecurity_host $GRSECURITY_HOST \
+                 --stringparam use_paco $USE_PACO \
                  -o ./${PROGNAME}-commands/ $XSL $BOOK/index.xml 
>>$LOGDIR/$LOG 2>&1
       ;;
     lfs)
@@ -635,6 +636,7 @@
                  --stringparam timezone $TIMEZONE \
                  --stringparam page $PAGE \
                  --stringparam lang $LANG \
+                 --stringparam use_paco $USE_PACO \
                  -o ./${PROGNAME}-commands/ $XSL $BOOK/index.xml 
>>$LOGDIR/$LOG 2>&1
       ;;
     blfs)
diff -Naur jhalfs-X-2467-orig/common/config jhalfs-X-2467-paco/common/config
--- jhalfs-X-2467-orig/common/config    2006-03-29 22:35:58.000000000 +0200
+++ jhalfs-X-2467-paco/common/config    2006-03-29 23:15:33.000000000 +0200
@@ -73,3 +73,18 @@
 #--- Working directories
 JHALFSDIR=$BUILDDIR/jhalfs
    LOGDIR=$JHALFSDIR/logs
+
+#==== PACO VARIABLES ====
+#--- Use paco? 0/1 0(no)/1(yes)
+USE_PACO=1
+PACO_VERSION=20060327
+
+#--- Name of the Paco source package
+PACO_FILE=paco-$PACO_VERSION.tar.*
+
+#--- Variables needed
+# Don't change unless you know what you're doing
+PACO_INCLUDE=/
+PACO_EXCLUDE=/sys:/dev:/proc:/tmp:/usr/src:/usr/share/info/dir
+PACO_TMPFILE=/tmp/paco.tmp
+LD_PRELOAD=/usr/lib/libpaco-log.so
diff -Naur jhalfs-X-2467-orig/common/paco-build.sh 
jhalfs-X-2467-paco/common/paco-build.sh
--- jhalfs-X-2467-orig/common/paco-build.sh     1970-01-01 01:00:00.000000000 
+0100
+++ jhalfs-X-2467-paco/common/paco-build.sh     2006-03-29 22:36:27.000000000 
+0200
@@ -0,0 +1,9 @@
+#!/bin/sh
+set -e
+
+cd $PKGDIR
+./configure --prefix=/usr \
+       --disable-gpaco \
+       --sysconfdir=/etc &&
+make &&
+make install
diff -Naur jhalfs-X-2467-orig/common/paco-functions 
jhalfs-X-2467-paco/common/paco-functions
--- jhalfs-X-2467-orig/common/paco-functions    1970-01-01 01:00:00.000000000 
+0100
+++ jhalfs-X-2467-paco/common/paco-functions    2006-03-29 22:36:27.000000000 
+0200
@@ -0,0 +1,90 @@
+#!/bin/bash
+
+
+#----------------------------#
+wrt_paco_inst() {            #
+#----------------------------#
+if [ $USE_PACO != 0 ]; then
+  name="paco"
+  this_script="$1-$name"
+  file="chapter06/$this_script"
+  chapter6="$chapter6 $this_script"
+
+  # Write target, dependency and unpack
+  wrt_target "$this_script" "$PREV"
+  wrt_unpack2 "$PACO_FILE"
+
+  # Copy the paco build script to the correct directory and make it executable
+  echo -e "[EMAIL PROTECTED] $JHALFSDIR/paco-build.sh 
$JHALFSDIR/${PROGNAME}-commands/$file && \\" >> $MKFILE.tmp
+  echo -e "\tchmod +x $JHALFSDIR/${PROGNAME}-commands/$file" >> $MKFILE.tmp
+
+  # Run the script
+  wrt_run_as_chroot1 "${this_script}" "${file}"
+
+  # Clean up
+  wrt_remove_build_dirs "$name"
+  echo -e '[EMAIL PROTECTED] $@' >> $MKFILE.tmp
+
+  # Override the PREV variable
+  PREV="$this_script"
+fi
+}
+
+
+#----------------------------------#
+wrt_paco_prep() {                  # Export Paco variables
+#----------------------------------# and remove tmpfile
+if [ $USE_PACO != 0 ] && [ "$vrs" != "" ]; then
+(
+cat  << EOF
+       @echo "export PACO_INCLUDE=$PACO_INCLUDE" >> envars && \\
+       echo "export PACO_EXCLUDE=\$(SRC):$JHALFSDIR:$PACO_EXCLUDE" >> envars 
&& \\
+       echo "export PACO_TMPFILE=$PACO_TMPFILE" >> envars && \\
+       rm -f \$(MOUNT_PT)$PACO_TMPFILE
+EOF
+) >> $MKFILE.tmp
+fi
+}
+
+
+#----------------------------------#
+wrt_paco_log() {                   # If the tmpfile exist, then log the 
current package
+#----------------------------------# and remove tempfile
+  local PACKAGE
+
+  if [[ $2 != "" ]] ; then
+    PACKAGE="$1-$2";
+  else
+    PACKAGE="$1"
+  fi
+
+if [ $USE_PACO != 0 ] && [ "$vrs" != "" ]; then
+(
+cat << EOF
+       @if [ -e \$(MOUNT_PT)$PACO_TMPFILE ]; then \\
+               \$(CHROOT1) 'paco -lp $PACKAGE < $PACO_TMPFILE' && \\
+               rm -f \$(MOUNT_PT)$PACO_TMPFILE; \\
+       fi;
+EOF
+) >> $MKFILE.tmp
+fi
+}
+
+
+#----------------------------------#
+wrt_paco_log_blfs() {              # If the tmpfile exist, then log the 
current package
+#----------------------------------# and remove tempfile
+if [ $USE_PACO != 0 ]; then
+(
+cat << EOF
+       @PACKAGE=\`head -n1 /tmp/unpacked | sed '[EMAIL 
PROTECTED]/@@;s@/.*@@'\` && \\
+       if [ -e $PACO_TMPFILE ]; then \\
+               paco -E ~/sources:$JHALFSDIR:$PACO_EXCLUDE \\
+               -lp \$\$PACKAGE < $PACO_TMPFILE && \\
+               rm -f $PACO_TMPFILE; \\
+       fi;
+EOF
+) >> $MKFILE
+fi
+}
+
diff -Naur jhalfs-X-2467-orig/master.sh jhalfs-X-2467-paco/master.sh
--- jhalfs-X-2467-orig/master.sh        2006-03-29 22:35:58.000000000 +0200
+++ jhalfs-X-2467-paco/master.sh        2006-03-29 23:08:20.000000000 +0200
@@ -66,6 +66,11 @@
 source $MODULE
 [[ $? > 0 ]] && echo "$MODULE did not load.." && exit 2
 [[ $VERBOSITY > 0 ]] && echo "OK"
+# Load paco-functions
+[[ $VERBOSITY > 0 ]] && echo -n "Loading paco module..."
+source $COMMON_DIR/paco-functions
+[[ $? > 0 ]] && echo "$COMMON_DIR/paco-functions did not load.." && exit 2
+[[ $VERBOSITY > 0 ]] && echo "OK"
 #
 [[ $VERBOSITY > 0 ]] && echo "---------------${nl_}"
 
@@ -456,6 +461,13 @@
 
 if [[ "$PWD" != "$JHALFSDIR" ]]; then
   cp $COMMON_DIR/makefile-functions $JHALFSDIR/
+  if [[ USE_PACO != 0 ]] && [[ $PROGNAME != "blfs" ]]; then
+    cp -v $COMMON_DIR/paco-build.sh $JHALFSDIR/
+  elif [[ USE_PACO != 0 ]] && [[ $PROGNAME = "blfs" ]]; then
+    echo -e "export PACO_INCLUDE=$PACO_INCLUDE" > $JHALFSDIR/pacovars
+    echo -e "export PACO_EXCLUDE=~/sources:$JHALFSDIR:$PACO_EXCLUDE" >> 
$JHALFSDIR/pacovars
+    echo -e "export PACO_TMPFILE=$PACO_TMPFILE" >> $JHALFSDIR/pacovars
+  fi
   if [[ -n "$FILES" ]]; then
     # pushd/popd necessary to deal with mulitiple files
     pushd $PACKAGE_DIR 1> /dev/null
-- 
http://linuxfromscratch.org/mailman/listinfo/alfs-discuss
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to