aboutsummaryrefslogtreecommitdiffstats
path: root/chapter05
diff options
context:
space:
mode:
Diffstat (limited to 'chapter05')
-rw-r--r--chapter05/adding-user.xml4
-rw-r--r--chapter05/bash-inst.xml67
-rw-r--r--chapter05/binutils-pass1-inst.xml (renamed from chapter05/binutils-inst.xml)14
-rw-r--r--chapter05/binutils-pass1.xml13
-rw-r--r--chapter05/binutils-pass2-inst.xml15
-rw-r--r--chapter05/binutils-pass2.xml13
-rw-r--r--chapter05/binutils.xml13
-rw-r--r--chapter05/bzip2-inst.xml34
-rw-r--r--chapter05/chapter05.xml31
-rw-r--r--chapter05/coreutils-inst.xml13
-rw-r--r--chapter05/coreutils.xml8
-rw-r--r--chapter05/creatingstage1dir.xml25
-rw-r--r--chapter05/creatingstaticdir.xml15
-rw-r--r--chapter05/dejagnu-inst.xml12
-rw-r--r--chapter05/dejagnu.xml11
-rw-r--r--chapter05/diffutils-inst.xml35
-rw-r--r--chapter05/expect-inst.xml15
-rw-r--r--chapter05/expect.xml11
-rw-r--r--chapter05/findutils-inst.xml14
-rw-r--r--chapter05/gawk-inst.xml6
-rw-r--r--chapter05/gcc-pass1-inst.xml (renamed from chapter05/gcc-inst.xml)23
-rw-r--r--chapter05/gcc-pass1.xml13
-rw-r--r--chapter05/gcc-pass2-inst.xml27
-rw-r--r--chapter05/gcc-pass2.xml13
-rw-r--r--chapter05/gcc.xml13
-rw-r--r--chapter05/gettext-inst.xml13
-rw-r--r--chapter05/gettext.xml12
-rw-r--r--chapter05/glibc-inst.xml90
-rw-r--r--chapter05/glibc.xml13
-rw-r--r--chapter05/grep-inst.xml28
-rw-r--r--chapter05/gzip-inst.xml19
-rw-r--r--chapter05/kernelheaders-inst.xml61
-rw-r--r--chapter05/kernelheaders.xml13
-rw-r--r--chapter05/lockingglibc.xml21
-rw-r--r--chapter05/make-inst.xml28
-rw-r--r--chapter05/ncurses-inst.xml16
-rw-r--r--chapter05/ncurses.xml13
-rw-r--r--chapter05/patch-inst.xml25
-rw-r--r--chapter05/perl-inst.xml15
-rw-r--r--chapter05/perl.xml13
-rw-r--r--chapter05/sed-inst.xml16
-rw-r--r--chapter05/setting-environment.xml16
-rw-r--r--chapter05/tar-inst.xml15
-rw-r--r--chapter05/tcl-inst.xml14
-rw-r--r--chapter05/tcl.xml11
-rw-r--r--chapter05/texinfo-inst.xml16
-rw-r--r--chapter05/utillinux-inst.xml24
-rw-r--r--chapter05/zlib-inst.xml27
-rw-r--r--chapter05/zlib.xml13
49 files changed, 666 insertions, 324 deletions
diff --git a/chapter05/adding-user.xml b/chapter05/adding-user.xml
index c0bf6d564..131368503 100644
--- a/chapter05/adding-user.xml
+++ b/chapter05/adding-user.xml
@@ -12,10 +12,10 @@ the following commands to add the new user:</para>
<para><screen><userinput>useradd -s /bin/bash -m lfs
passwd lfs</userinput></screen></para>
-<para>In order to grant ownership of the <filename>$LFS/static</filename>
+<para>In order to grant ownership of the <filename>$LFS/stage1</filename>
directory to the user <emphasis>lfs</emphasis>, issue the command:</para>
-<para><screen><userinput>chown lfs $LFS/static</userinput></screen></para>
+<para><screen><userinput>chown lfs $LFS/stage1</userinput></screen></para>
<para>Next, login as user <emphasis>lfs</emphasis>. This can be accomplished
via a virtual console, display manager or with the substitute user
diff --git a/chapter05/bash-inst.xml b/chapter05/bash-inst.xml
index 83fc8b694..e9dbd6197 100644
--- a/chapter05/bash-inst.xml
+++ b/chapter05/bash-inst.xml
@@ -3,68 +3,13 @@
<sect2>
<title>Installation of Bash</title>
-<para>Before you attempt to install Bash, you have to check to make sure
-your distribution has the <filename>/usr/lib/libcurses.a</filename> and
-<filename>/usr/lib/libncurses.a</filename> files. If your host
-distribution is an LFS system, all files will be present if you followed
-the instructions of the book version you read exactly.</para>
+<para><screen><userinput>CFLAGS="-O2 -pipe" ./configure --prefix=/stage1 \
+&nbsp;&nbsp;&nbsp;&nbsp;--with-curses --without-bash-malloc
+make LDFLAGS="-s"
+make tests
+make install
+ln -s bash /stage1/bin/sh</userinput></screen></para>
-<para>If both of the files are missing, you have to install the Ncurses
-development package. This package is often called something like
-<emphasis>ncurses-dev</emphasis> or <emphasis>ncurses-static</emphasis>. If
-this package is already installed, or you just installed it, check for the
-two files again. Often the <filename>libcurses.a</filename> file is (still)
-missing. If so, create <filename>libcurses.a</filename> as a symlink
-by running the following command as user <emphasis>root:</emphasis></para>
-
-<para><screen><userinput>ln -s libncurses.a /usr/lib/libcurses.a</userinput></screen></para>
-
-<para>Now we can really start. Prepare Bash to be compiled by running the
-following command:</para>
-
-
-<para><screen><userinput>./configure --enable-static-link \
-&nbsp;&nbsp;&nbsp;&nbsp;--prefix=$LFS/static --with-curses</userinput></screen></para>
-
-<para>The meaning of the configure options are:</para>
-
-<itemizedlist>
-<listitem><para><userinput>--enable-static-link</userinput>: This option
-causes the <userinput>bash</userinput> program to be statically
-linked.</para></listitem>
-
-<listitem><para><userinput>--prefix=$LFS/static</userinput>: This option
-installs all of Bash's files under the
-<filename class="directory">$LFS/static</filename> directory, which becomes
-the <filename class="directory">/static</filename> directory when chroot'ed
-or reboot'ed into LFS.</para></listitem>
-
-<listitem><para><userinput>--with-curses</userinput>: This option causes
-<filename>bash</filename> to be linked against the curses library instead
-of the default termcap library which has become obsolete. Note, on most
-all Linux systems, the curses library is provided by the Ncurses
-package (so in truth we link against the ncurses library).</para>
-
-<para>It is not strictly necessary for the static bash to be linked
-against libncurses (it can link against a static termcap for the time
-being just fine because we will reinstall Bash in Chapter 6 anyway,
-where we will use libncurses), but it's a good test to make sure that
-the Ncurses package has been installed properly. If not, you will get in
-trouble later on in this chapter when you install the Texinfo package.
-That package requires ncurses, and termcap can't be used
-there.</para></listitem>
-</itemizedlist>
-
-<para>Now we can continue with compiling Bash:</para>
-
-<para><screen><userinput>make</userinput></screen></para>
-
-<para>And finish off the installation by installing Bash:</para>
-
-<para><screen><userinput>make install</userinput></screen></para>
-
-<para>If the <userinput>make install</userinput> phase ends with something
-along the lines of the following:</para>
<blockquote><screen>install-info: unknown option `--dir-file=/mnt/lfs/usr/info/dir'
usage: install-info [--version] [--help] [--debug] [--maxwidth=nnn]
diff --git a/chapter05/binutils-inst.xml b/chapter05/binutils-pass1-inst.xml
index 230ec7b6b..942e61708 100644
--- a/chapter05/binutils-inst.xml
+++ b/chapter05/binutils-pass1-inst.xml
@@ -17,7 +17,9 @@ cd ../binutils-build</userinput></screen></para>
<para>Next, prepare Binutils to be compiled:</para>
-<para><screen><userinput>../binutils-&binutils-version;/configure --prefix=$LFS/static --disable-nls</userinput></screen></para>
+<para><screen><userinput>CFLAGS="-O2 -pipe" \
+&nbsp;&nbsp;&nbsp;&nbsp;../binutils-&binutils-version;/configure \
+&nbsp;&nbsp;&nbsp;--prefix=/stage1 --disable-nls</userinput></screen></para>
<para>The meaning of the (new) configure switches are:</para>
@@ -30,7 +32,7 @@ statically.</para></listitem>
<para>Continue with compiling the package:</para>
-<para><screen><userinput>make LDFLAGS="-all-static"</userinput></screen></para>
+<para><screen><userinput>make LDFLAGS="-all-static -s"</userinput></screen></para>
<para>The meaning of the make option is:</para>
@@ -44,9 +46,17 @@ are different ways of setting up the <emphasis>LDFLAGS</emphasis>
variable.</para></listitem>
</itemizedlist>
+<para>Check package:</para>
+
+<para><screen><userinput>make check</userinput></screen></para>
+
<para>And finish off installing the package:</para>
<para><screen><userinput>make install</userinput></screen></para>
+<para><screen><userinput>make -C ld clean
+make -C ld LIB_PATH=/stage1/lib</userinput></screen></para>
+
+
</sect2>
diff --git a/chapter05/binutils-pass1.xml b/chapter05/binutils-pass1.xml
new file mode 100644
index 000000000..ace0b932d
--- /dev/null
+++ b/chapter05/binutils-pass1.xml
@@ -0,0 +1,13 @@
+<sect1 id="ch05-binutils-pass1">
+<title>Installing Binutils-&binutils-version; - Pass 1</title>
+<?dbhtml filename="binutils-pass1.html" dir="chapter05"?>
+
+<screen>Estimated build time: &binutils-pass1-time-stage1;
+Estimated required disk space: &binutils-pass1-compsize-stage1;</screen>
+
+&aa-binutils-shortdesc;
+&aa-binutils-dep;
+&c5-binutils-pass1-inst;
+
+</sect1>
+
diff --git a/chapter05/binutils-pass2-inst.xml b/chapter05/binutils-pass2-inst.xml
new file mode 100644
index 000000000..40e2fc894
--- /dev/null
+++ b/chapter05/binutils-pass2-inst.xml
@@ -0,0 +1,15 @@
+<sect2><title>&nbsp;</title><para>&nbsp;</para></sect2>
+
+<sect2>
+<title>Installation of Binutils</title>
+
+<para><screen><userinput>patch -Np1 -i ../binutils-&binutils-version;.lib-path.patch
+CFLAGS="-O2 -pipe" ../binutils-2.13.2.1/configure --prefix=/stage1 \
+&nbsp;&nbsp;&nbsp;&nbsp;--enable-shared --with-lib-path=/stage1/lib
+make LDFLAGS="-s"
+make -k check
+make install</userinput></screen></para>
+
+
+</sect2>
+
diff --git a/chapter05/binutils-pass2.xml b/chapter05/binutils-pass2.xml
new file mode 100644
index 000000000..843fd1219
--- /dev/null
+++ b/chapter05/binutils-pass2.xml
@@ -0,0 +1,13 @@
+<sect1 id="ch05-binutils-pass2">
+<title>Installing Binutils-&binutils-version; - Pass 1</title>
+<?dbhtml filename="binutils-pass2.html" dir="chapter05"?>
+
+<screen>Estimated build time: &binutils-pass1-time-stage1;
+Estimated required disk space: &binutils-pass1-compsize-stage1;</screen>
+
+&aa-binutils-shortdesc;
+&aa-binutils-dep;
+&c5-binutils-pass1-inst;
+
+</sect1>
+
diff --git a/chapter05/binutils.xml b/chapter05/binutils.xml
deleted file mode 100644
index f3661ccbc..000000000
--- a/chapter05/binutils.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<sect1 id="ch05-binutils">
-<title>Installing Binutils-&binutils-version;</title>
-<?dbhtml filename="binutils.html" dir="chapter05"?>
-
-<screen>Estimated build time: &binutils-time-static;
-Estimated required disk space: &binutils-compsize-static;</screen>
-
-&aa-binutils-shortdesc;
-&aa-binutils-dep;
-&c5-binutils-inst;
-
-</sect1>
-
diff --git a/chapter05/bzip2-inst.xml b/chapter05/bzip2-inst.xml
index 33cc1e80f..c7d383142 100644
--- a/chapter05/bzip2-inst.xml
+++ b/chapter05/bzip2-inst.xml
@@ -8,30 +8,16 @@ for compilation. Instead we just run the <userinput>make</userinput>
program and start compiling, with a few variables changed to suit our
environment:</para>
-<para><screen><userinput>make CC="gcc -static -s"</userinput></screen></para>
-
-<para>The meaning of the make option is:</para>
-
-<itemizedlist>
-<listitem><para><userinput>CC="gcc -static -s"</userinput>: The Bzip2 package
-does not honour the <emphasis>LDFLAGS</emphasis> variable, so instead we set
-the <emphasis>CC</emphasis> variable which defines which compiler to use.
-The <emphasis>-static</emphasis> option tells the compiler to link all
-programs statically.</para></listitem>
-</itemizedlist>
-
-<para>And finish off installing the package:</para>
-
-<para><screen><userinput>make PREFIX=$LFS/static install</userinput></screen></para>
-
-<para>The meaning of the make option is:</para>
-
-<itemizedlist>
-<listitem><para><userinput>PREFIX=$LFS/static</userinput>: Instead of
-passing a <emphasis>--prefix=$LFS/static</emphasis> to a configure script,
-we set the <emphasis>PREFIX</emphasis> variable to accomplish the same goal
-(since there is no configure script present).</para></listitem>
-</itemizedlist>
+<para><screen><userinput>make -f Makefile-libbz2_so
+make LDFLAGS="-s"
+make check
+make PREFIX=/stage1 install
+yes | cp bzip2-shared /stage1/bin/bzip2
+ln -s libbz2.so.1.0 libbz2.so
+cp -a libbz2.so* /stage1/lib
+rm -f /stage1/bin/{bunzip2,bzcat}
+ln -s bzip2 /stage1/bin/bunzip2
+ln -s bzip2 /stage1/bin/bzcat</userinput></screen></para>
</sect2>
diff --git a/chapter05/chapter05.xml b/chapter05/chapter05.xml
index 3d4755dd1..739475ba1 100644
--- a/chapter05/chapter05.xml
+++ b/chapter05/chapter05.xml
@@ -4,27 +4,36 @@
&c5-introduction;
&c5-whystatic;
-&c5-creatingstaticdir;
+&c5-creatingstage1dir;
&c5-addinguser;
&c5-settingenviron;
-&c5-bash;
-&c5-binutils;
+&c5-binutils-pass1;
+&c5-gcc-pass1;
+&c5-kernelheaders;
+&c5-lockingglibc;
+&c5-gcc-pass2;
+&c5-binutils-pass2;
+&c5-zlib;
+&c5-gawk;
+&c5-coreutils;
&c5-bzip2;
+&c5-gzip;
&c5-diffutils;
-&c5-fileutils;
&c5-findutils;
-&c5-gawk;
-&c5-gcc;
-&c5-grep;
-&c5-gzip;
&c5-make;
-&c5-patch;
+&c5-grep;
&c5-sed;
-&c5-shellutils;
+&c5-gettext;
+&c5-ncurses;
+&c5-patch;
&c5-tar;
&c5-texinfo;
-&c5-textutils;
+&c5-bash;
&c5-utillinux;
+&c5-perl;
+&c5-tcl;
+&c5-expect;
+&c5-dejagnu;
</chapter>
diff --git a/chapter05/coreutils-inst.xml b/chapter05/coreutils-inst.xml
new file mode 100644
index 000000000..bb5e5f22b
--- /dev/null
+++ b/chapter05/coreutils-inst.xml
@@ -0,0 +1,13 @@
+<sect2><title>&nbsp;</title><para>&nbsp;</para></sect2>
+
+<sect2>
+<title>Installation of Coreutils</title>
+
+<para><screen><userinput>CFLAGS="-O2 -pipe" ./configure --prefix=/stage1
+make LDFLAGS="-s"
+make check-root
+make install</userinput></screen></para>
+
+
+</sect2>
+
diff --git a/chapter05/coreutils.xml b/chapter05/coreutils.xml
new file mode 100644
index 000000000..7ccfe6e1a
--- /dev/null
+++ b/chapter05/coreutils.xml
@@ -0,0 +1,8 @@
+<sect1 id="ch05-coreutils">
+<title>Installing Coreutils-&coreutils-version;</title>
+<?dbhtml filename="coreutils.html" dir="chapter05"?>
+
+&c5-coreutils-inst;
+
+</sect1>
+
diff --git a/chapter05/creatingstage1dir.xml b/chapter05/creatingstage1dir.xml
new file mode 100644
index 000000000..0a34be4eb
--- /dev/null
+++ b/chapter05/creatingstage1dir.xml
@@ -0,0 +1,25 @@
+<sect1 id="ch05-creatingstage1dir">
+<title>Creating the $LFS/stage1 directory</title>
+<?dbhtml filename="creatingstage1dir.html" dir="chapter05"?>
+
+<para>All programs compiled in this chapter will be installed under <filename
+class="directory">$LFS/stage1</filename> to keep them separate from the
+programs compiled in the next chapter. The programs compiled here are only
+temporary tools and won't be a part of the final LFS system and by keeping them
+in a separate directory, we can later easily throw them away. Create the
+required directory by running the following:</para>
+
+<para><screen><userinput>mkdir $LFS/stage1</userinput></screen></para>
+
+<para>The next step is to create a "/stage1" symlink on the host system. It
+will point to the directory we just created on the LFS partition:</para>
+
+<para><screen><userinput>ln -s $LFS/stage1 /</userinput></screen></para>
+
+<para>This ensures our toolchain will look in the same place (i.e. /stage1)
+in both Chapters 5 and 6 (when we are inside the chroot). This is an
+important concept to grasp. Don't worry if it's not clear right now, all
+will make sense once we get into Chapter 6.</para>
+
+</sect1>
+
diff --git a/chapter05/creatingstaticdir.xml b/chapter05/creatingstaticdir.xml
deleted file mode 100644
index f0b34a542..000000000
--- a/chapter05/creatingstaticdir.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<sect1 id="ch05-creatingstaticdir">
-<title>Creating the $LFS/static directory</title>
-<?dbhtml filename="creatingstaticdir.html" dir="chapter05"?>
-
-<para>All programs compiled in this chapter will be installed under <filename
-class="directory">$LFS/static</filename> to keep them separate from the
-programs compiled in the next chapter. The programs compiled here are only
-temporary tools and won't be a part of the final LFS system and by keeping them
-in a separate directory, we can later easily throw them away. Create the
-required directory by running the following:</para>
-
-<para><screen><userinput>mkdir $LFS/static</userinput></screen></para>
-
-</sect1>
-
diff --git a/chapter05/dejagnu-inst.xml b/chapter05/dejagnu-inst.xml
new file mode 100644
index 000000000..a82652759
--- /dev/null
+++ b/chapter05/dejagnu-inst.xml
@@ -0,0 +1,12 @@
+<sect2><title>&nbsp;</title><para>&nbsp;</para></sect2>
+
+<sect2>
+<title>Installation of DejaGNU</title>
+
+<para><screen><userinput>CFLAGS="-O2 -pipe" ./configure --prefix=/stage1
+make LDFLAGS="-s"
+make install</userinput></screen></para>
+
+
+</sect2>
+
diff --git a/chapter05/dejagnu.xml b/chapter05/dejagnu.xml
new file mode 100644
index 000000000..47694736d
--- /dev/null
+++ b/chapter05/dejagnu.xml
@@ -0,0 +1,11 @@
+<sect1 id="ch05-dejagnu">
+<title>Installing DejaGNU-&dejagnu-version;</title>
+<?dbhtml filename="dejagnu.html" dir="chapter05"?>
+
+<screen>Estimated build time: &dejagnu-time-static;
+Estimated required disk space: &dejagnu-compsize-static;</screen>
+
+&c5-dejagnu-inst;
+
+</sect1>
+
diff --git a/chapter05/diffutils-inst.xml b/chapter05/diffutils-inst.xml
index c67b41d1a..e5c64b641 100644
--- a/chapter05/diffutils-inst.xml
+++ b/chapter05/diffutils-inst.xml
@@ -5,37 +5,10 @@
<para>Prepare Diffutils to be compiled:</para>
-<para><screen><userinput>LDFLAGS="-static" CPPFLAGS=-Dre_max_failures=re_max_failures2 \
-&nbsp;&nbsp;&nbsp;&nbsp;./configure --prefix=$LFS/static --disable-nls</userinput></screen></para>
-
-<para>The meaning of the configure options are:</para>
-
-<itemizedlist>
-<listitem><para><userinput>LDFLAGS="-static"</userinput>: This is the most
-common way to tell a package that all programs should be statically linked.
-This way the <emphasis>LDFLAGS</emphasis> environment variable is set, but
-only in the subshell that the <filename>configure</filename> script runs
-in. When <userinput>configure</userinput> has done its job, the
-<emphasis>LDFLAGS</emphasis> environment variable won't exist anymore
-and the <filename>Makefile</filename> files contain will contain this
-variable locally.</para></listitem>
-
-<listitem><para><userinput>CPPFLAGS=-Dre_max_failures=re_max_failures2</userinput>: The <emphasis>CPPFLAGS</emphasis> variable is a variable that's read by
-the cpp program (C PreProcessor). The value of this variable tells the
-preprocessor to replace every instance of <emphasis>re_max_failures</emphasis>
-it finds with <emphasis>re_max_failures2</emphasis> before handing the source
-file to the compiler itself for compilation. This package has problems
-linking statically on systems that run an older Glibc version and this
-construction fixes that problem.</para></listitem>
-</itemizedlist>
-
-<para>Continue with compiling the package:</para>
-
-<para><screen><userinput>make</userinput></screen></para>
-
-<para>And finish off installing the package:</para>
-
-<para><screen><userinput>make install</userinput></screen></para>
+<para><screen><userinput>CFLAGS="-O2 -pipe" ./configure --prefix=/stage1
+make LDFLAGS="-s"
+make check
+make install</userinput></screen></para>
</sect2>
diff --git a/chapter05/expect-inst.xml b/chapter05/expect-inst.xml
new file mode 100644
index 000000000..5554a8be1
--- /dev/null
+++ b/chapter05/expect-inst.xml
@@ -0,0 +1,15 @@
+<sect2><title>&nbsp;</title><para>&nbsp;</para></sect2>
+
+<sect2>
+<title>Installation of Expect</title>
+
+<para><screen><userinput>patch -Np1 -i ../expect-&expect-version;.patch
+CFLAGS="-O2 -pipe" ./configure --prefix=/stage1 --with-tcl=/stage1/lib \
+&nbsp;&nbsp;&nbsp;&nbsp;--with-x=no --disable-symbols --cache-file=/dev/null
+make LDFLAGS="-s"
+make test
+make install</userinput></screen></para>
+
+
+</sect2>
+
diff --git a/chapter05/expect.xml b/chapter05/expect.xml
new file mode 100644
index 000000000..3b273a85e
--- /dev/null
+++ b/chapter05/expect.xml
@@ -0,0 +1,11 @@
+<sect1 id="ch05-expect">
+<title>Installing Expect-&expect-version;</title>
+<?dbhtml filename="expect.html" dir="chapter05"?>
+
+<screen>Estimated build time: &expect-time-static;
+Estimated required disk space: &expect-compsize-static;</screen>
+
+&c5-expect-inst;
+
+</sect1>
+
diff --git a/chapter05/findutils-inst.xml b/chapter05/findutils-inst.xml
index b17c9ea30..c7a0c8b79 100644
--- a/chapter05/findutils-inst.xml
+++ b/chapter05/findutils-inst.xml
@@ -29,15 +29,9 @@ This patch adds this macro to the source code.</para></listitem>
<para>Prepare Findutils to be compiled:</para>
-<para><screen><userinput>CPPFLAGS="-Dre_max_failures=re_max_failures2" \
-&nbsp;&nbsp;&nbsp;&nbsp;LDFLAGS="-static" ./configure --prefix=$LFS/static</userinput></screen></para>
-
-<para>Continue with compiling the package:</para>
-
-<para><screen><userinput>make</userinput></screen></para>
-
-<para>And finish off installing the package:</para>
-
-<para><screen><userinput>make install</userinput></screen></para>
+<para><screen><userinput>CFLAGS="-O2 -pipe" ./configure --prefix=/stage1
+make LDFLAGS="-s"
+make check
+make install</userinput></screen></para>
</sect2>
diff --git a/chapter05/gawk-inst.xml b/chapter05/gawk-inst.xml
index 320ecdef8..d6b61b645 100644
--- a/chapter05/gawk-inst.xml
+++ b/chapter05/gawk-inst.xml
@@ -5,12 +5,12 @@
<para>Prepare Gawk to be compiled:</para>
-<para><screen><userinput>CPPFLAGS=-Dre_max_failures=re_max_failures2 \
-&nbsp;&nbsp;&nbsp;&nbsp;LDFLAGS="-static" ./configure --prefix=$LFS/static --disable-nls</userinput></screen></para>
+<para><screen><userinput>CFLAGS="-O2 -pipe" \
+&nbsp;&nbsp;&nbsp;&nbsp;./configure --prefix=/stage1</userinput></screen></para>
<para>Continue with compiling the package:</para>
-<para><screen><userinput>make</userinput></screen></para>
+<para><screen><userinput>make LDFLAGS="-s"</userinput></screen></para>
<para>And finish off installing the package:</para>
diff --git a/chapter05/gcc-inst.xml b/chapter05/gcc-pass1-inst.xml
index 9874b78fc..605f7ee6a 100644
--- a/chapter05/gcc-inst.xml
+++ b/chapter05/gcc-pass1-inst.xml
@@ -12,6 +12,11 @@ Therefore, if you have defined any environment variables that override
default optimizations, such as CFLAGS and CXXFLAGS, we recommend unsetting
or modifying them when building GCC.</para>
+<para><screen><userinput>patch -Np1 -i ../gcc-&gcc-version;-mmap_test.patch
+patch -Np1 -i ../gcc-&gcc-version;-no_fixedincludes.patch
+patch -Np1 -i ../gcc-&gcc-version;-libstdc++_no_debug.patch
+patch -Np1 -i ../gcc-&gcc-version;-libgcc_no_debug.patch</userinput></screen></para>
+
<para>It is recommended by the GCC installation documentation to build
GCC outside of the source directory in a dedicated directory:</para>
@@ -20,10 +25,10 @@ cd ../gcc-build</userinput></screen></para>
<para>Prepare GCC to be compiled:</para>
-<para><screen><userinput>../gcc-&gcc-version;/configure --prefix=/static \
-&nbsp;&nbsp;&nbsp;--disable-nls --disable-shared \
-&nbsp;&nbsp;&nbsp;--with-as=$LFS/static/bin/as \
-&nbsp;&nbsp;&nbsp;--with-ld=$LFS/static/bin/ld</userinput></screen></para>
+<para><screen><userinput>CFLAGS="-O2 -pipe" \
+&nbsp;&nbsp;&nbsp;&nbsp;../gcc-&gcc-version;/configure --prefix=/stage1 \
+&nbsp;&nbsp;&nbsp;&nbsp;--with-local-prefix=/stage1 \
+&nbsp;&nbsp;&nbsp;&nbsp;--disable-nls --enable-shared </userinput></screen></para>
<para>The meaning of the configure options are:</para>
@@ -50,7 +55,9 @@ correctly.</para></listitem>
<para>Continue with compiling the package:</para>
-<para><screen><userinput>make BOOT_LDFLAGS="-static" bootstrap</userinput></screen></para>
+<para><screen><userinput>make BOOT_LDFLAGS="-static -s" \
+&nbsp;&nbsp;&nbsp;&nbsp;BOOT_CFLAGS="-O2 -pipe" \
+&nbsp;&nbsp;&nbsp;&nbsp;STAGE1_CFLAGS="-pipe" bootstrap</userinput></screen></para>
<para>The meaning of the make options are:</para>
@@ -66,9 +73,11 @@ itself a second and third time to make sure the compiler was compiled properly
and can compile itself properly.</para></listitem>
</itemizedlist>
+<para><screen><userinput>make -k check</userinput></screen></para>
+
<para>And finish off installing the package:</para>
-<para><screen><userinput>make prefix=$LFS/static install-no-fixedincludes</userinput></screen></para>
+<para><screen><userinput>make install</userinput></screen></para>
<para>The meaning of the make option is:</para>
@@ -99,7 +108,7 @@ all kinds of Unix systems. Not everybody has GNU CC installed. Just running
C compiler to install. The symlink will point to the system's default
compiler.</para>
-<para><screen><userinput>ln -s gcc $LFS/static/bin/cc</userinput></screen></para>
+<para><screen><userinput>ln -sf gcc /stage1/bin/cc</userinput></screen></para>
</sect2>
diff --git a/chapter05/gcc-pass1.xml b/chapter05/gcc-pass1.xml
new file mode 100644
index 000000000..1fb44650f
--- /dev/null
+++ b/chapter05/gcc-pass1.xml
@@ -0,0 +1,13 @@
+<sect1 id="ch05-gcc-pass1">
+<title>Installing GCC-&gcc-version; - Pass 1</title>
+<?dbhtml filename="gcc-pass1.html" dir="chapter05"?>
+
+<screen>Estimated build time: &gcc-time-pass1-stage1;
+Estimated required disk space: &gcc-compsize-pass1-stage1;</screen>
+
+&aa-gcc-shortdesc;
+&aa-gcc-dep;
+&c5-gcc-pass1-inst;
+
+</sect1>
+
diff --git a/chapter05/gcc-pass2-inst.xml b/chapter05/gcc-pass2-inst.xml
new file mode 100644
index 000000000..ed1522c0c
--- /dev/null
+++ b/chapter05/gcc-pass2-inst.xml
@@ -0,0 +1,27 @@
+<sect2><title>&nbsp;</title><para>&nbsp;</para></sect2>
+
+<sect2>
+<title>Installation of GCC</title>
+
+<para><screen><userinput>patch -Np1 -i ../gcc-&gcc-version;-3.2.3.patch
+patch -Np1 -i ../gcc-&gcc-version;-mmap_test.patch
+patch -Np1 -i ../gcc-&gcc-version;-no_fixedincludes.patch
+patch -Np1 -i ../gcc-&gcc-version;-libstdc++_no_debug.patch
+patch -Np1 -i ../gcc-&gcc-version;-libgcc_no_debug.patch </userinput></screen></para>
+
+<para><screen><userinput>mkdir ../gcc-build
+cd ../gcc-build</userinput></screen></para>
+
+<para><screen><userinput>CFLAGS="-O2 -pipe" CXXFLAGS="-O2 -pipe" \
+&nbsp;&nbsp;&nbsp;&nbsp;../gcc-&gcc-version;/configure --prefix=/stage1 \
+&nbsp;&nbsp;&nbsp;&nbsp;--with-local-prefix=/stage1 \
+&nbsp;&nbsp;&nbsp;&nbsp;--enable-languages=c,c++ --enable-shared \
+&nbsp;&nbsp;&nbsp;&nbsp;--enable-threads=posix --enable-__cxa_atexit \
+&nbsp;&nbsp;&nbsp;&nbsp;--enable-version-specific-runtime-libs
+make BOOT_LDFLAGS="-s" BOOT_CFLAGS="-O2 -pipe" \
+&nbsp;&nbsp;&nbsp;&nbsp;STAGE1_CFLAGS="-pipe" bootstrap
+make -k check
+make install</userinput></screen></para>
+
+</sect2>
+
diff --git a/chapter05/gcc-pass2.xml b/chapter05/gcc-pass2.xml
new file mode 100644
index 000000000..cc11c8fdf
--- /dev/null
+++ b/chapter05/gcc-pass2.xml
@@ -0,0 +1,13 @@
+<sect1 id="ch05-gcc-pass2">
+<title>Installing GCC-&gcc-version; - Pass 1</title>
+<?dbhtml filename="gcc-pass2.html" dir="chapter05"?>
+
+<screen>Estimated build time: &gcc-time-pass1-stage1;
+Estimated required disk space: &gcc-compsize-pass1-stage1;</screen>
+
+&aa-gcc-shortdesc;
+&aa-gcc-dep;
+&c5-gcc-pass1-inst;
+
+</sect1>
+
diff --git a/chapter05/gcc.xml b/chapter05/gcc.xml
deleted file mode 100644
index b9b7d52ea..000000000
--- a/chapter05/gcc.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<sect1 id="ch05-gcc">
-<title>Installing GCC-&gcc-version;</title>
-<?dbhtml filename="gcc.html" dir="chapter05"?>
-
-<screen>Estimated build time: &gcc-time-static;
-Estimated required disk space: &gcc-compsize-static;</screen>
-
-&aa-gcc-shortdesc;
-&aa-gcc-dep;
-&c5-gcc-inst;
-
-</sect1>
-
diff --git a/chapter05/gettext-inst.xml b/chapter05/gettext-inst.xml
new file mode 100644
index 000000000..c1dd70ace
--- /dev/null
+++ b/chapter05/gettext-inst.xml
@@ -0,0 +1,13 @@
+<sect2><title>&nbsp;</title><para>&nbsp;</para></sect2>
+
+<sect2>
+<title>Installation of Gettext</title>
+
+<para><screen><userinput>CFLAGS="-O2 -pipe" ./configure --prefix=/stage1 &&
+make LDFLAGS="-s" &&
+make check
+make install</userinput></screen></para>
+
+
+</sect2>
+
diff --git a/chapter05/gettext.xml b/chapter05/gettext.xml
new file mode 100644
index 000000000..9195a3c1d
--- /dev/null
+++ b/chapter05/gettext.xml
@@ -0,0 +1,12 @@
+<sect1 id="ch05-gettext">
+<title>Installing Gettext-&gettext-version;</title>
+<?dbhtml filename="gettext.html" dir="chapter05"?>
+
+<screen>Estimated build time: &gettext-time;
+Estimated required disk space: &gettext-compsize;</screen>
+
+&aa-gettext-shortdesc;
+&aa-gettext-dep;
+&c5-gettext-inst;
+
+</sect1>
diff --git a/chapter05/glibc-inst.xml b/chapter05/glibc-inst.xml
new file mode 100644
index 000000000..237904503
--- /dev/null
+++ b/chapter05/glibc-inst.xml
@@ -0,0 +1,90 @@
+<sect2><title>&nbsp;</title><para>&nbsp;</para></sect2>
+
+<sect2>
+<title>Glibc installation</title>
+
+<para>Before starting to install Glibc, you must <userinput>cd</userinput>
+into the <filename>glibc-&glibc-version;</filename> directory and unpack
+Glibc-linuxthreads in that directory, not in <filename>/usr/src</filename> as
+you would normally do.</para>
+
+<para>This package is known to behave badly when you have changed its
+default optimization flags (including the -march and -mcpu options).
+Therefore, if you have defined any environment variables that override
+default optimizations, such as CFLAGS and CXXFLAGS, we recommend unsetting
+them when building Glibc.</para>
+
+<para>Basically, compiling Glibc in any other way than the book suggests
+is putting your system at a very high risk.</para>
+
+<para>Glibc will check for the <filename>/etc/ld.so.conf</filename> file
+and abort with an error if the file is missing, so we must create it:</para>
+
+<para><screen><userinput>touch /stage1/etc/ld.so.conf</userinput></screen></para>
+
+<para>The documentation that comes with Glibc recommends to build the package
+not in the source directory but in a separate, dedicated directory:</para>
+
+<para><screen><userinput>mkdir ../glibc-build &amp;&amp;
+cd ../glibc-build</userinput></screen></para>
+
+<para>Next, prepare Glibc to be compiled:</para>
+
+<para><screen><userinput>CFLAGS="-O2 -pipe" \
+&nbsp;&nbsp;&nbsp;&nbsp;../glibc-&glibc-version;/configure --prefix=/stage1 \
+&nbsp;&nbsp;&nbsp;&nbsp;--disable-profile --enable-add-ons \
+&nbsp;&nbsp;&nbsp;&nbsp;--with-headers=/stage1/include \
+&nbsp;&nbsp;&nbsp;&nbsp;--with-binutils=/stage1/bin \
+&nbsp;&nbsp;&nbsp;&nbsp;--without-gd</userinput></screen></para>
+
+<para>The meaning of the configure options are:</para>
+
+<itemizedlist>
+<listitem><para><userinput>--disable-profile</userinput>: This disables the
+building of the libraries with profiling information. Omit this option if you
+plan to do profiling.</para></listitem>
+
+<listitem><para><userinput>--enable-add-ons</userinput>: This enables any
+add-ons that we installed with Glibc, in our case Linuxthreads.</para></listitem>
+
+<listitem><para><userinput>--libexecdir=/usr/bin</userinput>: This will
+cause the <filename>pt_chown</filename> program to be installed in the
+<filename>/usr/bin</filename> directory.</para></listitem>
+</itemizedlist>
+
+<para>During this stage you will see the following warning:</para>
+
+<blockquote><screen>configure: warning:
+*** These auxiliary programs are missing or too old: msgfmt
+*** some features will be disabled.
+*** Check the INSTALL file for required versions.</screen></blockquote>
+
+<para>The missing <filename>msgfmt</filename> program (from the Gettext
+package, which we'll install later) won't cause any problems. The
+<filename>msgfmt</filename> is used to generate the binary translation
+files that can make your system talk in a different language. Because these
+translation files have already been generated for you, there is no need for
+<filename>msgfmt</filename>. You'd only need the program if you change the
+translation source files (the <filename>*.po</filename> files in the
+<filename class="directory">po</filename> subdirectory), which
+would require you to regenerate the binary files.</para>
+
+<para>Continue with compiling the package:</para>
+
+<para><screen><userinput>make
+make check
+make install</userinput></screen></para>
+
+<para>The locales (used by Glibc to make your Linux system talk in a different
+language) weren't installed when you ran the previous command, so we have to
+do that ourselves now:</para>
+
+<para><screen><userinput>make localedata/install-locales</userinput></screen></para>
+
+<para>An alternative to running the previous command is to install only those
+locales which you need or want. This can be achieved using the localedef
+command. Information on this can be found in the <filename>INSTALL</filename>
+file in the <filename>glibc-&glibc-version;</filename> tree.</para>
+
+</sect2>
+
diff --git a/chapter05/glibc.xml b/chapter05/glibc.xml
new file mode 100644
index 000000000..f6ab886bd
--- /dev/null
+++ b/chapter05/glibc.xml
@@ -0,0 +1,13 @@
+<sect1 id="ch05-glibc">
+<title>Installing Glibc-&glibc-version;</title>
+<?dbhtml filename="glibc.html" dir="chapter05"?>
+
+<screen>Estimated build time: &glibc-time;
+Estimated required disk space: &glibc-compsize;</screen>
+
+&aa-glibc-shortdesc;
+&aa-glibc-dep;
+&c5-glibc-inst;
+
+</sect1>
+
diff --git a/chapter05/grep-inst.xml b/chapter05/grep-inst.xml
index 4e232435c..efa72f258 100644
--- a/chapter05/grep-inst.xml
+++ b/chapter05/grep-inst.xml
@@ -3,29 +3,13 @@
<sect2>
<title>Installation of Grep</title>
-<para>Prepare Grep to be compiled:</para>
+<para><screen><userinput>CFLAGS="-O2 -pipe" ./configure --prefix=/stage1 \
+&nbsp;&nbsp;&nbsp;&nbsp;--disable-perl-regexp --with-included-regex
+make LDFLAGS="-s"
+chmod 750 ./tests/*
+make check
+make install</userinput></screen></para>
-<para><screen><userinput>LDFLAGS="-static" CPPFLAGS=-Dre_max_failures=re_max_failures2 \
-&nbsp;&nbsp;&nbsp;&nbsp;./configure --prefix=$LFS/static --disable-nls \
-&nbsp;&nbsp;&nbsp;&nbsp;--disable-perl-regexp</userinput></screen></para>
-
-<para>The meaning of the configure option is:</para>
-
-<itemizedlist>
-<listitem><para><userinput>--disable-perl-regexp</userinput>: This
-configure option makes sure <filename>grep</filename> is not linked against
-the PCRE library, which is often only available as a shared library in
-distributions. Not using this option might result in a compilation
-error.</para></listitem>
-</itemizedlist>
-
-<para>Continue with compiling the package:</para>
-
-<para><screen><userinput>make</userinput></screen></para>
-
-<para>And finish off installing the package:</para>
-
-<para><screen><userinput>make install</userinput></screen></para>
</sect2>
diff --git a/chapter05/gzip-inst.xml b/chapter05/gzip-inst.xml
index 77737e234..9e92aeef6 100644
--- a/chapter05/gzip-inst.xml
+++ b/chapter05/gzip-inst.xml
@@ -3,17 +3,14 @@
<sect2>
<title>Installation of Gzip</title>
-<para>Prepare Gzip to be compiled:</para>
-
-<para><screen><userinput>./configure --prefix=$LFS/static</userinput></screen></para>
-
-<para>Continue with compiling the package:</para>
-
-<para><screen><userinput>make LDFLAGS="-static"</userinput></screen></para>
-
-<para>And finish off installing the package:</para>
-
-<para><screen><userinput>make install</userinput></screen></para>
+<para><screen><userinput>CFLAGS="-O2 -pipe" ./configure --prefix=/stage1
+make LDFLAGS="-s"
+make check
+make install
+rm -f /stage1/bin/{gunzip,zcat}
+ln -s gzip /stage1/bin/gunzip
+ln -s gzip /stage1/bin/zcat
+ln -s gunzip /stage1/bin/uncompress</userinput></screen></para>
</sect2>
diff --git a/chapter05/kernelheaders-inst.xml b/chapter05/kernelheaders-inst.xml
new file mode 100644
index 000000000..3c2f5fe0d
--- /dev/null
+++ b/chapter05/kernelheaders-inst.xml
@@ -0,0 +1,61 @@
+<sect2><title>&nbsp;</title><para>&nbsp;</para></sect2>
+
+<sect2>
+<title>Installation of the kernel headers</title>
+
+<para>We won't be compiling a new kernel yet -- we'll do that when we have
+finished the installation of all the packages. But as some packages need the
+kernel header files, we're going to unpack the kernel archive now, set it up
+and copy the header files so they can be found by these packages.</para>
+
+<para>It is important to note that the files in the kernel source directory
+are not owned by <emphasis>root</emphasis>. Whenever you unpack a package as
+user <emphasis>root</emphasis> (like we do here inside chroot), the files end
+up having the user and group IDs of whatever they were on the packager's
+computer. This is usually not a
+problem for any other package you install because you remove the source
+tree after the installation. But the Linux kernel source tree is often kept
+around for a long time, so there's a chance that whatever user ID the packager
+used will be assigned to somebody on your machine and then that person would
+have write access to the kernel source.</para>
+
+<para>In light of this, you might want to run <userinput>chown -R 0:0</userinput>
+on the <filename>linux-&kernel-version;</filename> directory
+to ensure all files are owned by user <emphasis>root</emphasis>.</para>
+
+<para>Prepare for header installation:</para>
+
+<para><screen><userinput>make mrproper</userinput></screen></para>
+
+<para>This ensures that the kernel tree is absolutely clean. The kernel team
+recommends that this command be issued prior to <emphasis>each</emphasis> kernel
+compilation. You shouldn't rely on the source tree being clean after
+untarring.</para>
+
+<para>Create the <filename>include/linux/version.h</filename> file:</para>
+
+<para><screen><userinput>make include/linux/version.h</userinput></screen></para>
+
+<para>Create the platform-specific <filename>include/asm</filename>
+symlink:</para>
+
+<para><screen><userinput>make symlinks</userinput></screen></para>
+
+<para>Install the platform specific-header files:</para>
+
+<para><screen><userinput>cp -HR include/asm /stage1/include &amp;&amp;
+cp -R include/asm-generic /stage1/include</userinput></screen></para>
+
+<para>Install the cross-platform kernel header files:</para>
+
+<para><screen><userinput>cp -R include/linux /stage1/include</userinput></screen></para>
+
+<para>There are a few kernel header files which make use of the
+<filename>autoconf.h</filename> header file. Since we do not yet configure the
+kernel, we need to create this file ourselves in order to avoid compilation
+failures. Create an empty <filename>autoconf.h</filename> file:</para>
+
+<para><screen><userinput>touch /stage1/include/linux/autoconf.h</userinput></screen></para>
+
+</sect2>
+
diff --git a/chapter05/kernelheaders.xml b/chapter05/kernelheaders.xml
new file mode 100644
index 000000000..8c4e7ca92
--- /dev/null
+++ b/chapter05/kernelheaders.xml
@@ -0,0 +1,13 @@
+<sect1 id="ch05-kernel-headers">
+<title>Installing Linux-&kernel-version; headers</title>
+<?dbhtml filename="kernel-headers.html" dir="chapter05"?>
+
+<screen>Estimated build time: &kernel-time-headers;
+Estimated required disk space: &kernel-compsize-headers;</screen>
+
+&aa-kernel-shortdesc;
+&aa-kernel-dep;
+&c5-kernelheaders-inst;
+
+</sect1>
+
diff --git a/chapter05/lockingglibc.xml b/chapter05/lockingglibc.xml
new file mode 100644
index 000000000..7a784515e
--- /dev/null
+++ b/chapter05/lockingglibc.xml
@@ -0,0 +1,21 @@
+<sect1 id="ch05-locking-glibc">
+<title>"Locking in" Glibc</title>
+<?dbhtml filename="lockingglibc.html" dir="chapter05"?>
+
+<sect2><title>&nbsp;</title><para>&nbsp;</para></sect2>
+
+<sect2>
+<title>Installation of Binutils</title>
+
+<para><screen><userinput>make -C ld install-data-local</userinput></screen></para>
+
+<para><screen><userinput>SPECFILE=/stage1/lib/gcc-lib/i686-pc-linux-gnu/*/specs &&
+cp ${SPECFILE} ./XX &&
+sed 's@/lib/ld-linux.so.2@/stage1/lib/ld-linux.so.2@g' ./XX > ${SPECFILE} &&
+unset SPECFILE &&
+rm -f ./XX</userinput></screen></para>
+
+</sect2>
+
+</sect1>
+
diff --git a/chapter05/make-inst.xml b/chapter05/make-inst.xml
index b6f24f70d..e946786fe 100644
--- a/chapter05/make-inst.xml
+++ b/chapter05/make-inst.xml
@@ -3,30 +3,10 @@
<sect2>
<title>Installation of Make</title>
-<para>Prepare Make to be compiled:</para>
-
-<para><screen><userinput>LDFLAGS="-static" ./configure --prefix=$LFS/static --disable-nls</userinput></screen></para>
-
-<para>Continue with compiling the package:</para>
-
-<para><screen><userinput>make</userinput></screen></para>
-
-<para>And finish off installing the package:</para>
-
-<para><screen><userinput>make install</userinput></screen></para>
-
-<para>During the make install phase you will see this warning:</para>
-
-<blockquote><screen>chgrp: changing group of `/mnt/lfs/static/bin/make': Operation not permitted
-/mnt/lfs/static/bin/make needs to be owned by group kmem and setgid;
-otherwise the `-l' option will probably not work. You may need special
-privileges to complete the installation of /mnt/lfs/static/bin/make.</screen></blockquote>
-
-<para>You can safely ignore this warning. The <userinput>make</userinput>
-program doesn't actually need to be owned by group kmem and setgid for the
-<emphasis>-l</emphasis> option to work. (This option tells
-<userinput>make</userinput> not to start any new jobs when a certain load
-on the system has been reached.)</para>
+<para><screen><userinput>CFLAGS="-O2 -pipe" ./configure --prefix=/stage1
+make LDFLAGS="-s"
+make check
+make install</userinput></screen></para>
</sect2>
diff --git a/chapter05/ncurses-inst.xml b/chapter05/ncurses-inst.xml
new file mode 100644
index 000000000..5409398ae
--- /dev/null
+++ b/chapter05/ncurses-inst.xml
@@ -0,0 +1,16 @@
+<sect2><title>&nbsp;</title><para>&nbsp;</para></sect2>
+
+<sect2>
+<title>Installation of Ncurses</title>
+
+<para><screen><userinput>patch -Np1 -i ../ncurses-&ncurses-version;-etip-2.patch
+patch -Np1 -i ../ncurses-&ncurses-version;-vsscanf.patch
+./configure --prefix=/stage1 --with-shared --without-debug --without-ada &&
+make &&
+make install
+chmod 755 /stage1/lib/*.5.3 &&
+ln -s libncurses.a /stage1/lib/libcurses.a
+ln -sf /stage1/lib/libncurses.so.5 /stage1/lib/libcurses.so</userinput></screen></para>
+
+</sect2>
+
diff --git a/chapter05/ncurses.xml b/chapter05/ncurses.xml
new file mode 100644
index 000000000..b36aafecb
--- /dev/null
+++ b/chapter05/ncurses.xml
@@ -0,0 +1,13 @@
+<sect1 id="ch05-ncurses">
+<title>Installing Ncurses-&ncurses-version;</title>
+<?dbhtml filename="ncurses.html" dir="chapter05"?>
+
+<screen>Estimated build time: &ncurses-time;
+Estimated required disk space: &ncurses-compsize;</screen>
+
+&aa-ncurses-shortdesc;
+&aa-ncurses-dep;
+&c5-ncurses-inst;
+
+</sect1>
+
diff --git a/chapter05/patch-inst.xml b/chapter05/patch-inst.xml
index ff99185a0..1b560b3ea 100644
--- a/chapter05/patch-inst.xml
+++ b/chapter05/patch-inst.xml
@@ -3,27 +3,12 @@
<sect2>
<title>Installation of Patch</title>
-<para>Prepare Patch to be compiled:</para>
+<para><screen><userinput>CPPFLAGS=-D_GNU_SOURCE CFLAGS="-O2 -pipe" \
+&nbsp;&nbsp;&nbsp;&nbsp;./configure --prefix=/stage1
+make LDFLAGS="-s"
+make check
+make install</userinput></screen></para>
-<para><screen><userinput>CPPFLAGS=-D_GNU_SOURCE \
-&nbsp;&nbsp;&nbsp;&nbsp;LDFLAGS="-static" ./configure --prefix=$LFS/static</userinput></screen></para>
-
-<para>The meaning of the configure option is:</para>
-
-<itemizedlist>
-<listitem><para><userinput>CPPFLAGS=-D_GNU_SOURCE</userinput>: This flag
-fixes installation problems of this package on PPC and m68k platforms (that
-we know of). It doesn't hurt compilation on other platforms, such as x86,
-so we do it by default.</para></listitem>
-</itemizedlist>
-
-<para>Continue with compiling the package:</para>
-
-<para><screen><userinput>make</userinput></screen></para>
-
-<para>And finish off installing the package:</para>
-
-<para><screen><userinput>make install</userinput></screen></para>
</sect2>
diff --git a/chapter05/perl-inst.xml b/chapter05/perl-inst.xml
new file mode 100644
index 000000000..a64f7019f
--- /dev/null
+++ b/chapter05/perl-inst.xml
@@ -0,0 +1,15 @@
+<sect2><title>&nbsp;</title><para>&nbsp;</para></sect2>
+<sect2>
+<title>Installation of Perl</title>
+
+<para><screen><userinput>patch -Np1 -i ../perl-&perl-version;-libc.patch
+./configure.gnu --prefix=/stage1 -Doptimize='-O2 -pipe' &&
+make perl
+make utilities &&
+cp perl /stage1/bin/perl &&
+cp pod/pod2man /stage1/bin &&
+mkdir -p /stage1/lib/perl5/5.8.0 &&
+cp -R lib/* /stage1/lib/perl5/5.8.0</userinput></screen></para>
+
+</sect2>
+
diff --git a/chapter05/perl.xml b/chapter05/perl.xml
new file mode 100644
index 000000000..1e538b69b
--- /dev/null
+++ b/chapter05/perl.xml
@@ -0,0 +1,13 @@
+<sect1 id="ch05-perl">
+<title>Installing Perl-&perl-version;</title>
+<?dbhtml filename="perl.html" dir="chapter05"?>
+
+<screen>Estimated build time: &perl-time;
+Estimated required disk space: &perl-compsize;</screen>
+
+&aa-perl-shortdesc;
+&aa-perl-dep;
+&c5-perl-inst;
+
+</sect1>
+
diff --git a/chapter05/sed-inst.xml b/chapter05/sed-inst.xml
index f0e2dc7a5..b06d9d495 100644
--- a/chapter05/sed-inst.xml
+++ b/chapter05/sed-inst.xml
@@ -3,18 +3,10 @@
<sect2>
<title>Installation of Sed</title>
-<para>Prepare Sed to be compiled:</para>
-
-<para><screen><userinput>CPPFLAGS=-Dre_max_failures=re_max_failures2 \
-&nbsp;&nbsp;&nbsp;&nbsp;LDFLAGS="-static" ./configure --prefix=$LFS/static --disable-nls</userinput></screen></para>
-
-<para>Continue with installing the package:</para>
-
-<para><screen><userinput>make</userinput></screen></para>
-
-<para>And finish off installing the package:</para>
-
-<para><screen><userinput>make install</userinput></screen></para>
+<para><screen><userinput>CFLAGS="-O2 -pipe" ./configure --prefix=/stage1
+make LDFLAGS="-s"
+make check
+make install</userinput></screen></para>
</sect2>
diff --git a/chapter05/setting-environment.xml b/chapter05/setting-environment.xml
index e52fd7b6b..636c05745 100644
--- a/chapter05/setting-environment.xml
+++ b/chapter05/setting-environment.xml
@@ -6,14 +6,24 @@
following commands to set up a good work environment:</para>
<para><screen><userinput>cat &gt; ~/.bash_profile &lt;&lt; "EOF"
+set +h
umask 022
LFS=/mnt/lfs
LC_ALL=POSIX
-CC="gcc -s"
-export LFS LC_ALL CC
+LDFLAGS="-s"
+PATH=/stage1/bin:$PATH
+export LFS LC_ALL LDFLAGS PATH
EOF
source ~/.bash_profile</userinput></screen></para>
+<para><userinput>set +h</userinput> turns off Bash's hash function. Hash
+normally is a useful feature where Bash uses a hash table to remember the
+full pathnames of executable files to avoid multiple `PATH' searches.
+However, we'd like the new tools to become available as soon as they are
+installed. By switching off the hash function, our "interactive" commands
+(make, patch, sed, cp and so forth) will always use the newest available
+during the build process.</para>
+
<para>This profile sets the umask to 022, so newly created files and
directories will have the correct permissions. To be more specific, only
the file owner will have write permission to new files and directories.
@@ -32,7 +42,7 @@ may cause trouble if you exit the chroot environment and wish to return later.
By setting LC_ALL to "POSIX" ("C" is an alias for "POSIX") we ensure that
everything will work as expected in the chroot environment.</para>
-<para>CC is a variable we set in order to prevent debugging symbols from
+<para>LDFLAGS is a variable we set in order to prevent debugging symbols from
being compiled into our static packages. By omitting these symbols during
the linking stage of compilation, we save hard drive space and decrease our
build time.</para>
diff --git a/chapter05/tar-inst.xml b/chapter05/tar-inst.xml
index 5b7805e87..3946e3d8f 100644
--- a/chapter05/tar-inst.xml
+++ b/chapter05/tar-inst.xml
@@ -12,17 +12,10 @@ used for gzip files.</para>
<para><screen><userinput>patch -Np1 -i ../tar-&tar-patch-version;.patch</userinput></screen></para>
-<para>Prepare Tar to be compiled:</para>
-
-<para><screen><userinput>LDFLAGS="-static" ./configure --prefix=$LFS/static --disable-nls</userinput></screen></para>
-
-<para>Continue with compiling the package:</para>
-
-<para><screen><userinput>make</userinput></screen></para>
-
-<para>Finish installing the package:</para>
-
-<para><screen><userinput>make install</userinput></screen></para>
+<para><screen><userinput>CFLAGS="-O2 -pipe" ./configure --prefix=/stage1
+make LDFLAGS="-s"
+make check
+make install</userinput></screen></para>
</sect2>
diff --git a/chapter05/tcl-inst.xml b/chapter05/tcl-inst.xml
new file mode 100644
index 000000000..c1ee54fac
--- /dev/null
+++ b/chapter05/tcl-inst.xml
@@ -0,0 +1,14 @@
+<sect2><title>&nbsp;</title><para>&nbsp;</para></sect2>
+
+<sect2>
+<title>Installation of TCL</title>
+
+<para><screen><userinput>cd unix
+CFLAGS="-O2 -pipe" ./configure --prefix=/stage1
+MAKE LDFLAGS="-s"
+make test
+make install
+ln -s /stage1/bin/tclsh8.4 /stage1/bin/tclsh</userinput></screen></para>
+
+</sect2>
+
diff --git a/chapter05/tcl.xml b/chapter05/tcl.xml
new file mode 100644
index 000000000..fe1599394
--- /dev/null
+++ b/chapter05/tcl.xml
@@ -0,0 +1,11 @@
+<sect1 id="ch05-tcl">
+<title>Installing TCL-&tcl-version;</title>
+<?dbhtml filename="tcl.html" dir="chapter05"?>
+
+<screen>Estimated build time: &tcl-time-static;
+Estimated required disk space: &tcl-compsize-static;</screen>
+
+&c5-tcl-inst;
+
+</sect1>
+
diff --git a/chapter05/texinfo-inst.xml b/chapter05/texinfo-inst.xml
index 3227ab1d3..b1621fcd9 100644
--- a/chapter05/texinfo-inst.xml
+++ b/chapter05/texinfo-inst.xml
@@ -3,18 +3,12 @@
<sect2>
<title>Installation of Texinfo</title>
-<para>Prepare Texinfo to be compiled:</para>
+<para><screen><userinput>CFLAGS="-O2 -pipe" ./configure --prefix=/stage1
+make LDFLAGS="-s"
+make check
+make install
+make TEXMF=/stage1/share/texmf install-tex</userinput></screen></para>
-<para><screen><userinput>LDFLAGS="-static" ./configure --prefix=$LFS/static \
-&nbsp;&nbsp;&nbsp;&nbsp;--disable-nls</userinput></screen></para>
-
-<para>Continue with compiling the package:</para>
-
-<para><screen><userinput>make</userinput></screen></para>
-
-<para>Finish installing the package:</para>
-
-<para><screen><userinput>make install</userinput></screen></para>
</sect2>
diff --git a/chapter05/utillinux-inst.xml b/chapter05/utillinux-inst.xml
index 1a43e13a0..6e3815a86 100644
--- a/chapter05/utillinux-inst.xml
+++ b/chapter05/utillinux-inst.xml
@@ -3,24 +3,12 @@
<sect2>
<title>Installation of Util-linux</title>
-<para>Prepare Util-linux to be compiled:</para>
-
-<para><screen><userinput>LDFLAGS="-static" ./configure</userinput></screen></para>
-
-<para>Begin compiling the package:</para>
-
-<para><screen><userinput>make -C lib</userinput></screen></para>
-
-<para>We only need the <filename>mount</filename> and
-<filename>umount</filename> programs at the moment, so we won't be
-compiling the entire package. Compile these two programs by issuing
-the following command:</para>
-
-<para><screen><userinput>make -C mount mount umount</userinput></screen></para>
-
-<para>Finish installing these two programs:</para>
-
-<para><screen><userinput>cp mount/{mount,umount} $LFS/static/bin</userinput></screen></para>
+<para><screen><userinput>CFLAGS="-O2 -pipe" ./configure
+make -C lib LDFLAGS="-s"
+make -C mount LDFLAGS="-s" mount umount
+make -C text-utils LDFLAGS="-s" more
+cp mount/{mount,umount} /stage1/bin
+cp text-utils/more /stage1/bin</userinput></screen></para>
</sect2>
diff --git a/chapter05/zlib-inst.xml b/chapter05/zlib-inst.xml
new file mode 100644
index 000000000..e3bd2c0d3
--- /dev/null
+++ b/chapter05/zlib-inst.xml
@@ -0,0 +1,27 @@
+<sect2><title>&nbsp;</title><para>&nbsp;</para></sect2>
+
+<sect2>
+<title>Installation of Zlib</title>
+
+<para><screen><userinput>patch -Np1 -i ../zlib-&zlib-version;-final-vsnprintf.patch</userinput></screen></para>
+
+<para>Prepare Zlib to be compiled:</para>
+
+<para><screen><userinput>CFLAGS="-O2 -pipe" CPPFLAGS="-DHAS_vsnprintf" \
+&nbsp;&nbsp;&nbsp;&nbsp;./configure --prefix=/stage1 --shared</userinput></screen></para>
+
+<para>The <emphasis>-fPIC</emphasis> flag helps to assure
+quality in the dynamic zlib library.</para>
+
+<para>Some packages expect a static zlib library to be present
+on the system. To satisfy those programs, compile both the
+shared and static libraries:</para>
+
+<para><screen><userinput>make LDFLAGS="-s"
+make test</userinput></screen></para>
+
+<para>Install the libraries:</para>
+
+<para><screen><userinput>make install</userinput></screen></para>
+
+</sect2>
diff --git a/chapter05/zlib.xml b/chapter05/zlib.xml
new file mode 100644
index 000000000..591ae69df
--- /dev/null
+++ b/chapter05/zlib.xml
@@ -0,0 +1,13 @@
+<sect1 id="ch05-zlib">
+<title>Installing Zlib-&zlib-version;</title>
+<?dbhtml filename="zlib.html" dir="chapter05"?>
+
+<screen>Estimated build time: &zlib-time;
+Estimated required disk space: &zlib-compsize;</screen>
+
+&aa-zlib-shortdesc;
+&aa-zlib-dep;
+&c5-zlib-inst;
+
+</sect1>
+