Tuesday, 17 August 2010

LAP - X - Part 7, Xserver

OK, we are now heading to install the actual Xserver. There are a number of dependencies that we want to install first. The first one here is a Perl Module. We installed Perl way back when in the main build, and this is an add on that handles XML files. Yes, we did just install expat which was also supposed to do this. No I do not know why we now have two programs doing the same thing. I am going to script this because the perl module has its own way of building.

sudo cat > inst_xml.sh << "ARSE"
cd /sources/xorg 
tar -xzvf XML-Parser-2.36.tar.gz
cd XML-Parser-2.36
perl Makefile.PL
make $CORES_TO_USE
make install
cd ..
rm -rvf XML-Parser-2.36
echo "Next: ~/conf_intl.sh"
ARSE
chmod +x ./inst_xml.sh
sudo mv ./inst_xml.sh /media/lfs/root

Now we can install Intltool, which is another one of these universal translator gizmos – I think it speaks to gettext. We are going to do two scripts here, because we need to pause to confirm the output of the check half way through.

sudo cat > conf_intl.sh << "ARSE"
cd /sources/xorg
tar -xjvf intltool-0.40.6.tar.bz2
cd intltool-0.40.6
./configure --prefix=/usr
make $CORES_TO_USE
make check
echo Look for:
echo ================== 
echo All 1 tests passed 
echo ==================
echo "Now run ~/inst_intl.sh"
ARSE
chmod +x ./conf_intl.sh
sudo mv ./conf_intl.sh /media/lfs/root

The make check output for me was:

================== 
All 1 tests passed 
==================

Which is very promising. And now the second part of the installation of the package. I am putting this in a script because of the documentation install again.

sudo cat > inst_intl.sh << "ARSE"
cd /sources/xorg/intltool-0.40.6
make install
install -v -m644 -D doc/I18N-HOWTO /usr/share/doc/intltool-0.40.6/I18N-HOWTO
cd ..
rm -rvf intltool-0.40.6
echo "Next: ~/inst_xkb.sh"
ARSE
chmod +x ./inst_intl.sh
sudo mv ./inst_intl.sh /media/lfs/root

Now we have installed that tool, we can install the xkeyboard-config package. Go on, guess what this does – just have a guess... We have been building up to this – the last two packages were just to allow this one to be installed. This one is the actual dependency of Xserver. I actually screwed this up when I first ran the script because I have put in the uncompress commands as [xzvf] instead of [xjvf]. It couldn't uncompress the package and then moaned as it tried to execute the other commands. Not harm was done. I realised the mistake, and just used 'nano' to edit the script.

sudo cat > inst_xkb.sh << "ARSE" 
cd /sources/xorg
tar -xjvf xkeyboard-config-1.7.tar.bz2
cd xkeyboard-config-1.7
./configure $XORG_CONFIG --with-xkb-rules-symlink=xorg
#
#[with-xkb-rules-symlink] makes a link between the name of the rules the package installs (base) and the name that Xorg expects it to install [xorg].  Just a small compatibility issue.  I have no fucking clue why this package WHICH IS A LIBRARY FOR XORG is not automatically configured for Xorg in the first place.
#
make $CORES_TO_USE
make install
install -dv -m755 $XORG_PREFIX/share/doc/xkeyboard-config-1.7
install -v -m644 docs/{README,HOWTO}* $XORG_PREFIX/share/doc/xkeyboard-config-1.7
cd ..
rm -rvf xkeyboard-config-1.7
echo "Next: luit with XORG_CONFIG, pixman with --prefix=/usr, and ~/inst_server.sh"
ARSE
chmod +x ./inst_xkb.sh
sudo mv ./inst_xkb.sh /media/lfs/root

Now for another Xserver dependency. This is Luit, which allows us to display UTF-8 characters in text windows. Now sure what that means. I suspect is has something to so with fully supporting normal console outputs when the console is running in a window. So, basically, anything should look the same at the console whether in a text only mode, or running in a window under X. No need to script this, it is straightforwards.

tar -xjvf luit-1.0.4.tar.bz2
cd luit-1.0.4
./configure $XORG_CONFIG
make $CORES_TO_USE
make install
cd ..
rm -rvf luit-1.0.4

The next package is the final dependency we need for the Xserver. It handles real low level [pix]el [man]ipulation matters. The installation is also straighforwards.

tar -xzvf pixman-0.15.20.tar.gz
cd pixman-0.15.20
./configure --prefix=/usr
make $CORES_TO_USE
make install
cd ..
rm -rvf pixman-0.15.20

Finally we come to the Xserver itself. If you are reading along in the BLFS book you will see that I appear to have missed a dependency – Openssl. Well, that was installed to support the Lynx browser we installed to view the documentation, so we do not have to worry about it now. The configure command is complex here, so best to wrap all this up in a script.

sudo cat > inst_server.sh << "ARSE"
cd /sources/xorg
tar -xjvf xorg-server-1.7.1.tar.bz2
cd xorg-server-1.7.1
./configure $XORG_CONFIG --with-module-dir=$XORG_PREFIX/lib/X11/modules --with-xkb-output=/var/lib/xkb --enable-install-setuid --disable-config-hal --disable-config-dbus
#
#OK, lets try to work through this.  [with-module-dir] sets a path for installation of X modules.  I think the [with-xkb-output] just tells it where it will find stuff the [xkeyboard-config] package spits out, but I am not entirely clear and BLFS is silent on the issue.  [enable-install-setuid] makes sure that the program files end up as executable by root only.  Shouldn't be an issue because I am still running as root just now.  I am also disabling [hal] and [dbus] which are hardware management tools that are using by desktop environments like Gnome and KDE.  However, all X is going to do for us is display the Amiga Emulator, so I should not need them.  I may live to regret this.
#
make $CORES_TO_USE
make install
cd ..
rm -rvf xorg-server-1.7.1
echo "Next ~/inst_xterm.sh"
ARSE
chmod +x ./inst_server.sh
sudo mv ./inst_server.sh /media/lfs/root

I am also going to install one last application at this stage. This is xterm, which on completely simplistic level is BASH for X.

sudo cat > inst_xterm.sh << "ARSE"
cd /sources/xorg
tar -xzvf xterm-253.tgz
cd xterm-253
sed -i '/v0/,+1s/new:/new:kb=^?:/' termcap
echo -e '\tkbs=\\177,' >>terminfo
#
#Oh bloody hell would you look at that.  Those both make the backspace key actually work in xterm. Why it wouldn't in the first place is another delightful little mystery.
#
TERMINFO=/usr/lib/terminfo ./configure $XORG_CONFIG --enable-luit --enable-wide-chars --with-app-defaults=$XORG_PREFIX/share/X11/app-defaults
#
#We have to define TERMINFO just incase we din't install to /usr, which we did.  The enables tell it  we have luit, and fat letters.  The [app-defaults] is fairly self explanatory - we just tell it where to find default settings - which we will create in a minute.
#
make $CORES_TO_USE
make install
make install-ti
cat >> $XORG_PREFIX/share/X11/app-defaults/XTerm << "EOF"
*VT100*locale: true
*VT100*faceName: Monospace
*VT100*faceSize: 10
*backarrowKeyIsErase: true
*ptyInitialErase: true
EOF
cd ..
rm -rvf xterm-253
echo "Next: ~/inst_6_driver.sh"
ARSE
chmod +x ./inst_xterm.sh
sudo mv ./inst_xterm.sh /media/lfs/root

As before, once I have made all my scripts, I booted from the Amiga Key and ran the install commands in order, using the scripts where necessary.

Monday, 16 August 2010

LAP - X - Part 6, Cursors and Fonts

The next group is Fonts, which requires a theme for the cursor to be installed first.   I am not entirely sure whether or not this is the Mouse cursor or the text entry cursor.  I think mouse, because the file is quite large

tar -xjvf xcursor-themes-1.0.2.tar.bz2
cd xcursor-themes-1.0.2
./configure $XORG_CONFIG
make $CORES_TO_USE
make install
cd ..
rm -rvf xcursor-themes-1.0.2

Not worth bothering with a script for that one. I will, again, has to script the fonts install. The same approach is taken.

sudo cat > inst_5_font.sh << "ARSE" 
cd /sources/xorg/font
for package in $(grep -v '^#' ../font-7.5-2.wget)
do
packagedir=${package%.tar.bz2}
tar -xvf $package
cd $packagedir
./configure $XORG_CONFIG
make $CORES_TO_USE
make install
cd ..
rm -rvf $packagedir
done 2>&1 | tee -a ../font-7.5-2-compile.log
echo "Next: ~/inst_xml.sh"
ARSE
chmod +x ./inst_5_font.sh
sudo mv ./inst_5_font.sh /media/lfs/root

For some bizarre reason the book suggests the command [rm -f $package] after removing the $packagedir. This is stupid. In effect this deletes the font files that have downloaded meaning that you would have to download them all again if you are reinstalling the whole of Xorg. Why would you want to reinstall the whole of Xorg? Well, if for instance you went to bed half way through the installation, and forgot that you had compiled a package but not actually installed it, you would have to go back to that step to start again. It would then be pretty fucking frustrating to discover that the god damned stupid script for Fonts had deleted all of the god damned downloaded fonts.

So I have deleted that line.

Friday, 13 August 2010

LAP - X - Part 5, Applications

The next job is to install the Applications files. This contains a number of very useful programs that are actually used quite a lot – for instance 'startx' to actually begin Xorg. We may want OpenGL support, so we have to install MesaLib which brings several dependencies. We also need some graphical packages.

So lets get going with the dependencies, starting with xbitmaps. I think this is just some graphics files which X is going to use.
tar -xjvf xbitmaps-1.1.0.tar.bz2
cd xbitmaps-1.1.0
./configure $XORG_CONFIG
make install
cd ..
rm -rvf xbitmaps-1.1.0

Not scripting that easy install. Next is libpng, which adds support for image files in the PNG format.

sudo cat > conf_libpng.sh << "ARSE" 
cd /sources/xorg
tar -xjvf libpng-1.2.42.tar.bz2
cd libpng-1.2.42
patch -Np1 -i ../libpng-1.2.42-apng-1.patch
./configure --prefix=/usr
make $CORES_TO_USE
make check
echo check for
echo ============= 
echo 1 test passed 
echo ============= 
echo "Now run ~/inst_libpng.sh"
ARSE
chmod +x ./conf_libpng.sh
sudo mv ./conf_libpng.sh /media/lfs/root

I am also going to script the installation phase because the documentation commands are detailed.

sudo cat > inst_libpng.sh << "ARSE" 
cd /sources/xorg/libpng-1.2.42
make install
install -v -m755 -d /usr/share/doc/libpng-1.2.42
install -v -m644    README libpng-1.2.42.txt /usr/share/doc/libpng-1.2.42
cd ..
rm -rvf libpng-1.2.42
echo "Now install libpthread-stubs with --prefix=/usr and then libdrm with  --prefix=XORG_PREFIX, before running  ~/inst_mesa.sh"
ARSE
chmod +x ./inst_libpng.sh
sudo mv ./inst_libpng.sh /media/lfs/root

Next up we have one of those chains, libpthread-stubs supports libdrm which supports MesaLib. What this actually does is a fucking mystery. There is something called pthread, apparently, and this is a stub of it. I think this is connected with some possible functions that libc does not provide. Too simple to script.

tar -jxvf libpthread-stubs-0.1.tar.bz2
cd libpthread-stubs-0.1
./configure --prefix=/usr
make $CORES_TO_USE
make install
cd ..
rm -rvf libpthread-stubs-0.1

Then we have libdrm, which happily is nothing to do with digital restrictions management bollocks. This is actually to allow Xorg to use the Direct Rendering Modules compiled into the Kernel. This, I think, means that we get faster hardware supported video. Again, too simple to script.

tar -jxvf libdrm-2.4.14.tar.bz2
cd libdrm-2.4.14
./configure --prefix=$XORG_PREFIX
make $CORES_TO_USE
make install
cd ..
rm -rvf libdrm-2.4.14

Now we have done the 2D acceleration we also may need 3D acceleration. This is provided by MesaLib. This involves [sed] so scripts-ahoy.

sudo cat > inst_mesa.sh << "ARSE" 
cd /sources/xorg
tar -xjvf MesaLib-7.6.tar.bz2
tar -xjvf MesaDemos-7.6.tar.bz2
#We are installing the Demos which are useful to check everything is working.
cd Mesa-7.6
sed 's@FLAGS=\"-g@FLAGS=\"@' -i configure
#This stops it building the debugging symbols.
./configure $XORG_CONFIG
make $CORES_TO_USE
make -C progs/xdemos glxinfo glxgears
make install
install -v -m755 progs/xdemos/glx{info,gears} ${XORG_PREFIX}/bin
cd ..
rm -rvf Mesa-7.6
echo "Next: ~/inst_4_apps.sh"
ARSE
chmod +x ./inst_mesa.sh
sudo mv ./inst_mesa.sh /media/lfs/root

And finally, we come to the applications themselves.

sudo cat > inst_4_apps.sh << "ARSE" 
cd /sources/xorg/app
for package in $(grep -v '^#' ../app-7.5-2.wget)
do
packagedir=${package%.tar.bz2}
tar -xvf $package
cd $packagedir
./configure $XORG_CONFIG
make $CORES_TO_USE
make install
cd ..
rm -rvf $packagedir
done 2>&1 | tee -a ../app-7.5-2-compile.log
echo "Next:  xcursor-themes with XORG_CONFIG, and then ~/inst_5_font.sh"
ARSE
chmod +x ./inst_4_apps.sh
sudo mv ./inst_4_apps.sh /media/lfs/root

Thursday, 12 August 2010

LAP - X - Part 4, Libraries and Dependencies

LAP - X - Part 4, Libraries and Dependencies
The next themed package is Libraries, which contains, surprisingly, libraries which support functions of the xserver. Part of these handle font displays, and we need to install some font packages first. Bizarrely it also claims to need a separate text editor, for what purpose I know not. It also needs a couple of packages which relate to clients accessing the display. Technically the first of these [libXau] is not a dependency of Libraries, but BLFS recommends installing it at this stage.
cd /sources/xorg

The first package is the last I referred to. It is LibXau, and it contains an authentication protocol. The X system has clients and servers, and the servers need to authenticate the clients. None of this is of any interest if you are using one machine like we will be, but it would be of use in a large networked environment. I think we can risk these commands without a script as they are as basic as it gets:

tar -jxvf libXau-1.0.5.tar.bz2
cd libXau-1.0.5
./configure $XORG_CONFIG
make $CORES_TO_USE
make check
1 test passed.
make install
cd ..
rm -rvf libXau-1.0.5

The next package is libXdmcp. This is a library which implements the [X] [D]isplay [M]anager [C]ontrol [P]rotocol. What the Xdmcp actually is, is less clear. BLFS does say that it is useful in letting clients interact with the Display Manager, and that sounds useful. Again, I think we can manage this one without a script.

tar -jxvf libXdmcp-1.0.3.tar.bz2
cd libXdmcp-1.0.3
./configure $XORG_CONFIG
make $CORES_TO_USE
make install
cd ..
rm -rvf libXdmcp-1.0.3

Next up is a small basic text editor, which for some reason the library package depends upon. Let's just get it installed. This is a tiny bit more complicated, so I am going to put it in a script:

sudo cat > inst_ed.sh << "ARSE" 
cd /sources/xorg
tar -xvzf ed-1.4.tar.gz
cd ed-1.4
./configure --prefix=/usr --bindir=/bin
make $CORES_TO_USE
make check
echo cd /sources/xorg/ed-1.4
echo make install
echo cd ..
echo rm -rvf ed-1.4
echo "Next: ~/inst_freetype.sh"
ARSE
chmod +x ./inst_ed.sh
sudo mv ./inst_ed.sh /media/lfs/root
The test out put should be:
tests completed successfully.
Then you need to run the commands which follow the [echo] command. The point of the [echo] is that the test should run, and then print out the last four, simple, commands for you to just type in. Next is Freetype2, which is for rendering TrueType fonts. This is not strictly a dependency of the Library package, but it is of fontconfig, which IS a dependency of Library. Oh, and this involves the madness that is sed, so of course it is going in a script.
sudo cat > inst_freetype.sh << "ARSE" 
cd /sources/xorg
tar -jxvf freetype-2.3.12.tar.bz2
cd freetype-2.3.12
tar -xvf ../freetype-doc-2.3.12.tar.bz2 --strip-components=2 -C docs
#
#That command unpacks some additional documentation which I downloaded.  The [strip-components] option removes the leading [2] characters of the uncompressed filenames.  The other option [C]hanges to the docs directory before unpacking.
#
sed -i -r -e 's:.*(#.*BYTE.*) .*:\1:' -e 's:.*(#.*SUBPIX.*) .*:\1:' include/freetype/config/ftoption.h
#
#Even for [sed] that's fucking insane.  Apparently this turns on a native TrueType function and subpixel rendering for clearer text on LCD displays.  These have patent issues (I think Microsoft have a patent for their ClearType software, which presumably does the same stuff).
#
./configure --prefix=/usr
make $CORES_TO_USE
make install
install -v -m755 -d /usr/share/doc/freetype-2.3.12
cp -v -R docs/*     /usr/share/doc/freetype-2.3.12
cd ..
rm -rvf freetype-2.3.12
echo "Next: ~/inst_expat.sh"
ARSE
chmod +x ./inst_freetype.sh
sudo mv ./inst_freetype.sh /media/lfs/root
Fontconfig also needs software to handle XML. I am going to use expat. It is fairly straightforwards, but does have tricky to type in documentation install commands, so let's just script it.
sudo cat > inst_expat.sh << "ARSE" 
cd /sources/xorg
tar -xzvf expat-2.0.1.tar.gz
cd expat-2.0.1
./configure --prefix=/usr
make $CORES_TO_USE
make install
install -v -m755 -d /usr/share/doc/expat-2.0.1
install -v -m644 doc/*.{html,png,css} /usr/share/doc/expat-2.0.1
cd ..
rm -rvf expat-2.0.1
echo "Next: ~/inst_fontconfig.sh"
ARSE
chmod +x ./inst_expat.sh
sudo mv ./inst_expat.sh /media/lfs/root
Last before the Library install itself is Fontconfig. Clue is in the name really. The configure options are quite lengthy so we'd best script them up.
sudo cat > inst_fontconfig.sh << "ARSE" 
cd /sources/xorg
tar -xzvf fontconfig-2.8.0.tar.gz
cd fontconfig-2.8.0
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --disable-docs --without-add-fonts --with-docdir=/usr/share/doc/fontconfig-2.8.0
make $CORES_TO_USE
make check
echo I got:
echo ============= 
echo 1 test passed 
echo ============= 
echo cd /sources/xorg/fontconfig-2.8.0
echo make install
echo cd ..
echo rm -rvf fontconfig-2.8.0
echo "Next: ~/inst_3_libraries.sh"
ARSE
chmod +x ./inst_fontconfig.sh
sudo mv ./inst_fontconfig.sh /media/lfs/root
The test output should be:
============= 
1 test passed 
============= 
Then just follow the reminders to finish. Finally we come to the libraries themselves. This is one of the bigger packages that form part of the Xorg installation.
sudo cat > inst_3_libraries.sh << "ARSE" 
cd /sources/xorg/lib
for package in $(grep -v '^#' ../lib-7.5-2.wget)
do
packagedir=${package%.tar.bz2}
tar -xvf $package
cd $packagedir
case "$packagedir" in
libX11-1.3.2 )
CONFIGPARAMS="--without-xcb"
esac
./configure $XORG_CONFIG $CONFIGPARAMS
make $CORES_TO_USE
make install
unset CONFIGPARAMS
ldconfig
cd ..
rm -rvf $packagedir
done 2>&1 | tee -a ../lib-7.5-2-compile.log
echo "Next do xbitmaps manually, with the option XORG_CONFIG, and then run ~/conf_libpng.sh"
ARSE
chmod +x ./inst_3_libraries.sh
sudo mv ./inst_3_libraries.sh /media/lfs/root

OK, that is a little bit more complex than the previous multipackage builds. The difference is that one of the packages needs a specific option set - that's the CONFIGPARAMS variable. It is only set for that one package. It doesn't matter that we use $CONFIGPARAMS for each package, because at all other times it is null. That should be that for Libraries.

Wednesday, 11 August 2010

LAP - X - Part 3, Protocol Headers & Utils

We'll now move on to the first part of the actual X build, the Protocol headers. I do not exactly know what these are, but I assume they are the same type of thing as the Linux headers which we required to install from the Kernel sources at the beginning of the toolchain and actual builds.

Once we have our Xorg variables set we need to run the following command in the [/sources/xorg/proto] directory:

for package in $(grep -v '^#' ../proto-7.5-2.wget)
do
packagedir=${package%.tar.bz2}
tar -xvf $package
cd $packagedir
./configure $XORG_CONFIG
make install
cd ..
rm -rvf $packagedir
done 2>&1 | tee -a ../proto-7.5-2-compile.log

That looks complicated, but it really isn't. First of all it uses [grep] to search through the [.wget] file for all the filenames that we are going to use. It then assigns each filename in turn to the variable [package]. I presume that the [packagedir] variable is assigned the name of the file without the [tar.bz2] bit at the end. Thankfully none of these packages are gzipped, or uncompress to a stupid folder name, otherwise this would be much harder. We then uncompress and move into the resulting folder. We then run configure using the variable we set before - so the configure command is really short. Apparently there is no make command, we just [make install]. Then we come out of the folder and remove it. All of the output is logged using [tee] to a log file.

Lets make a script for this. I have added the [1] to the name, to remind myself about the install order once I have rebooted to the Amiga Key and am actually running all these scripts:

sudo cat > inst_1_proto.sh << "ARSE" 
cd /sources/xorg/proto
for package in $(grep -v '^#' ../proto-7.5-2.wget)
do
packagedir=${package%.tar.bz2}
tar -xvf $package
cd $packagedir
./configure $XORG_CONFIG
make install
cd ..
rm -rvf $packagedir
done 2>&1 | tee -a ../proto-7.5-2-compile.log
echo "Next: ~/inst_2_util.sh"
ARSE
chmod +x ./inst_1_proto.sh
sudo mv ./inst_1_proto.sh /media/lfs/root

Note that at the beginning of the script it changes into the correct directory, so it does not actually matter where you execute the script from, it will make its way to the proper place before running all the commands.

Now we are going to do exactly the name thing, but for the Utilities package. Surprisingly enough this package contains utilities. Having a browse through the descriptions in BLFS, it seems that these are mostly geared towards the installation of X rather than running it. The command we are going to run is:

for package in $(grep -v '^#' ../util-7.5-2.wget)
do
packagedir=${package%.tar.bz2}
tar -xvf $package
cd $packagedir
./configure $XORG_CONFIG
make $CORES_TO_USE
make install
cd ..
rm -rvf $packagedir
done 2>&1 | tee -a ../util-7.5-2-compile.log

The difference with this command is the addition of a [make] step - otherwise it is just the same (with the obvious substitution of [util] for [proto] of course. Lets script this bad boy up. I have put in an [echo] command at the end to remind myself what to do next.

sudo cat > inst_2_util.sh << "ARSE" 
cd /sources/xorg/util
for package in $(grep -v '^#' ../util-7.5-2.wget)
do
packagedir=${package%.tar.bz2}
tar -xvf $package
cd $packagedir
./configure $XORG_CONFIG
make $CORES_TO_USE
make install
cd ..
rm -rvf $packagedir
done 2>&1 | tee -a ../util-7.5-2-compile.log
echo "Now do libXau and libXdmcp with the configure option XORG_CONFIG.  You can check libXau.  Then run ~/inst_ed.sh"
ARSE
chmod +x ./inst_2_util.sh
sudo mv ./inst_2_util.sh /media/lfs/root

Tuesday, 10 August 2010

LAP - X - Part 2, Variables

OK, we have our files downloaded, now it is time to install them. We are going to have to do this via script, because the commands are so damned complicated it would be asking for trouble to have to type them into the command line by hand.

I will write the blog post from the point of view of having actually booted from the Amiga Key, but remember before you run the commands to create the script you need to boot from the LiveCD and run these commands:

umount -v /media/amiga
sudo mkdir /media/lfs
sudo mount -v -t ext3 /dev/disk/by-label/amiga /media/lfs
cd /media/lfs/sources

So, that reminder over, the first thing that we have to do is to set two environment variables. The first tells the system where X is installed, and the second contains a number of [configure] options and will save us from having to type them in each time we configure a package. What I am going to do is set these variables, BUT ALSO add them to the [/etc/profile] file so that they will remain set even if I reboot.

export XORG_PREFIX="/usr"

I have decided to install into [/usr] as with all the other system software. The book did give me the choice between there or [/opt]. DO NOT RUN this command from the LiveCD, it needs to be run from the Amiga Key.

export XORG_CONFIG="--prefix=$XORG_PREFIX --sysconfdir=/etc --mandir=$XORG_PREFIX/share/man --localstatedir=/var"

The actual options that we are setting here are fairly self explanatory.

Now lets have a script for this:

sudo cat > set_0_xorg_stuff.sh << "ARSE" 
cat >> /etc/profile.d/X.sh << "EOF"
# Begin Xorg Variables
export XORG_PREFIX="/usr"
export XORG_CONFIG="--prefix=$XORG_PREFIX --sysconfdir=/etc --mandir=$XORG_PREFIX/share/man --localstatedir=/var"
# End Xorg variables
EOF
echo "Remember to now exit and log back in to allow these changes to take place.  Then run ~/inst_1_proto.sh"
ARSE
chmod +x ./set_0_xorg_stuff.sh
sudo mv ./set_0_xorg_stuff.sh /media/lfs/root

Note in my script I used [>>] to add those commands to /etc/profile.d/X.sh, rather than over writing it entirely. Once you have run the script, log out and log in again and use [echo] to check the [$]variables. I have put a reminder to myself in the last line of the script. When I run it it will end with that message. The idea is that rebooting all the time to make new scripts is a pain in the arse, and it would be most efficient to make all of the Xorg Scripts in one go, reboot to the key and then run them one at a time. That would be tricky if we didn't keep a track in the scripts themselves of which script comes next.

Monday, 9 August 2010

LAP - X - Part 1, Download

We now come to one of the trickiest parts of the installation - building the X server, or in other words, creating our graphical interface. If one had hoped that this would be as simple as downloading the 'x' package and installing it, then one is about to be seriously fucking disappointed.

This post will deal solely with downloading all the install files that we are going to need in due course. The software packages come in two varieties. First stand alone packages which achieve one thing, and second groups of packages which are gathered together by the LFS team in 'themes'.

We have to even run a short script just to download the themed packages otherwise we'd be here all fecking day.

Let's just get the stuff downloaded, and I will try to work it all out afterwards.

umount -v /media/amiga
sudo mkdir /media/lfs
sudo mount -v -t ext3 /dev/disk/by-label/amiga /media/lfs
cd /media/lfs/sources

Lets make a new directory for the xorg sources, as there will be so many of them.

mkdir xorg
chmod -v a+wt xorg
cd xorg
wget http://anduin.linuxfromscratch.org/files/BLFS/svn/xorg/proto-7.5-2.wget
wget http://anduin.linuxfromscratch.org/files/BLFS/svn/xorg/proto-7.5-2.md5

What we have just downloaded is a list of files and their md5sums (a way of checking the file has downloaded properly). We are going to make another subdirectory just to store these files.

mkdir proto
cd proto

What we now do is get the [wget] program to automatically process that list of files, downloading each one.
grep -v '^#' ../proto-7.5-2.wget | wget -i- -c -B http://xorg.freedesktop.org/releases/individual/proto/

That command looks nasty but I think that the [grep] bit spits out the file names from the [.wget] file, and [|] pipes them to [wget]. The [-i-] option tells [wget] to expect a list of file names from the other side of the [|] pipe. It is also told to [c]ontinue any partial downloads, and the [B] option means attach the following URL to the filename to download it. It finished with this message for me:

Downloaded: 24 files, 1.7M in 20s (90.4 KB/s)

Lastly we run md5sum to check the downloaded files have arrived properly.

md5sum -c ../proto-7.5-2.md5

Assuming that has worked (lots of 'OK's), move on to the next list, which we deal with in exactly the same way:

cd ..
wget http://anduin.linuxfromscratch.org/files/BLFS/svn/xorg/util-7.5-2.wget
wget http://anduin.linuxfromscratch.org/files/BLFS/svn/xorg/util-7.5-2.md5
mkdir util
cd util
grep -v '^#' ../util-7.5-2.wget | wget -i- -c -B http://xorg.freedesktop.org/releases/individual/util/
md5sum -c ../util-7.5-2.md5

Wait a minute, all that palaver was for two fucking files? It would literally have been less effort to just wget each of them individually.

cd ..

Taking the order BLFS presents these packages, the next two are stand alone:

wget http://xorg.freedesktop.org/releases/individual/lib/libXau-1.0.5.tar.bz2
wget http://xorg.freedesktop.org/releases/individual/lib/libXdmcp-1.0.3.tar.bz2

The next package we are supposed to download is the X Libraries. However, dependency issues raise their head at this point and we are forced into downloading some extra packages first.

wget http://ftp.gnu.org/pub/gnu/ed/ed-1.4.tar.gz
wget http://downloads.sourceforge.net/freetype/freetype-2.3.12.tar.bz2
wget http://downloads.sourceforge.net/freetype/freetype-doc-2.3.12.tar.bz2
wget http://downloads.sourceforge.net/expat/expat-2.0.1.tar.gz
wget http://fontconfig.org/release/fontconfig-2.8.0.tar.gz

Then back to lists:

wget http://anduin.linuxfromscratch.org/files/BLFS/svn/xorg/lib-7.5-2.wget
wget http://anduin.linuxfromscratch.org/files/BLFS/svn/xorg/lib-7.5-2.md5
mkdir lib
cd lib
grep -v '^#' ../lib-7.5-2.wget | wget -i- -c -B http://xorg.freedesktop.org/releases/individual/lib/

Downloaded: 31 files, 10M in 1m 34s (114 KB/s)

md5sum -c ../lib-7.5-2.md5
cd ..

The next few downloads are all dependencies of the next theme'd package.

wget http://xorg.freedesktop.org/releases/individual/data/xbitmaps-1.1.0.tar.bz2
wget http://downloads.sourceforge.net/libpng/libpng-1.2.42.tar.bz2
wget http://anduin.linuxfromscratch.org/sources/BLFS/conglomeration/libpng/libpng-1.2.42-apng-1.patch
wget http://xcb.freedesktop.org/dist/libpthread-stubs-0.1.tar.bz2
wget http://dri.freedesktop.org/libdrm/libdrm-2.4.14.tar.bz2
wget ftp://ftp.freedesktop.org/pub/mesa/7.6/MesaLib-7.6.tar.bz2
wget ftp://ftp.freedesktop.org/pub/mesa/7.6/MesaDemos-7.6.tar.bz2

And another list:

wget http://anduin.linuxfromscratch.org/files/BLFS/svn/xorg/app-7.5-2.wget
wget http://anduin.linuxfromscratch.org/files/BLFS/svn/xorg/app-7.5-2.md5

mkdir app
cd app
grep -v '^#' ../app-7.5-2.wget | wget -i- -c -B http://xorg.freedesktop.org/releases/individual/app/
md5sum -c ../app-7.5-2.md5

Downloaded: 39 files, 4.3M in 1m 3s (69.7 KB/s)

cd ..

Another one off:

wget http://xorg.freedesktop.org/releases/individual/data/xcursor-themes-1.0.2.tar.bz2

And then another list:

wget http://anduin.linuxfromscratch.org/files/BLFS/svn/xorg/font-7.5-2.wget
wget http://anduin.linuxfromscratch.org/files/BLFS/svn/xorg/font-7.5-2.md5
mkdir font
cd font
grep -v '^#' ../font-7.5-2.wget | wget -i- -c -B http://xorg.freedesktop.org/releases/individual/font/

Downloaded: 37 files, 15M in 2m 8s (117 KB/s)

md5sum -c ../font-7.5-2.md5
cd ..

And some dependency stuff before the next package:

wget http://cpan.org/authors/id/M/MS/MSERGEANT/XML-Parser-2.36.tar.gz
wget http://ftp.gnome.org/pub/gnome/sources/intltool/0.40/intltool-0.40.6.tar.bz2

Then a couple of xorg packages:

wget http://xlibs.freedesktop.org/xkbdesc/xkeyboard-config-1.7.tar.bz2
wget http://xorg.freedesktop.org/releases/individual/app/luit-1.0.4.tar.bz2

Followed by another dependency, and the important sounding xorg-server:

wget http://cairographics.org/releases/pixman-0.15.20.tar.gz
wget http://xorg.freedesktop.org/releases/individual/xserver/xorg-server-1.7.1.tar.bz2

The last themed group is the driver files for the hardware you have. This is a bit tricky, but first download the list files:

wget http://anduin.linuxfromscratch.org/files/BLFS/svn/xorg/driver-7.5-2.wget
wget http://anduin.linuxfromscratch.org/files/BLFS/svn/xorg/driver-7.5-2.md5

Now you do not want to download ALL the driver files – only the ones appropriate to your system. I edited the wget file as follows:

nano driver-7.5-2.wget

And I put a '#' to comment out each line apart from
xf86-input-evdev-2.3.0.tar.bz2
xf86-input-joystick-1.4.99.2.tar.bz2 
xf86-input-keyboard-1.4.0.tar.bz2 
xf86-input-mouse-1.5.0.tar.bz2 
xf86-input-synaptics-1.2.0.tar.bz2 
xf86-video-dummy-0.3.2.tar.bz2
xf86-video-fbdev-0.4.1.tar.bz2
xf86-video-intel-2.9.1.tar.bz2
xf86-video-vesa-2.2.1.tar.bz2

And I put the same '#' in the md5sum file by running:

nano driver-7.5-2.md5

I then downloaded and checked the files I have selected:
mkdir driver
cd driver
grep -v '^#' ../driver-7.5-2.wget | wget -i- -c -B http://xorg.freedesktop.org/releases/individual/driver/

Downloaded: 9 files, 2.9M in 16s (181 KB/s)
Downloaded: 7 files, 2.3M in 12s (207 KB/s)

md5sum -c ../driver-7.5-2.md5
cd ..

Finally, download this stand alone program:

wget ftp://invisible-island.net/xterm/xterm-253.tgz

Next time we find out what exactly the fuck all this is for, and what we do with it.