Wednesday, 4 August 2010

LAP - Documentation

It was after I first installed the alsa software, when I looked through the commands that I had used and realised that I had probably not installed all the documentation properly. You see, some text files had been installed but the actual documentation was to be in more sophisticated html files. We need another package to create those files, and I have decided that it would be a good idea to actually install that software.

You have probably realised that we have not installed any software which can actually read html files. Hmm. We'd probably best do that then. I have chosen lynx which is a text based browser and therefore will work without any graphical interface. Which we do not have just now.

The openssl package that I am going to install before lynx allows lynx to support web security - the padlock icon that you see in firefox and internet explorer in other words. We absolutely do not need that just to access the html documentation, but it may be useful in the future if we web-enable this installation. The bc package is another maths type package, like the ones needed for gcc. This is needed to test openssl, and with any security stuff, we want to make sure it works. Note that if you want [wget] to be able to download from secure sites, you need to reinstall it now - the same commands should work it will just automatically detect that we have installed OpenSSL.

This whole bc -> ssl -> lynx chain will arise time and time again with Linux From Scratch. These connections are known as dependencies. In other words, lynx is dependant on openssl to provide security and needs it to be installed first. Openssl is dependant on bc to test itself. Normally, Ubuntu, or other advances distributions handle all this sort of dependency stuff for you and tuck it away in the background. No such joy with LFS - we have to do it all by hand.

Again, I will set out all the commands with comments, but as they are a bit complicated I will also include them as an executable script. So what you end up doing is copying and pasting the commands which then create a script on the Amiga Key. Once you are in the LFS system you can just run that script.

Again, we need to download from the LiveCD:
umount -v /media/amiga
sudo mkdir /media/lfs
sudo mount -v -t ext3 /dev/disk/by-label/amiga /media/lfs
cd /media/lfs/sources
mkdir extras
chmod -v a+wt extras
cd extras
wget http://ftp.stack.nl/pub/users/dimitri/doxygen-1.6.3.src.tar.gz
wget http://lynx.isc.org/current/lynx2.8.7rel.1.tar.bz2
wget http://www.openssl.org/source/openssl-0.9.8n.tar.gz
wget http://anduin.linuxfromscratch.org/files/BLFS/BLFS-ca-bundle-3.12.5.tar.bz2
wget http://www.linuxfromscratch.org/patches/blfs/svn/openssl-0.9.8n-fix_manpages-1.patch
wget http://ftp.gnu.org/gnu/bc/bc-1.06.tar.gz
And then reboot to the Amiga Key:

cd /sources/extras
tar -xzvf /sources/extras/bc-1.06.tar.gz
cd bc-1.06

There is a problem with this package speaking nicely to readline. We correct it with a [sed] command.

sed -i '/PROTO.*readline/d' bc/scan.l

The same applies to Flex:

sed -i '/flex -I8/s/8//' configure

We also need a missing header. I do not know what this is or why it is missing, but the following [sed] fixes it.
sed -i '/stdlib/a #include <string.h>' lib/number.c

Lastly, there can be a fault with the program which is fixed with this [sed]:
sed -i 's/program.*save/static &/' bc/load.c
./configure --prefix=/usr --with-readline

[with-readline] makes the compiled software aware that we have installed readline on our system.

make $CORES_TO_USE

We may as well run a check, which we do as follows:

echo "quit" | ./bc/bc -l Test/checklib.b
Percent Failed: 0
make install
cd ..
rm -rvf bc-1.06

tar -xzvf /sources/extras/openssl-0.9.8n.tar.gz
cd openssl-0.9.8n

Firstly we apply the patch we downloaded. BLFS is curiously reticent about telling us what this does, but the name of the patch does tend to give the game away.

patch -Np1 -i /sources/extras/openssl-0.9.8n-fix_manpages-1.patch

Next we need to install basic security certificates which are omitted from the source code package:

tar -vxf /sources/extras/BLFS-ca-bundle-3.12.5.tar.bz2
./config --prefix=/usr --openssldir=/etc/ssl shared zlib-dynamic

[openssldir] just specified the particular install directory for the configuration stuff - I am not sure where this would default to otherwise. [shared] once again relates to the libraries. [zlib-dynamic] makes openssl aware that we have installed zlib and it can use it.

make $CORES_TO_USE
make test
The test output looks very cool to start with and then descends into screeds and screeds of crap. There was no discernible success or failure message.
make MANDIR=/usr/share/man install
cp -v -r certs /etc/ssl
install -v -d -m755 /usr/share/doc/openssl-0.9.8n
cp -v -r       doc/{HOWTO,README,*.{txt,html,gif}} /usr/share/doc/openssl-0.9.8n

Most of that we have seen before. In addition to the installation of the documentation we also install the [cert]ificates to [/etc/ssl].

for pem in /etc/ssl/certs/*.pem
do
cat $pem
echo ""
done > /etc/ssl/ca-bundle.crt

Hmm that looks tricky. What this is doing is taking the contents of every [pem] file in the [/etc/ssl/certs] directory and sticking them together in one big file called [ca-bundle.crt]. Why, I have no idea. Apparently though, if we ever add any more [pem] files we are supposed to re-run that command.

cd ..
rm -rvf openssl-0.9.8n

tar -xjvf /sources/extras/lynx2.8.7rel.1.tar.bz2
cd lynx2-8-7

That is about the most annoyingly different directory name over archive name that I have found so far ... just as well I tested it before actually implementing it in the script.

./configure --prefix=/usr --sysconfdir=/etc/lynx --datadir=/usr/share/doc/lynx-2.8.7rel.1 --with-zlib --with-bzlib --with-screen=ncursesw --enable-locale-charset --with-ssl

Mostly self explanatory - we tell it about [zlib] and [bzlib] (bzip2), and [ncurses] (for the chubby letters). I think the [enable-locale-charset] tells it to use the same character set as we have configure for the terminal in the config files at the end of the main build.
make $CORES_TO_USE
make install-full
chgrp -v -R root /usr/share/doc/lynx-2.8.7rel.1/lynx_doc

The locale setting we used for the [configure] script is not reflected in the config file for the browser, so we need to fix that by the magic of [sed]:
sed -i 's/#\(LOCALE_CHARSET\):FALSE/\1:TRUE/' /etc/lynx/lynx.cfg

Apparently there is a built in editor in Lynx. I am not sure what this is for. In any event, it is prone to breaking if it sees something complicated, so we can tell it to use the nano editor that we have installed as follows:

sed -i 's/#\(DEFAULT_EDITOR\):/\1:nano/' /etc/lynx/lynx.cfg

We also probably want to save cookies between sessions, so that websites will remember us. Again this is not something that we will be using unless we set up an internet connection in due course. We need to change another setting in the [.cfg] file.

sed -i 's/#\(PERSISTENT_COOKIES\):FALSE/\1:TRUE/' /etc/lynx/lynx.cfg

It should be noted here that we could probably just have opened the [.cfg] file in nano and made the changes manually, but there is clearly a sed fanatic at work who has spent several years mastering their sed skills, and it would be rude to ignore the results.

cd ..
rm -rvf lynx2-8-7

There is literally nothing surprising about the commands to install doxygen - just watch out of the name of the unpacked directory:

tar -xzvf /sources/extras/doxygen-1.6.3.src.tar.gz
cd doxygen-1.6.3
./configure --prefix /usr --docdir /usr/share/doc/doxygen-1.6.3
make $CORES_TO_USE
make install
make install_docs
cd ..
rm -rvf doxygen-1.6.3

And for those intending to create a script to run all these from the LFS system itself, copy and paste this bad boy. Note that it does not run the tests because there is no point if the results just go flying past. There is also little point in automating an install if you then build in pauses to check test results.

sudo cat > install_docs.sh << "ARSE" 
cd /sources/extras
tar -xzvf /sources/extras/bc-1.06.tar.gz 
cd bc-1.06 
sed -i '/PROTO.*readline/d' bc/scan.l 
sed -i '/flex -I8/s/8//' configure 
sed -i '/stdlib/a #include <string.h>' lib/number.c 
sed -i 's/program.*save/static &/' bc/load.c 
./configure --prefix=/usr --with-readline 
make $CORES_TO_USE 
make install 
cd .. 
rm -rvf bc-1.06 
tar -xzvf /sources/extras/openssl-0.9.8n.tar.gz 
cd openssl-0.9.8n 
patch -Np1 -i /sources/extras/openssl-0.9.8n-fix_manpages-1.patch 
tar -vxf /sources/extras/BLFS-ca-bundle-3.12.5.tar.bz2 
./config --prefix=/usr --openssldir=/etc/ssl shared zlib-dynamic 
make $CORES_TO_USE 
make MANDIR=/usr/share/man install 
cp -v -r certs /etc/ssl 
install -v -d -m755 /usr/share/doc/openssl-0.9.8n 
cp -v -r       doc/{HOWTO,README,*.{txt,html,gif}} /usr/share/doc/openssl-0.9.8n 
for pem in /etc/ssl/certs/*.pem 
do 
cat $pem 
echo "" 
done > /etc/ssl/ca-bundle.crt 
cd .. 
rm -rvf openssl-0.9.8n 
tar -xjvf /sources/extras/lynx2.8.7rel.1.tar.bz2 
cd lynx2-8-7 
./configure --prefix=/usr --sysconfdir=/etc/lynx --datadir=/usr/share/doc/lynx-2.8.7rel.1 --with-zlib --with-bzlib --with-screen=ncursesw --enable-locale-charset --with-ssl 
make $CORES_TO_USE
make install-full 
chgrp -v -R root /usr/share/doc/lynx-2.8.7rel.1/lynx_doc 
sed -i 's/#\(LOCALE_CHARSET\):FALSE/\1:TRUE/' /etc/lynx/lynx.cfg 
sed -i 's/#\(DEFAULT_EDITOR\):/\1:nano/' /etc/lynx/lynx.cfg 
sed -i 's/#\(PERSISTENT_COOKIES\):FALSE/\1:TRUE/' /etc/lynx/lynx.cfg 
cd .. 
rm -rvf lynx2-8-7 
tar -xzvf /sources/extras/doxygen-1.6.3.src.tar.gz 
cd doxygen-1.6.3 
./configure --prefix /usr --docdir /usr/share/doc/doxygen-1.6.3 
make $CORES_TO_USE
make install 
make install_docs 
cd .. 
rm -rvf doxygen-1.6.3 
ARSE
chmod +x ./install_docs.sh
sudo mv ./install_docs.sh /media/lfs/root

No comments:

Post a Comment