Index: common/blfs-tool-deps/901-libxml2
===================================================================
--- common/blfs-tool-deps/901-libxml2	(revision f5dc6d74236ef57bedebabdee664f108f05fa036)
+++ common/blfs-tool-deps/901-libxml2	(revision 7072e1faf4f91f0343e9ff11221b19c8fcc6de87)
@@ -7,5 +7,27 @@
 ./configure --prefix=/usr
 make
-make install
+if ! [ -z $PKG_DEST ]; then
+	mkdir -pv $PKG_DEST/{lib,usr/{share/{man,doc,info},lib}}
+	ln -sv share/{man,doc,info} $PKG_DEST/usr
+	case $(uname -m) in
+	 x86_64) ln -sv lib $PKG_DEST/lib64 && ln -sv lib $PKG_DEST/usr/lib64 ;;
+	esac
+fi
+make DESTDIR=$PKG_DEST install
+if ! [ -z $PKG_DEST ]; then 
+	rm -fv $PKG_DEST/{,usr/}lib64 
+	rm -fv $PKG_DEST/usr/{man,doc,info}
+	for dir in $PKG_DEST/usr/share/{doc,info,man}; do
+	  [[ -z $(ls $dir) ]] && rmdir -v $dir
+	done
+	for dir in $PKG_DEST/usr/{lib,share}; do
+	  [[ -z $(ls $dir) ]] && rmdir -v $dir
+	done
+	for dir in $PKG_DEST/{lib,usr}; do
+	  [[ -z $(ls $dir) ]] && rmdir -v $dir
+	done
+	packInstall
+fi
+rm -rf $PKG_DEST
 
 exit
Index: common/blfs-tool-deps/902-libxslt
===================================================================
--- common/blfs-tool-deps/902-libxslt	(revision f5dc6d74236ef57bedebabdee664f108f05fa036)
+++ common/blfs-tool-deps/902-libxslt	(revision 7072e1faf4f91f0343e9ff11221b19c8fcc6de87)
@@ -7,5 +7,27 @@
 ./configure --prefix=/usr
 make
-make install
+if ! [ -z $PKG_DEST ]; then
+	mkdir -pv $PKG_DEST/{lib,usr/{share/{man,doc,info},lib}}
+	ln -sv share/{man,doc,info} $PKG_DEST/usr
+	case $(uname -m) in
+	 x86_64) ln -sv lib $PKG_DEST/lib64 && ln -sv lib $PKG_DEST/usr/lib64 ;;
+	esac
+fi
+make DESTDIR=$PKG_DEST install
+if ! [ -z $PKG_DEST ]; then 
+	rm -fv $PKG_DEST/{,usr/}lib64 
+	rm -fv $PKG_DEST/usr/{man,doc,info}
+        for dir in $PKG_DEST/usr/share/{doc,info,man}; do
+          [[ -z $(ls $dir) ]] && rmdir -v $dir
+        done
+        for dir in $PKG_DEST/usr/{lib,share}; do
+          [[ -z $(ls $dir) ]] && rmdir -v $dir
+        done
+        for dir in $PKG_DEST/{lib,usr}; do
+          [[ -z $(ls $dir) ]] && rmdir -v $dir
+        done
+	packInstall
+fi
+rm -rf $PKG_DEST
 
 exit
Index: common/blfs-tool-deps/903-tidy
===================================================================
--- common/blfs-tool-deps/903-tidy	(revision f5dc6d74236ef57bedebabdee664f108f05fa036)
+++ common/blfs-tool-deps/903-tidy	(revision 7072e1faf4f91f0343e9ff11221b19c8fcc6de87)
@@ -8,6 +8,32 @@
 ./configure --prefix=/usr
 make
-make install
-make -C htmldoc install_apidocs
+if ! [ -z $PKG_DEST ]; then
+	mkdir -pv $PKG_DEST/{lib,usr/{share/{man,doc,info},lib}}
+	ln -sv share/{man,doc,info} $PKG_DEST/usr
+	case $(uname -m) in
+	 x86_64) ln -sv lib $PKG_DEST/lib64 && ln -sv lib $PKG_DEST/usr/lib64 ;;
+	esac
+fi
+make DESTDIR=$PKG_DEST install
+install -v -m644 -D htmldoc/tidy.1 \
+                    $PKG_DEST/usr/share/man/man1/tidy.1
+install -v -m755 -d $PKG_DEST/usr/share/doc/tidy-cvs_20101110
+install -v -m644    htmldoc/*.{html,gif,css} \
+                    $PKG_DEST/usr/share/doc/tidy-cvs_20101110
+if ! [ -z $PKG_DEST ]; then 
+	rm -fv $PKG_DEST/{,usr/}lib64 
+	rm -fv $PKG_DEST/usr/{man,doc,info}
+        for dir in $PKG_DEST/usr/share/{doc,info,man}; do
+          [[ -z $(ls $dir) ]] && rmdir -v $dir
+        done
+        for dir in $PKG_DEST/usr/{lib,share}; do
+          [[ -z $(ls $dir) ]] && rmdir -v $dir
+        done
+        for dir in $PKG_DEST/{lib,usr}; do
+          [[ -z $(ls $dir) ]] && rmdir -v $dir
+        done
+	packInstall
+fi
+rm -rf $PKG_DEST
 
 exit
Index: common/blfs-tool-deps/904-unzip
===================================================================
--- common/blfs-tool-deps/904-unzip	(revision f5dc6d74236ef57bedebabdee664f108f05fa036)
+++ common/blfs-tool-deps/904-unzip	(revision 7072e1faf4f91f0343e9ff11221b19c8fcc6de87)
@@ -6,7 +6,37 @@
 cd $PKGDIR
 
-patch -Np1 -i ../unzip-5.52-security_fix-1.patch
-make -f unix/Makefile LOCAL_UNZIP=-D_FILE_OFFSET_BITS=64 linux
-make prefix=/usr install
+case `uname -m` in
+  i?86)
+    sed -i -e 's/DASM"/DASM -DNO_LCHMOD"/' unix/Makefile
+    make -f unix/Makefile linux
+    ;;
+  *)
+    sed -i -e 's/CFLAGS="-O -Wall/& -DNO_LCHMOD/' unix/Makefile
+    make -f unix/Makefile linux_noasm
+    ;;
+esac
+if ! [ -z $PKG_DEST ]; then
+	mkdir -pv $PKG_DEST/{lib,usr/{share/{man,doc,info},lib}}
+	ln -sv share/{man,doc,info} $PKG_DEST/usr
+	case $(uname -m) in
+	 x86_64) ln -sv lib $PKG_DEST/lib64 && ln -sv lib $PKG_DEST/usr/lib64 ;;
+	esac
+fi
+make prefix=$PKG_DEST/usr install
+if ! [ -z $PKG_DEST ]; then 
+	rm -fv $PKG_DEST/{,usr/}lib64 
+	rm -fv $PKG_DEST/usr/{man,doc,info}
+        for dir in $PKG_DEST/usr/share/{doc,info,man}; do
+          [[ -z $(ls $dir) ]] && rmdir -v $dir
+        done
+        for dir in $PKG_DEST/usr/{lib,share}; do
+          [[ -z $(ls $dir) ]] && rmdir -v $dir
+        done
+        for dir in $PKG_DEST/{lib,usr}; do
+          [[ -z $(ls $dir) ]] && rmdir -v $dir
+        done
+	packInstall
+fi
+rm -rf $PKG_DEST
 
 exit
Index: common/blfs-tool-deps/905-docbook-xml
===================================================================
--- common/blfs-tool-deps/905-docbook-xml	(revision f5dc6d74236ef57bedebabdee664f108f05fa036)
+++ common/blfs-tool-deps/905-docbook-xml	(revision 7072e1faf4f91f0343e9ff11221b19c8fcc6de87)
@@ -9,75 +9,75 @@
 cd docbook-xml
 unzip ../docbook-xml-4.5.zip
-install -v -d -m755 /usr/share/xml/docbook/xml-dtd-4.5
-install -v -d -m755 /etc/xml
+install -v -d -m755 $PKG_DEST/usr/share/xml/docbook/xml-dtd-4.5
+install -v -d -m755 $PKG_DEST/etc/xml
 chown -R root:root .
 cp -v -af docbook.cat *.dtd ent/ *.mod \
-    /usr/share/xml/docbook/xml-dtd-4.5
-if [ ! -e /etc/xml/docbook ]; then
-    xmlcatalog --noout --create /etc/xml/docbook
+    $PKG_DEST/usr/share/xml/docbook/xml-dtd-4.5
+if [ ! -e $PKG_DEST/etc/xml/docbook ]; then
+    xmlcatalog --noout --create $PKG_DEST/etc/xml/docbook
 fi
 xmlcatalog --noout --add "public" \
     "-//OASIS//DTD DocBook XML V4.5//EN" \
     "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" \
-    /etc/xml/docbook
+    $PKG_DEST/etc/xml/docbook
 xmlcatalog --noout --add "public" \
     "-//OASIS//DTD DocBook XML CALS Table Model V4.5//EN" \
     "file:///usr/share/xml/docbook/xml-dtd-4.5/calstblx.dtd" \
-    /etc/xml/docbook
+    $PKG_DEST/etc/xml/docbook
 xmlcatalog --noout --add "public" \
     "-//OASIS//DTD XML Exchange Table Model 19990315//EN" \
     "file:///usr/share/xml/docbook/xml-dtd-4.5/soextblx.dtd" \
-    /etc/xml/docbook
+    $PKG_DEST/etc/xml/docbook
 xmlcatalog --noout --add "public" \
     "-//OASIS//ELEMENTS DocBook XML Information Pool V4.5//EN" \
     "file:///usr/share/xml/docbook/xml-dtd-4.5/dbpoolx.mod" \
-    /etc/xml/docbook
+    $PKG_DEST/etc/xml/docbook
 xmlcatalog --noout --add "public" \
     "-//OASIS//ELEMENTS DocBook XML Document Hierarchy V4.5//EN" \
     "file:///usr/share/xml/docbook/xml-dtd-4.5/dbhierx.mod" \
-    /etc/xml/docbook
+    $PKG_DEST/etc/xml/docbook
 xmlcatalog --noout --add "public" \
     "-//OASIS//ELEMENTS DocBook XML HTML Tables V4.5//EN" \
     "file:///usr/share/xml/docbook/xml-dtd-4.5/htmltblx.mod" \
-    /etc/xml/docbook
+    $PKG_DEST/etc/xml/docbook
 xmlcatalog --noout --add "public" \
     "-//OASIS//ENTITIES DocBook XML Notations V4.5//EN" \
     "file:///usr/share/xml/docbook/xml-dtd-4.5/dbnotnx.mod" \
-    /etc/xml/docbook
+    $PKG_DEST/etc/xml/docbook
 xmlcatalog --noout --add "public" \
     "-//OASIS//ENTITIES DocBook XML Character Entities V4.5//EN" \
     "file:///usr/share/xml/docbook/xml-dtd-4.5/dbcentx.mod" \
-    /etc/xml/docbook
+    $PKG_DEST/etc/xml/docbook
 xmlcatalog --noout --add "public" \
     "-//OASIS//ENTITIES DocBook XML Additional General Entities V4.5//EN" \
     "file:///usr/share/xml/docbook/xml-dtd-4.5/dbgenent.mod" \
-    /etc/xml/docbook
+    $PKG_DEST/etc/xml/docbook
 xmlcatalog --noout --add "rewriteSystem" \
     "http://www.oasis-open.org/docbook/xml/4.5" \
     "file:///usr/share/xml/docbook/xml-dtd-4.5" \
-    /etc/xml/docbook
+    $PKG_DEST/etc/xml/docbook
 xmlcatalog --noout --add "rewriteURI" \
     "http://www.oasis-open.org/docbook/xml/4.5" \
     "file:///usr/share/xml/docbook/xml-dtd-4.5" \
-    /etc/xml/docbook
-if [ ! -e /etc/xml/catalog ]; then
-    xmlcatalog --noout --create /etc/xml/catalog
+    $PKG_DEST/etc/xml/docbook
+if [ ! -e $PKG_DEST/etc/xml/catalog ]; then
+    xmlcatalog --noout --create $PKG_DEST/etc/xml/catalog
 fi
 xmlcatalog --noout --add "delegatePublic" \
     "-//OASIS//ENTITIES DocBook XML" \
     "file:///etc/xml/docbook" \
-    /etc/xml/catalog
+    $PKG_DEST/etc/xml/catalog
 xmlcatalog --noout --add "delegatePublic" \
     "-//OASIS//DTD DocBook XML" \
     "file:///etc/xml/docbook" \
-    /etc/xml/catalog
+    $PKG_DEST/etc/xml/catalog
 xmlcatalog --noout --add "delegateSystem" \
     "http://www.oasis-open.org/docbook/" \
     "file:///etc/xml/docbook" \
-    /etc/xml/catalog
+    $PKG_DEST/etc/xml/catalog
 xmlcatalog --noout --add "delegateURI" \
     "http://www.oasis-open.org/docbook/" \
     "file:///etc/xml/docbook" \
-    /etc/xml/catalog
+    $PKG_DEST/etc/xml/catalog
 for DTDVERSION in 4.1.2 4.2 4.3 4.4
 do
@@ -85,22 +85,25 @@
     "-//OASIS//DTD DocBook XML V$DTDVERSION//EN" \
     "http://www.oasis-open.org/docbook/xml/$DTDVERSION/docbookx.dtd" \
-    /etc/xml/docbook
+    $PKG_DEST/etc/xml/docbook
   xmlcatalog --noout --add "rewriteSystem" \
     "http://www.oasis-open.org/docbook/xml/$DTDVERSION" \
     "file:///usr/share/xml/docbook/xml-dtd-4.5" \
-    /etc/xml/docbook
+    $PKG_DEST/etc/xml/docbook
   xmlcatalog --noout --add "rewriteURI" \
     "http://www.oasis-open.org/docbook/xml/$DTDVERSION" \
     "file:///usr/share/xml/docbook/xml-dtd-4.5" \
-    /etc/xml/docbook
+    $PKG_DEST/etc/xml/docbook
   xmlcatalog --noout --add "delegateSystem" \
     "http://www.oasis-open.org/docbook/xml/$DTDVERSION/" \
     "file:///etc/xml/docbook" \
-    /etc/xml/catalog
+    $PKG_DEST/etc/xml/catalog
   xmlcatalog --noout --add "delegateURI" \
     "http://www.oasis-open.org/docbook/xml/$DTDVERSION/" \
     "file:///etc/xml/docbook" \
-    /etc/xml/catalog
+    $PKG_DEST/etc/xml/catalog
 done
+export PKGDIR=/sources/docbook-xml
+packInstall
+rm -rf $PKG_DEST
 cd ..
 rm -rf docbook-xml
Index: common/blfs-tool-deps/907-gpm
===================================================================
--- common/blfs-tool-deps/907-gpm	(revision f5dc6d74236ef57bedebabdee664f108f05fa036)
+++ common/blfs-tool-deps/907-gpm	(revision 7072e1faf4f91f0343e9ff11221b19c8fcc6de87)
@@ -6,11 +6,37 @@
 cd $PKGDIR
 
-patch -Np1 -i ../gpm-1.20.1-segfault-1.patch
-patch -Np1 -i ../gpm-1.20.1-silent-1.patch
 ./configure --prefix=/usr --sysconfdir=/etc
-LDFLAGS="$LDFLAGS -lm" make
-make install
-cp -v conf/gpm-root.conf /etc
-ldconfig
+make
+if ! [ -z $PKG_DEST ]; then
+	mkdir -pv $PKG_DEST/{lib,usr/{share/{man,doc,info},lib}}
+	ln -sv share/{man,doc,info} $PKG_DEST/usr
+	case $(uname -m) in
+	 x86_64) ln -sv lib $PKG_DEST/lib64 && ln -sv lib $PKG_DEST/usr/lib64 ;;
+	esac
+fi
+make DESTDIR=$PKG_DEST install
+ln -v -s libgpm.so.2.1.0 $PKG_DEST/usr/lib/libgpm.so
+mkdir -pv $PKG_DEST/etc
+install -v -m644 conf/gpm-root.conf $PKG_DEST/etc
+install -v -m755 -d $PKG_DEST/usr/share/doc/gpm-1.20.6
+chmod   -v   755    doc/{changes,support}
+chmod   -v   644    doc/{changes/*,support/*,FAQ,HACK_GPM,README*}
+cp      -v -R       doc/{FAQ,HACK_GPM,README*,changes,support} \
+                    $PKG_DEST/usr/share/doc/gpm-1.20.6
+if ! [ -z $PKG_DEST ]; then 
+	rm -fv $PKG_DEST/{,usr/}lib64 
+	rm -fv $PKG_DEST/usr/{man,doc,info}
+        for dir in $PKG_DEST/usr/share/{doc,info,man}; do
+          [[ -z $(ls $dir) ]] && rmdir -v $dir
+        done
+        for dir in $PKG_DEST/usr/{lib,share}; do
+          [[ -z $(ls $dir) ]] && rmdir -v $dir
+        done
+        for dir in $PKG_DEST/{lib,usr}; do
+          [[ -z $(ls $dir) ]] && rmdir -v $dir
+        done
+	packInstall
+fi
+rm -rf $PKG_DEST
 
 exit
Index: common/blfs-tool-deps/908-lynx
===================================================================
--- common/blfs-tool-deps/908-lynx	(revision f5dc6d74236ef57bedebabdee664f108f05fa036)
+++ common/blfs-tool-deps/908-lynx	(revision 7072e1faf4f91f0343e9ff11221b19c8fcc6de87)
@@ -8,5 +8,5 @@
 ./configure --prefix=/usr \
             --sysconfdir=/etc/lynx \
-            --datadir=/usr/share/doc/lynx-2.8.6 \
+            --datadir=/usr/share/doc/lynx-2.8.7rel.2 \
             --with-zlib \
             --with-bzlib \
@@ -14,6 +14,28 @@
             --enable-locale-charset
 make
-make install-full
-chgrp -v -R root /usr/share/doc/lynx-2.8.6/lynx_doc
+if ! [ -z $PKG_DEST ]; then
+	mkdir -pv $PKG_DEST/{lib,usr/{share/{man,doc,info},lib}}
+	ln -sv share/{man,doc,info} $PKG_DEST/usr
+	case $(uname -m) in
+	 x86_64) ln -sv lib $PKG_DEST/lib64 && ln -sv lib $PKG_DEST/usr/lib64 ;;
+	esac
+fi
+make DESTDIR=$PKG_DEST install-full
+chgrp -v -R root $PKG_DEST/usr/share/doc/lynx-2.8.7rel.2/lynx_doc
+if ! [ -z $PKG_DEST ]; then 
+	rm -fv $PKG_DEST/{,usr/}lib64 
+	rm -fv $PKG_DEST/usr/{man,doc,info}
+        for dir in $PKG_DEST/usr/share/{doc,info,man}; do
+          [[ -z $(ls $dir) ]] && rmdir -v $dir
+        done
+        for dir in $PKG_DEST/usr/{lib,share}; do
+          [[ -z $(ls $dir) ]] && rmdir -v $dir
+        done
+        for dir in $PKG_DEST/{lib,usr}; do
+          [[ -z $(ls $dir) ]] && rmdir -v $dir
+        done
+	packInstall
+fi
+rm -rf $PKG_DEST
 
 exit
Index: common/blfs-tool-deps/909-sudo
===================================================================
--- common/blfs-tool-deps/909-sudo	(revision f5dc6d74236ef57bedebabdee664f108f05fa036)
+++ common/blfs-tool-deps/909-sudo	(revision 7072e1faf4f91f0343e9ff11221b19c8fcc6de87)
@@ -6,10 +6,37 @@
 cd $PKGDIR
 
-patch -Np1 -i ../sudo-1.6.8p12-envvar_fix-1.patch
-./configure --prefix=/usr --libexecdir=/usr/lib \
-    --enable-noargs-shell --with-ignore-dot --with-all-insults \
-    --enable-shell-sets-home
+./configure --prefix=/usr \
+            --libexecdir=/usr/lib \
+            --with-ignore-dot \
+            --with-all-insults \
+            --enable-shell-sets-home \
+            --disable-root-sudo \
+            --with-logfac=auth \
+            --without-pam \
+            --without-sendmail
 make
-make install
+if ! [ -z $PKG_DEST ]; then
+	mkdir -pv $PKG_DEST/{lib,usr/{share/{man,doc,info},lib}}
+	ln -sv share/{man,doc,info} $PKG_DEST/usr
+	case $(uname -m) in
+	 x86_64) ln -sv lib $PKG_DEST/lib64 && ln -sv lib $PKG_DEST/usr/lib64 ;;
+	esac
+fi
+make DESTDIR=$PKG_DEST install
+if ! [ -z $PKG_DEST ]; then 
+	rm -fv $PKG_DEST/{,usr/}lib64 
+	rm -fv $PKG_DEST/usr/{man,doc,info}
+        for dir in $PKG_DEST/usr/share/{doc,info,man}; do
+          [[ -z $(ls $dir) ]] && rmdir -v $dir
+        done
+        for dir in $PKG_DEST/usr/{lib,share}; do
+          [[ -z $(ls $dir) ]] && rmdir -v $dir
+        done
+        for dir in $PKG_DEST/{lib,usr}; do
+          [[ -z $(ls $dir) ]] && rmdir -v $dir
+        done
+	packInstall
+fi
+rm -rf $PKG_DEST
 
 exit
Index: common/blfs-tool-deps/910-wget
===================================================================
--- common/blfs-tool-deps/910-wget	(revision f5dc6d74236ef57bedebabdee664f108f05fa036)
+++ common/blfs-tool-deps/910-wget	(revision 7072e1faf4f91f0343e9ff11221b19c8fcc6de87)
@@ -6,7 +6,31 @@
 cd $PKGDIR
 
-./configure --prefix=/usr --sysconfdir=/etc
+./configure --prefix=/usr \
+            --sysconfdir=/etc \
+            --without-ssl
 make
-make install
+if ! [ -z $PKG_DEST ]; then
+	mkdir -pv $PKG_DEST/{lib,usr/{share/{man,doc,info},lib}}
+	ln -sv share/{man,doc,info} $PKG_DEST/usr
+	case $(uname -m) in
+	 x86_64) ln -sv lib $PKG_DEST/lib64 && ln -sv lib $PKG_DEST/usr/lib64 ;;
+	esac
+fi
+make DESTDIR=$PKG_DEST install
+if ! [ -z $PKG_DEST ]; then 
+	rm -fv $PKG_DEST/{,usr/}lib64 
+	rm -fv $PKG_DEST/usr/{man,doc,info}
+        for dir in $PKG_DEST/usr/share/{doc,info,man}; do
+          [[ -z $(ls $dir) ]] && rmdir -v $dir
+        done
+        for dir in $PKG_DEST/usr/{lib,share}; do
+          [[ -z $(ls $dir) ]] && rmdir -v $dir
+        done
+        for dir in $PKG_DEST/{lib,usr}; do
+          [[ -z $(ls $dir) ]] && rmdir -v $dir
+        done
+	packInstall
+fi
+rm -rf $PKG_DEST
 
 exit
Index: common/blfs-tool-deps/911-sqlite
===================================================================
--- common/blfs-tool-deps/911-sqlite	(revision 7072e1faf4f91f0343e9ff11221b19c8fcc6de87)
+++ common/blfs-tool-deps/911-sqlite	(revision 7072e1faf4f91f0343e9ff11221b19c8fcc6de87)
@@ -0,0 +1,38 @@
+#!/bin/bash
+
+# $Id:$
+
+set -e
+cd $PKGDIR
+
+CFLAGS="-g -O2 -DSQLITE_SECURE_DELETE -DSQLITE_ENABLE_UNLOCK_NOTIFY=1" \
+            ./configure --prefix=/usr \
+            --enable-threadsafe \
+            --enable-readline \
+            --enable-dynamic-extensions &&
+make
+if ! [ -z $PKG_DEST ]; then
+	mkdir -pv $PKG_DEST/{lib,usr/{share/{man,doc,info},lib}}
+	ln -sv share/{man,doc,info} $PKG_DEST/usr
+	case $(uname -m) in
+	 x86_64) ln -sv lib $PKG_DEST/lib64 && ln -sv lib $PKG_DEST/usr/lib64 ;;
+	esac
+fi
+make DESTDIR=$PKG_DEST install
+if ! [ -z $PKG_DEST ]; then 
+	rm -fv $PKG_DEST/{,usr/}lib64 
+	rm -fv $PKG_DEST/usr/{man,doc,info}
+        for dir in $PKG_DEST/usr/share/{doc,info,man}; do
+          [[ -z $(ls $dir) ]] && rmdir -v $dir
+        done
+        for dir in $PKG_DEST/usr/{lib,share}; do
+          [[ -z $(ls $dir) ]] && rmdir -v $dir
+        done
+        for dir in $PKG_DEST/{lib,usr}; do
+          [[ -z $(ls $dir) ]] && rmdir -v $dir
+        done
+	packInstall
+fi
+rm -rf $PKG_DEST
+
+exit
Index: common/blfs-tool-deps/911-subversion
===================================================================
--- common/blfs-tool-deps/911-subversion	(revision f5dc6d74236ef57bedebabdee664f108f05fa036)
+++ 	(revision )
@@ -1,19 +1,0 @@
-#!/bin/bash
-
-# $Id$
-
-set -e
-cd $PKGDIR
-
-./configure --prefix=/usr \
-            --without-berkeley-db \
-            --with-installbuilddir=/usr/lib/apr-0
-make
-make install
-rm doc/{Makefile,doxygen.conf}
-find doc -type d -exec chmod 755 {} \;
-find doc -type f -exec chmod 644 {} \;
-install -v -m755 -d /usr/share/doc/subversion-1.3.1
-cp -v -R doc/* /usr/share/doc/subversion-1.3.1
-
-exit
Index: common/blfs-tool-deps/912-apr
===================================================================
--- common/blfs-tool-deps/912-apr	(revision 7072e1faf4f91f0343e9ff11221b19c8fcc6de87)
+++ common/blfs-tool-deps/912-apr	(revision 7072e1faf4f91f0343e9ff11221b19c8fcc6de87)
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+# $Id:$
+
+set -e
+cd $PKGDIR
+
+patch -Np1 -i ../apr-1.4.5-config.patch
+./configure
+make
+if ! [ -z $PKG_DEST ]; then
+	mkdir -pv $PKG_DEST/{lib,usr/{share/{man,doc,info},lib}}
+	ln -sv share/{man,doc,info} $PKG_DEST/usr
+	case $(uname -m) in
+	 x86_64) ln -sv lib $PKG_DEST/lib64 && ln -sv lib $PKG_DEST/usr/lib64 ;;
+	esac
+fi
+make DESTDIR=$PKG_DEST install
+if ! [ -z $PKG_DEST ]; then 
+	rm -fv $PKG_DEST/{,usr/}lib64 
+	rm -fv $PKG_DEST/usr/{man,doc,info}
+        for dir in $PKG_DEST/usr/share/{doc,info,man}; do
+          [[ -z $(ls $dir) ]] && rmdir -v $dir
+        done
+        for dir in $PKG_DEST/usr/{lib,share}; do
+          [[ -z $(ls $dir) ]] && rmdir -v $dir
+        done
+        for dir in $PKG_DEST/{lib,usr}; do
+          [[ -z $(ls $dir) ]] && rmdir -v $dir
+        done
+	packInstall
+fi
+rm -rf $PKG_DEST
+
+exit
Index: common/blfs-tool-deps/913-apr-util
===================================================================
--- common/blfs-tool-deps/913-apr-util	(revision 7072e1faf4f91f0343e9ff11221b19c8fcc6de87)
+++ common/blfs-tool-deps/913-apr-util	(revision 7072e1faf4f91f0343e9ff11221b19c8fcc6de87)
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+# $Id:$
+
+set -e
+cd $PKGDIR
+
+patch -Np1 -i ../apr-util-1.4.1-config.patch
+./configure --with-apr=/usr/bin/apr-1-config
+make
+if ! [ -z $PKG_DEST ]; then
+	mkdir -pv $PKG_DEST/{lib,usr/{share/{man,doc,info},lib}}
+	ln -sv share/{man,doc,info} $PKG_DEST/usr
+	case $(uname -m) in
+	 x86_64) ln -sv lib $PKG_DEST/lib64 && ln -sv lib $PKG_DEST/usr/lib64 ;;
+	esac
+fi
+make DESTDIR=$PKG_DEST install
+if ! [ -z $PKG_DEST ]; then 
+	rm -fv $PKG_DEST/{,usr/}lib64 
+	rm -fv $PKG_DEST/usr/{man,doc,info}
+        for dir in $PKG_DEST/usr/share/{doc,info,man}; do
+          [[ -z $(ls $dir) ]] && rmdir -v $dir
+        done
+        for dir in $PKG_DEST/usr/{lib,share}; do
+          [[ -z $(ls $dir) ]] && rmdir -v $dir
+        done
+        for dir in $PKG_DEST/{lib,usr}; do
+          [[ -z $(ls $dir) ]] && rmdir -v $dir
+        done
+	packInstall
+fi
+rm -rf $PKG_DEST
+
+exit
Index: common/blfs-tool-deps/914-subversion
===================================================================
--- common/blfs-tool-deps/914-subversion	(revision 7072e1faf4f91f0343e9ff11221b19c8fcc6de87)
+++ common/blfs-tool-deps/914-subversion	(revision 7072e1faf4f91f0343e9ff11221b19c8fcc6de87)
@@ -0,0 +1,36 @@
+#!/bin/bash
+
+# $Id: $
+
+set -e
+cd $PKGDIR
+
+./configure --prefix=/usr
+make
+if ! [ -z $PKG_DEST ]; then
+	mkdir -pv $PKG_DEST/{lib,usr/{share/{man,doc,info},lib}}
+	ln -sv share/{man,doc,info} $PKG_DEST/usr
+	case $(uname -m) in
+	 x86_64) ln -sv lib $PKG_DEST/lib64 && ln -sv lib $PKG_DEST/usr/lib64 ;;
+	esac
+fi
+make DESTDIR=$PKG_DEST install
+install -v -m755 -d $PKG_DEST/usr/share/doc/subversion-1.7.1
+cp -v -R doc/* $PKG_DEST/usr/share/doc/subversion-1.7.1
+if ! [ -z $PKG_DEST ]; then 
+	rm -fv $PKG_DEST/{,usr/}lib64 
+	rm -fv $PKG_DEST/usr/{man,doc,info}
+        for dir in $PKG_DEST/usr/share/{doc,info,man}; do
+          [[ -z $(ls $dir) ]] && rmdir -v $dir
+        done
+        for dir in $PKG_DEST/usr/{lib,share}; do
+          [[ -z $(ls $dir) ]] && rmdir -v $dir
+        done
+        for dir in $PKG_DEST/{lib,usr}; do
+          [[ -z $(ls $dir) ]] && rmdir -v $dir
+        done
+	packInstall
+fi
+rm -rf $PKG_DEST
+
+exit
Index: common/blfs-tool-deps/apr-1.4.5-config.patch
===================================================================
--- common/blfs-tool-deps/apr-1.4.5-config.patch	(revision 7072e1faf4f91f0343e9ff11221b19c8fcc6de87)
+++ common/blfs-tool-deps/apr-1.4.5-config.patch	(revision 7072e1faf4f91f0343e9ff11221b19c8fcc6de87)
@@ -0,0 +1,37 @@
+Submitted By:            Pierre Labastie
+Date:                    2011-12-27
+Initial Package Version: 1.4.5 (taken from BLFS patch for httpd-2.2.0)
+Upstream Status:         Not submitted (jhalfs specific)
+Origin:                  jhalfs
+Description:             Modify the layout for installing Apache Portable Runtime
+
+diff -Naur apr-1.4.5-orig/config.layout apr-1.4.5/config.layout
+--- apr-1.4.5-orig/config.layout	2004-11-24 22:51:51.000000000 +0000
++++ apr-1.4.5/config.layout		2005-12-14 21:06:37.000000000 +0000
+@@ -11,18 +11,18 @@
+ 
+ #   Classical APR path layout designed for parallel installs.
+ <Layout apr>
+-    prefix:        /usr/local/apr
++    prefix:        /usr
+     exec_prefix:   ${prefix}
+     bindir:        ${exec_prefix}/bin
+-    sbindir:       ${exec_prefix}/bin
++    sbindir:       ${exec_prefix}/sbin
+     libdir:        ${exec_prefix}/lib
+-    libexecdir:    ${exec_prefix}/modules
+-    mandir:        ${prefix}/man
+-    sysconfdir:    ${prefix}/conf
+-    datadir:       ${prefix}
+-    installbuilddir: ${datadir}/build-${APR_MAJOR_VERSION}
+-    includedir:    ${prefix}/include/apr-${APR_MAJOR_VERSION}
+-    localstatedir: ${prefix}
++    libexecdir:    ${exec_prefix}/lib/apache
++    mandir:        ${prefix}/share/man
++    sysconfdir:    /etc/apache
++    datadir:       /srv/www
++    installbuilddir: ${libexecdir}/build
++    includedir:    ${prefix}/include/apache
++    localstatedir: ${datadir}
+     libsuffix:     -${APR_MAJOR_VERSION}
+ </Layout>
Index: common/blfs-tool-deps/apr-util-1.4.1-config.patch
===================================================================
--- common/blfs-tool-deps/apr-util-1.4.1-config.patch	(revision 7072e1faf4f91f0343e9ff11221b19c8fcc6de87)
+++ common/blfs-tool-deps/apr-util-1.4.1-config.patch	(revision 7072e1faf4f91f0343e9ff11221b19c8fcc6de87)
@@ -0,0 +1,31 @@
+diff -Naur apr-util-1.4.1.orig/config.layout apr-util-1.4.1/config.layout
+--- apr-util-1.4.1.orig/config.layout	2005-02-09 13:18:43.000000000 +0100
++++ apr-util-1.4.1/config.layout	2011-12-27 19:29:41.667841632 +0100
+@@ -11,18 +11,18 @@
+ 
+ #   Classical APR-util path layout designed for parallel installs.
+ <Layout apr-util>
+-    prefix:        /usr/local/apr
++    prefix:        /usr
+     exec_prefix:   ${prefix}
+     bindir:        ${exec_prefix}/bin
+-    sbindir:       ${exec_prefix}/bin
++    sbindir:       ${exec_prefix}/sbin
+     libdir:        ${exec_prefix}/lib
+-    libexecdir:    ${exec_prefix}/modules
+-    mandir:        ${prefix}/man
+-    sysconfdir:    ${prefix}/conf
+-    datadir:       ${prefix}
+-    installbuilddir: ${datadir}/build
+-    includedir:    ${prefix}/include/apr-${APRUTIL_MAJOR_VERSION}
+-    localstatedir: ${prefix}
++    libexecdir:    ${exec_prefix}/lib/apache
++    mandir:        ${prefix}/share/man
++    sysconfdir:    /etc/apache
++    datadir:       /srv/www
++    installbuilddir: ${libexecdir}/build
++    includedir:    ${prefix}/include/apache
++    localstatedir: ${datadir}
+     libsuffix:     -${APRUTIL_MAJOR_VERSION}
+ </Layout>
+ 
Index: common/common-functions
===================================================================
--- common/common-functions	(revision f5dc6d74236ef57bedebabdee664f108f05fa036)
+++ common/common-functions	(revision 7072e1faf4f91f0343e9ff11221b19c8fcc6de87)
@@ -61,5 +61,5 @@
       echo -n "Cleaning $BUILDDIR ..."
       # First delete proc and sys directories, if exist.
-      # Both should be empty, if not be sure to exit.
+      # Both should be empty. If not, be sure to exit.
       if [ -d $BUILDDIR/proc ] ; then
         sudo rmdir $BUILDDIR/proc || exit 1
@@ -73,5 +73,5 @@
       sudo rm -rf $JHALFSDIR
       echo "done"
-      echo -n "Cleaning remainig extracted sources in $BUILDDIR/sources ..."
+      echo -n "Cleaning remaining extracted sources in $BUILDDIR/sources ..."
       sudo rm -rf `find $BUILDDIR/sources/* -maxdepth 0 -type d`
       echo "done"
Index: common/libs/func_blfs_deps
===================================================================
--- common/libs/func_blfs_deps	(revision f5dc6d74236ef57bedebabdee664f108f05fa036)
+++ common/libs/func_blfs_deps	(revision 7072e1faf4f91f0343e9ff11221b19c8fcc6de87)
@@ -23,5 +23,4 @@
   if [[ "${DEP_UNZIP}" = "y" ]] ; then
     echo "${UNZIP_URL} ${BLFS_SERVER}unzip/${UNZIP_PKG} ${UNZIP_MD5}" >> urls.lst
-    echo "${UNZIP_PATCH_URL} ${BLFS_SERVER}unzip/${UNZIP_PATCH} ${UNZIP_PATCH_MD5}" >> urls.lst
   fi
 
@@ -40,5 +39,4 @@
   if [[ "${DEP_SUDO}" = "y" ]] ; then
     echo "${SUDO_URL} ${BLFS_SERVER}sudo/${SUDO_PKG} ${SUDO_MD5}" >> urls.lst
-    echo "${SUDO_PATCH_URL} ${BLFS_SERVER}sudo/${SUDO_PATCH} ${SUDO_PATCH_MD5}" >> urls.lst
   fi
 
@@ -48,4 +46,13 @@
 
   if [[ "${DEP_SVN}" = "y" ]] ; then
+    echo "${SQLITE_URL} ${BLFS_SERVER}sqlite/${SQLITE_PKG} ${SQLITE_MD5}" >> urls.lst
+    echo "${APR_URL} ${BLFS_SERVER}apr/${APR_PKG} ${APR_MD5}" >> urls.lst
+## Cannot use file:// with wget, so cannot download apr patches.
+## They have been put directly in $BUILDDIR/sources
+## The next line only for being able to check md5sum
+    echo "${APR_PATCH_1_URL} ${BLFS_SERVER}apr/${APR_PATCH_1} ${APR_PATCH_1_MD5}" >> urls.lst
+
+    echo "${APR_U_URL} ${BLFS_SERVER}apr-util/${APR_U_PKG} ${APR_U_MD5}" >> urls.lst
+    echo "${APR_U_PATCH_1_URL} ${BLFS_SERVER}apr-util/${APR_U_PATCH_1} ${APR_U_PATCH_1_MD5}" >> urls.lst
     echo "${SVN_URL} ${BLFS_SERVER}subversion/${SVN_PKG} ${SVN_MD5}" >> urls.lst
   fi
@@ -53,6 +60,4 @@
   if [[ "${DEP_GPM}" = "y" ]] ; then
     echo "${GPM_URL} ${BLFS_SERVER}gpm/${GPM_PKG} ${GPM_MD5}" >> urls.lst
-    echo "${GPM_PATCH_1_URL} ${BLFS_SERVER}gpm/${GPM_PATCH_1} ${GPM_PATCH_1_MD5}" >> urls.lst
-    echo "${GPM_PATCH_2_URL} ${BLFS_SERVER}gpm/${GPM_PATCH_2} ${GPM_PATCH_2_MD5}" >> urls.lst
   fi
 
@@ -102,5 +107,8 @@
 
   if [[ "${DEP_SVN}" = "y" ]] ; then
-    mv blfs-tool-deps/911-subversion ${PROGNAME}-commands/blfs-tool-deps
+    mv blfs-tool-deps/911-sqlite ${PROGNAME}-commands/blfs-tool-deps
+    mv blfs-tool-deps/912-apr ${PROGNAME}-commands/blfs-tool-deps
+    mv blfs-tool-deps/913-apr-util ${PROGNAME}-commands/blfs-tool-deps
+    mv blfs-tool-deps/914-subversion ${PROGNAME}-commands/blfs-tool-deps
   fi
 
@@ -157,5 +165,17 @@
       [[ ! "$name" = "docbook-xml" ]] && LUSER_wrt_unpack "$pkg_tarball"
     else
-      [[ ! "$name" = "docbook-xml" ]] && CHROOT_Unpack "$pkg_tarball"
+      case "$name" in
+        *docbook*)
+           (
+           cat << EOF
+	@if [ "\$(PKGMNGT)" = "y" ]; then \\
+	echo "export PKG_DEST=\$(SRC)/\$@" > envars; \\
+	echo "source packInstall.sh" >> envars; \\
+	echo "export -f packInstall" >> envars; \\
+        fi;
+EOF
+            ) >> $MKFILE.tmp ;;
+        *) CHROOT_Unpack "$pkg_tarball" ;;
+      esac
     fi
 
@@ -177,7 +197,7 @@
     case $name in
       docbook-xml )  pkg_ver=DocBook-4.5 ;;
-      lynx )  pkg_ver=lynx-2.8.6 ;;
-      tidy )  pkg_ver=html-tidy-cvs_20070326 ;;
-      unzip ) pkg_ver=unzip-5.52 ;;
+      lynx )  pkg_ver=lynx-2.8.7 ;;
+      tidy )  pkg_ver=html-tidy-cvs_20101110 ;;
+      unzip ) pkg_ver=unzip-6.0 ;;
       * )     pkg_ver=$(echo $pkg_tarball | sed -e 's/.tar.*//;s/.tgz//;s/.zip//') ;;
     esac
Index: common/libs/func_book_parser
===================================================================
--- common/libs/func_book_parser	(revision f5dc6d74236ef57bedebabdee664f108f05fa036)
+++ common/libs/func_book_parser	(revision 7072e1faf4f91f0343e9ff11221b19c8fcc6de87)
@@ -145,4 +145,5 @@
                  --stringparam page $PAGE \
                  --stringparam lang $LANG \
+                 --stringparam pkgmngt $PKGMNGT \
                  -o ./${PROGNAME}-commands/ $XSL $BOOK/index.xml >>$LOGDIR/$LOG 2>&1
       ;;
@@ -188,5 +189,7 @@
       ;;
     lfs)
-        xsltproc --nonet --xinclude -o pkg_tarball_list packages.xsl \
+        xsltproc --nonet --xinclude \
+                 --stringparam pkgmngt $PKGMNGT \
+                  -o pkg_tarball_list packages.xsl \
                  $BOOK/chapter03/chapter03.xml >>$LOGDIR/$LOG 2>&1
       ;;
@@ -205,4 +208,7 @@
 $SUDO_PKG
 $WGET_PKG
+$SQLITE_PKG
+$APR_PKG
+$APR_U_PKG
 $SVN_PKG
 $GPM_PKG
Index: common/libs/func_check_version.sh
===================================================================
--- common/libs/func_check_version.sh	(revision f5dc6d74236ef57bedebabdee664f108f05fa036)
+++ common/libs/func_check_version.sh	(revision 7072e1faf4f91f0343e9ff11221b19c8fcc6de87)
@@ -24,4 +24,6 @@
   declare -i ref_major ref_minor ref_revision ref_change
   declare -r spaceSTR="         "
+
+  shopt -s extglob	#needed for ${x##*(0)} below
 
   ref_version=$1
@@ -54,9 +56,12 @@
 #  echo -ne "$TXT:\t${L_arrow}${BOLD}${tst_version}${OFF}${R_arrow}"
   IFS=".-(pa"   # Split up w.x.y.z as well as w.x.y-rc  (catch release candidates)
-  set -- $ref_version # set postional parameters to minimum ver values
+  set -- $ref_version # set positional parameters to minimum ver values
   ref_major=$1; ref_minor=$2; ref_revision=$3
   #
-  set -- $tst_version # Set postional parameters to test version values
-  major=$1; minor=$2; revision=$3
+  set -- $tst_version # Set positional parameters to test version values
+  # Values beginning with zero are taken as octal, so that for example
+  # 2.07.08 gives an error because 08 cannot be octal. The ## stuff supresses
+  # leading sero's
+  major=${1##*(0)}; minor=${2##*(0)}; revision=${3##*(0)}
   #
   # Compare against minimum acceptable version..
@@ -83,29 +88,29 @@
 
   # LFS/HLFS/CLFS prerequisites
-  check_version "2.6.2"   "`uname -r`"          "KERNEL"
-  check_version "3.0"     "$BASH_VERSION"       "BASH"
-  check_version "3.0.1"   "`gcc -dumpversion`"  "GCC"  
+  check_version "2.6.25"  "`uname -r`"          "KERNEL"
+  check_version "3.2"     "$BASH_VERSION"       "BASH"
+  check_version "4.1.2"   "`gcc -dumpversion`"  "GCC"  
   libcLib="`find /lib /lib64 -name libc.so.6 -print`"
   libcVer="`/${libcLib} | head -n1`"
   libcVer="${libcVer##*version }"
-  check_version "2.2.5"   ${libcVer%%,*}        "GLIBC"
-  check_version "2.12"    "$(ld --version  | head -n1 | awk '{print $NF}')"    "BINUTILS"
-  check_version "1.15"    "$(tar --version | head -n1 | cut -d" " -f4)"        "TAR"
+  check_version "2.5.1"   "${libcVer%%,*}"        "GLIBC"
+  check_version "2.17"    "$(ld --version  | head -n1 | awk '{print $NF}')"    "BINUTILS"
+  check_version "1.18"    "$(tar --version | head -n1 | cut -d" " -f4)"        "TAR"
   bzip2Ver="$(bzip2 --version 2>&1 < /dev/null | head -n1 | cut -d" " -f8)"
-  check_version "1.0.2"   "${bzip2Ver%%,*}"                                    "BZIP2"
-  check_version "1.875"   "$(bison --version | head -n1 | cut -d" " -f4)"      "BISON"
-  check_version "5.2.1"   "$(chown --version | head -n1 | cut -d")" -f2)"      "COREUTILS"
-  check_version "2.8"     "$(diff --version  | head -n1 | cut -d" " -f4)"      "DIFF"
-  check_version "4.1.20"  "$(find --version  | head -n1 | cut -d" " -f4)"      "FIND"
-  check_version "3.0"     "$(gawk --version  | head -n1 | cut -d" " -f3)"      "GAWK"
-  check_version "2.5"     "$(grep --version  | head -n1 | awk '{print $NF}')"  "GREP"
-  check_version "1.2.4"   "$(gzip --version 2>&1 | head -n1 | cut -d" " -f2)"  "GZIP"
-  check_version "1.4"     "$(m4 --version 2>&1 | head -n1 | awk '{print $NF}')" "M4"
-  check_version "3.79.1"  "$(make --version  | head -n1 | cut -d " " -f3 | cut -c1-4)"  "MAKE"
-  check_version "2.5.4"   "$(patch --version | head -n1 | cut -d" " -f2)"      "PATCH"
-  check_version "5.6.0"   "$(perl -V:version | cut -f2 -d\')"                  "PERL"
-  check_version "3.0.2"   "$(sed --version   | head -n1 | cut -d" " -f4)"      "SED"
-  check_version "4.8"	  "$(makeinfo --version | head -n1 | awk '{ print$NF }')" "TEXINFO"
-
+  check_version "1.0.4"   "${bzip2Ver%%,*}"                                    "BZIP2"
+  check_version "2.3"     "$(bison --version | head -n1 | cut -d" " -f4)"      "BISON"
+  check_version "6.9"     "$(chown --version | head -n1 | cut -d")" -f2)"      "COREUTILS"
+  check_version "2.8.1"   "$(diff --version  | head -n1 | cut -d" " -f4)"      "DIFF"
+  check_version "4.2.31"  "$(find --version  | head -n1 | cut -d" " -f4)"      "FIND"
+  check_version "3.1.5"   "$(gawk --version  | head -n1 | cut -d" " -f3)"      "GAWK"
+  check_version "2.5.1a"  "$(grep --version  | head -n1 | awk '{print $NF}')"  "GREP"
+  check_version "1.3.12"  "$(gzip --version 2>&1 | head -n1 | cut -d" " -f2)"  "GZIP"
+  check_version "1.4.10"  "$(m4 --version 2>&1 | head -n1 | awk '{print $NF}')" "M4"
+  check_version "3.81"    "$(make --version  | head -n1 | cut -d " " -f3 | cut -c1-4)"  "MAKE"
+  check_version "2.5.4"   "$(patch --version | head -n1 | sed 's/.*patch //')"      "PATCH"
+  check_version "5.8.8"   "$(perl -V:version | cut -f2 -d\')"                  "PERL"
+  check_version "4.1.5"   "$(sed --version   | head -n1 | cut -d" " -f4)"      "SED"
+  check_version "4.9"	  "$(makeinfo --version | head -n1 | awk '{ print$NF }')" "TEXINFO"
+  check_version "5.0.3"   "$(xz --version | head -n1 | cut -d" " -f4)"         "XZ"
   # Check for minimum sudo version
   SUDO_LOC="$(whereis -b sudo | cut -d" " -f2)"
Index: common/libs/func_download_pkgs
===================================================================
--- common/libs/func_download_pkgs	(revision f5dc6d74236ef57bedebabdee664f108f05fa036)
+++ common/libs/func_download_pkgs	(revision 7072e1faf4f91f0343e9ff11221b19c8fcc6de87)
@@ -40,11 +40,11 @@
       # Skip some packages if they aren't needed
     case $line in
-        */tcl* | */expect* | */dejagnu* | */tree* | */gcc-testsuite* )
+      */check* | */tcl* | */expect* | */dejagnu* | */tree* | */gcc-testsuite* )
             [[ "$TEST" = "0" ]] && continue
           ;;
-        */vim-*-lang* )
+      */vim-*-lang* )
             [[ "$VIMLANG" = "0" ]] && continue
           ;;
-        *linux/linux-* )
+      *linux/linux-* )
             [[ -z "$CONFIG" ]] && [[ -z "$BOOT_CONFIG" ]] && \
             [[ "$GETKERNEL" = "n" ]] && continue
@@ -76,7 +76,7 @@
       if [ ! -f $FILE ] ; then
 	if [[ ! ("$SRC_ARCHIVE" = "") ]] ; then
-	  echo "${BOLD}${YELLOW}$FILE: not found in ${SRC_ARCHIVE} or /sources${OFF}"
+	  echo "${BOLD}${YELLOW}$FILE: not found in ${SRC_ARCHIVE} or ${BUILDDIR}/sources${OFF}"
 	else
-	  echo "${BOLD}${YELLOW}$FILE: not found in /sources${OFF}"
+	  echo "${BOLD}${YELLOW}$FILE: not found in ${BUILDDIR}/sources${OFF}"
 	fi
         if ! wget $URL1 $WGETPARAM && ! wget $URL2 $WGETPARAM ; then
@@ -84,6 +84,6 @@
           continue
         fi
-	else
-	  echo "${BOLD}${YELLOW}$FILE: using cached file in /sources${OFF}"
+      else
+	  echo "${BOLD}${YELLOW}$FILE: using cached file in ${BUILDDIR}/sources${OFF}"
       fi
     fi
@@ -122,5 +122,5 @@
 
       # Good or bad we write the original md5sum to a file
-    echo "$MD5" >> MD5SUMS
+    echo "$MD5" >> MD5SUM
 
      # Copy the freshly downloaded file
@@ -193,4 +193,5 @@
                  --stringparam server $SERVER \
                  --stringparam family lfs \
+                 --stringparam pkgmngt $PKGMNGT \
                  -o ../sources/urls.lst urls.xsl \
                  $BOOK/chapter03/chapter03.xml >>$LOGDIR/$LOG 2>&1
Index: common/libs/func_validate_configs.sh
===================================================================
--- common/libs/func_validate_configs.sh	(revision f5dc6d74236ef57bedebabdee664f108f05fa036)
+++ common/libs/func_validate_configs.sh	(revision 7072e1faf4f91f0343e9ff11221b19c8fcc6de87)
@@ -42,5 +42,5 @@
 
   # Build Settings by book
-  local -r   LFS_build="$BUILD_chroot VIMLANG $BUILD_common"
+  local -r   LFS_build="$BUILD_chroot VIMLANG $BUILD_common PKGMNGT"
   local -r  HLFS_build="$BUILD_chroot         $BUILD_common"
   local -r  CLFS_build="$BUILD_chroot VIMLANG $BUILD_common"
Index: common/libs/func_wrt_Makefile
===================================================================
--- common/libs/func_wrt_Makefile	(revision f5dc6d74236ef57bedebabdee664f108f05fa036)
+++ common/libs/func_wrt_Makefile	(revision 7072e1faf4f91f0343e9ff11221b19c8fcc6de87)
@@ -45,4 +45,5 @@
 ADD_CUSTOM_TOOLS = $CUSTOM_TOOLS
 ADD_BLFS_TOOLS   = $BLFS_TOOL
+PKGMNGT          = $PKGMNGT
 
 
@@ -93,5 +94,7 @@
      xz-utils) echo $(grep "^xz" $JHALFSDIR/pkg_tarball_list | head -n1 )
 	 ;;
-     *)  echo $(grep "^$script_name-[[:digit:]]" $JHALFSDIR/pkg_tarball_list | head -n1 )
+     sqlite) echo $(grep "^sqlite" $JHALFSDIR/pkg_tarball_list | head -n1 )
+	 ;;
+     *)  echo $(grep "^$script_name[_-][[:digit:]]" $JHALFSDIR/pkg_tarball_list | head -n1 )
          ;;
    esac
Index: common/makefile-functions
===================================================================
--- common/makefile-functions	(revision f5dc6d74236ef57bedebabdee664f108f05fa036)
+++ common/makefile-functions	(revision 7072e1faf4f91f0343e9ff11221b19c8fcc6de87)
@@ -28,5 +28,5 @@
   echo $(BOLD)--------------------------------------------------------------------------------;\
   echo  $(tab_)$(tab_)Executing $(BLUE)$(1)$(WHITE) scripts; \
-  echo $(BOLD)--------------------------------------------------------------------------------echo $(WHITE)
+  echo $(BOLD)--------------------------------------------------------------------------------$(WHITE)
 endef
 
@@ -80,4 +80,7 @@
     rm -rf $(SRC)/$${ROOT%-*}-build; \
   fi;
+  @if [ "$(PKGMNGT)" = "y" ] && [ -d $(SRC)/$@ ]; then \
+    rm -rf $(SRC)/$@ && rm -f $(SRC)/*.deb; \
+  fi;
 endef
 
@@ -108,5 +111,10 @@
 define get_pkg_root2
   @ROOT=`head -n1 $(SRC)/$(PKG_LST) | sed 's@^./@@;s@/.*@@'` && \
-  echo "export PKGDIR=$(SRC)/$$ROOT" > envars
+  echo "export PKGDIR=$(SRC)/$$ROOT" > envars; \
+  if [ "$(PKGMNGT)" = "y" ]; then \
+    echo "export PKG_DEST=$(SRC)/$@" >> envars; \
+    echo "source packInstall.sh" >> envars; \
+    echo "export -f packInstall" >> envars; \
+  fi;
 endef
 
Index: common/packages.xsl
===================================================================
--- common/packages.xsl	(revision f5dc6d74236ef57bedebabdee664f108f05fa036)
+++ common/packages.xsl	(revision 7072e1faf4f91f0343e9ff11221b19c8fcc6de87)
@@ -14,6 +14,13 @@
   <xsl:param name="kernel" select="2.6"/>
 
+  <!-- Should we include a package manager -->
+  <xsl:param name="pkgmngt" select="n"/>
+
   <xsl:template match="/">
     <xsl:apply-templates select="//para"/>
+    <xsl:if test="$pkgmngt='y'">
+      <xsl:apply-templates
+        select="document('packageManager.xml')//sect1[@id='package']//para"/>
+    </xsl:if>
   </xsl:template>
 
@@ -27,5 +34,4 @@
         <xsl:with-param name="url" select="ulink/@url"/>
       </xsl:call-template>
-      <xsl:text>&#xA;</xsl:text>
     </xsl:if>
   </xsl:template>
@@ -33,5 +39,5 @@
   <xsl:template name="package_name">
     <xsl:param name="url" select="foo"/>
-    <xsl:param name="sub-url" select="substring-after($url,'/')"/>
+    <xsl:variable name="sub-url" select="substring-after($url,'/')"/>
     <xsl:choose>
       <xsl:when test="contains($sub-url,'/')">
@@ -45,7 +51,9 @@
           <xsl:when test="contains($sub-url,'?')">
             <xsl:value-of select="substring-before($sub-url,'?')"/>
+            <xsl:text>&#xA;</xsl:text>
           </xsl:when>
           <xsl:otherwise>
             <xsl:value-of select="$sub-url"/>
+            <xsl:text>&#xA;</xsl:text>
           </xsl:otherwise>
         </xsl:choose>
Index: common/progress_bar.sh
===================================================================
--- common/progress_bar.sh	(revision f5dc6d74236ef57bedebabdee664f108f05fa036)
+++ common/progress_bar.sh	(revision 7072e1faf4f91f0343e9ff11221b19c8fcc6de87)
@@ -60,5 +60,5 @@
       # Detect rollover of the seconds.
     (( PREV_SEC > SEC )) && write_or_exit "${RESET_LINE}"
-    (( PREV_SEC = SEC ))
+    PREV_SEC=$SEC
 
       # Display the accumulated time. div minutes.. modulo seconds.
Index: common/urls.xsl
===================================================================
--- common/urls.xsl	(revision f5dc6d74236ef57bedebabdee664f108f05fa036)
+++ common/urls.xsl	(revision 7072e1faf4f91f0343e9ff11221b19c8fcc6de87)
@@ -20,10 +20,17 @@
   <xsl:param name="kernel" select="2.6"/>
 
+  <!-- Do we use a package manager? -->
+  <xsl:param name="pkgmngt" select="n"/>
+
   <xsl:template match="/">
     <xsl:apply-templates select="//ulink"/>
+    <xsl:if test="$pkgmngt='y'">
+      <xsl:apply-templates
+        select="document('packageManager.xml')//ulink"/>
+    </xsl:if>
   </xsl:template>
 
   <xsl:template match="ulink">
-      <!-- If some package don't have the predefined strings in their
+      <!-- If some package doesn't have the predefined strings in their
       name, the next test must be fixed to match it also. Skip possible
       duplicated URLs due that may be splitted for PDF output -->
