Thursday 15 July 2010

LAP - Toolchain, Part 6 - General

We are now in the realm of general packages.  The first is ncurses.  Sadly this is not a library of choice swear words, instead it is a library which helps make text user interfaces.

tar -xzvf $LFS/sources/ncurses-5.7.tar.gz 
cd ncurses-5.7
./configure --prefix=/tools --with-shared --without-debug --without-ada --enable-overwrite

The [with-shared] option makes the software installed shared libraries.  Which sounds a bit communist.  [without-ada] excludes a type of compiler that we are never going to use.  Finally [enable-overwrite] lets us install to the common /tools/include directory instead of its own special directory.

make $CORES_TO_USE
make install
cd ..
rm -rvf ncurses-5.7

Now for BASH, the Bourne Again SHell.  This is the program that provides the flashing command prompt interface.

tar -xzvf $LFS/sources/bash-4.1.tar.gz
cd bash-4.1
./configure --prefix=/tools --without-bash-malloc

The [without-bash-malloc] option turns off Bash's ability to allocate memory itself.  Instead it will be forced to rely on the Glibc utilities, which is fine.

make $CORES_TO_USE
make tests

Well that was another fucking helpful test routine.  There is a lot of garbage and a distinct lack of PASS or FAIL.  Lets move on.

make install

Again, some programs expect you to be using a different shell program.  To fool them, make a symbolic link to Bash:

ln -vs bash /tools/bin/sh
cd ..
rm -rvf bash-4.1

Next is the bzip2 compression program, which is really simple.

tar -xzvf $LFS/sources/bzip2-1.0.5.tar.gz
cd bzip2-1.0.5
make $CORES_TO_USE
make PREFIX=/tools install
cd ..
rm -rvf bzip2-1.0.5

We are obviously going to need some basic utilities.  Stuff like copy, remove, chown etc etc.  Stuff that we use all time time in this installation, anyway.

tar -xzvf $LFS/sources/coreutils-8.4.tar.gz
cd coreutils-8.4
./configure --prefix=/tools --enable-install-program=hostname

Ordinarily the hostname program is not installed, but we want it for a test suite later, so the option [enable-install-program=hostname] makes sure it is installed.

make $CORES_TO_USE

Despite the fact that I am getting a bit disillusioned with these checks, I am going to give this a go with this package as well.  We just run the tests that work if you are root.  I think these work here, because the current lfs user has full write permission to the current directory.

make RUN_EXPENSIVE_TESTS=yes check

======================= 
All 185 tests passed 
(17 tests were not run) 
======================= 

That looks good.  Incidentally, do not flick through the book and get confused between the toolchain installation of coreutils and the actual installation, because then you will waste a good 5 minutes of your life that you will never see again chasing permissions bullshit messages.

make install

The command to become a superuser is

su

For security reasons, the installation of coreutils will not install this program, leaving us to do it manually because we do need it.  To distinguish it from the actual su program that will install happily in the chroot environment in due course, copy it as follows (giving it a different name in the process):

cp -v src/su /tools/bin/su-tools
cd ..
rm -rvf coreutils-8.4

Diffutils is a small program which reports the differences between files or directories.  It is used, amongst other things, to produce the patch files.

tar -xzvf $LFS/sources/diffutils-2.8.1.tar.gz
cd diffutils-2.8.1
./configure --prefix=/tools
make $CORES_TO_USE
make install
cd ..
rm -rvf diffutils-2.8.1

The next one is another small package – Findutils, which is used for … finding stuff, obviously.

tar -xzvf $LFS/sources/findutils-4.4.2.tar.gz
cd findutils-4.4.2
./configure --prefix=/tools
make $CORES_TO_USE
make check

As with DejaGNU I am told how many passes were expected, but not how many were actually passed.  Fantastic.  No obvious errors though.

make install
cd ..
rm -rvf findutils-4.4.2

Gawk is another programming language, that the book says is used to manipulate text files.

tar -xjvf $LFS/sources/gawk-3.1.7.tar.bz2
cd gawk-3.1.7
./configure --prefix=/tools
make $CORES_TO_USE
make check

Alarmingly, I got this message:

3 TESTS FAILED

However, looking through the report it seems that the tests failed in the section headed:

======== Starting tests that can vary based on character set or locale support ======== 

So I am going to assume that the failure are related to the fact that we are not bothering with locale support in the major packages in this toolchain.

make install
cd ..
rm -rvf gawk-3.1.7

Since we are talking about the locale support, time to install something to deal with it.  Gettext is a bit of software that seems to handle translations into local languages.  Sounds a bit like a star trek universal translator, and I bet it hisnae ivver been tae the weedge.  Anyway:

tar -xzvf $LFS/sources/gettext-0.17.tar.gz
cd gettext-0.17

This one also uses a special build folder, but it is already ready to go.

cd gettext-tools
./configure --prefix=/tools --disable-shared

Again, we do not want to share … something … at this stage, hence the option.  At this point we only want one small part of the package, so we run the make command as follows:

make $CORES_TO_USE -C gnulib-lib
make $CORES_TO_USE -C src msgfmt

The [C] option tells the make command to go into that directory ONLY when looking for compilation instructions.  We then copy the resulting file manually to install it.

cp -v src/msgfmt /tools/bin
cd ../..
rm -rvf gettext-0.17

The grep program carries out search functions.

tar -xjvf $LFS/sources/grep-2.5.4.tar.bz2
cd grep-2.5.4
./configure --prefix=/tools --disable-perl-regexp --without-included-regex

The [disable-perl-regexp] command stops an unnecessary function being added which may cause contamination from the host machine.  The [without-included-regex] forces the compile to use code from Glibc for a regular expression library instead of code that is included with grep.

make $CORES_TO_USE
make check
====================== 
All 13 tests passed 
(1 tests were not run) 
====================== 

Excellent.

make install
cd ..
rm -rvf grep-2.5.4

We already have the bzip2 software installed, now it is time to add the standard gzip.

tar -xzvf $LFS/sources/gzip-1.4.tar.gz
cd gzip-1.4
./configure --prefix=/tools
make $CORES_TO_USE
make check

Happily this told me that:

Test succeeded.

make install
cd ..
rm -rvf gzip-1.4

You may have noticed that we are building packages in alphabetical order now.  We have been doing so since Bash.  Next up is M4.  This is a bit of software that processes macros.  It is apparently used in making 'configure' scripts.

tar -xjvf $LFS/sources/m4-1.4.13.tar.bz2
cd m4-1.4.13
./configure --prefix=/tools
make $CORES_TO_USE
make check

====================== 
All 69 tests passed 
(8 tests were not run) 
====================== 
Yippee!

make install
cd ..
rm -rvf m4-1.4.13

Make is obviously an essential part of the toolchain.

tar -xjvf $LFS/sources/make-3.81.tar.bz2
cd make-3.81
./configure --prefix=/tools
make $CORES_TO_USE
make check

351 Tests in 96 Categories Complete ... No Failures :-)

Awwww, that's nice, I got a smiley!

make install
cd ..
rm -rvf make-3.81

We will also obviously need patch.

tar -xjvf $LFS/sources/patch-2.6.1.tar.bz2
cd patch-2.6.1
./configure --prefix=/tools
make $CORES_TO_USE

This produced the following error message, which was a little disconcerting:

/media/lfs/sources/patch-2.6.1/src/patch.c:1542: warning: the use of `mktemp' is dangerous, better use `mkstemp'

However, when I ran:

make check

I got:

All tests succeeded!

make install
cd ..
rm -rvf patch-2.6.1

PERL or Practical Extraction and Report Language, is another computing language to be installed.

tar -xjvf $LFS/sources/perl-5.10.1.tar.bz2
cd perl-5.10.1

For the first time in a while we need to patch the source code.  This is something to do with adapting it to the Glibc library.

patch -Np1 -i $LFS/sources/perl-5.10.1-libc-1.patch

PERL has to be different and has a special approach to the Configuration.

sh Configure -des -Dprefix=/tools -Dstatic_ext='Data/Dumper Fcntl IO POSIX'

I have no idea what the stuff in single quotes actually is, but according to the book it tells the build to only make absolutely essential parts of PERL.  Again when we come to 'make' we tell it to only build part of the whole package:

make $CORES_TO_USE perl utilities ext/Errno/pm_to_blib

Got another warning:

POSIX.c:(.text+0x5643): warning: the use of `tmpnam' is dangerous, better use `mkstemp'

This is another suggestion about using mkstemp instead of what we are using.  I also do not know what a blib is, but is sounds a bit like the noise of a dripping tap.  Probably not to do with plumbing though.  Again, because we are only building bits, we need to do the install manually:

cp -v perl pod/pod2man /tools/bin
mkdir -pv /tools/lib/perl5/5.10.1
cp -Rv lib/* /tools/lib/perl5/5.10.1
cd ..
rm -rvf perl-5.10.1

AAAAAAAhhh, Fuck, look out it is SED!  I will type this from behind the sofa.

tar -xjvf $LFS/sources/sed-4.2.1.tar.bz2
cd sed-4.2.1
./configure --prefix=/tools
make $CORES_TO_USE
make check

====================================================== 
All 65 tests behaved as expected (4 expected failures) 
======================================================

Thank fuck for that, the last thing I would want is for a problem with sed.  I am not entirely sure about the expected failures, though.  What is the point of running the test when you know it is goinf to fail?

make install
cd ..
rm -rvf sed-4.2.1

We have bzip2, we have gzip and now we are getting to the arse end of the alphabet we have tar.

tar -xjvf $LFS/sources/tar-1.22.tar.bz2
cd tar-1.22
./configure --prefix=/tools
make $CORES_TO_USE
make check

70 tests were successful. 
7 tests were skipped. 

make install
cd ..
rm -rvf tar-1.22

The final package that we install is Texinfo.  This software is all to do with the manipulation of info pages, which are supposed to be similar to man pages, but with more detail.

tar -xzvf $LFS/sources/texinfo-4.13a.tar.gz
cd texinfo-4.13a

No such directory eh?  Let me see about … Bugger.

cd texinfo-4.13
./configure --prefix=/tools
make $CORES_TO_USE
make check

I thought I was going to get:

================== 
All 0 tests passed 
================== 

Which was, obviously, just fucking brilliant, but then I scrolled the screen up and I got this instead:

=================== 
All 23 tests passed 
===================

Which is more sensible.

make install
cd ..
rm -rvf  texinfo-4.13

No comments:

Post a Comment