Monday 23 August 2010

LAP - GTK

Right, before we can have nice dialogue boxes for UAE to switch disks while it is up and running (the F12 + F1 key combo), we need to install a toolkit. As best as I can gather this is effectively the graphical equivalent of ncurses. It helps build user interfaces. We are going to use GTK, which is the toolkit that Gnome is based on. This is the GTK that e-uae's configure command complained was missing, so hopefully this should sort it out.

GTK is based on three separate packages, Cairo which is a 2d graphics library, Pango which is a library for text display, and ATK which does accessibility stuff like magnifiers. Pango and ATK require Glib2, which is some sort of low level difficult stuff library. It is easy to get confused between Glib2 and Glibc. They have nothing to do with each other; the 'G' in Glib2 stands for Gnome, whereas in Glibc it stands for Gnu. So that's cleared that up then. Glib2 in turn depends upon PCRE, which is a Perl plugin which does regular expression searching and matching.

Cairo needs libpng, pixman and fontconfig, all of which we installed with X. GTK also wants, but does not strictly need, libtiff, which is another graphics library like libpng and libjpeg.

Lets get all that downloaded first:

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 desktop
chmod -v a+wt desktop
cd desktop
wget http://cairographics.org/releases/cairo-1.8.10.tar.gz 
wget http://downloads.sourceforge.net/pcre/pcre-8.00.tar.bz2 
wget http://ftp.gnome.org/pub/gnome/sources/glib/2.22/glib-2.22.4.tar.bz2
wget http://ftp.gnome.org/pub/gnome/sources/pango/1.26/pango-1.26.2.tar.bz2
wget http://ftp.gnome.org/pub/gnome/sources/atk/1.28/atk-1.28.0.tar.bz2
wget http://download.osgeo.org/libtiff/tiff-3.9.2.tar.gz
wget http://ftp.gnome.org/pub/gnome/sources/gtk+/2.18/gtk+-2.18.7.tar.bz2

Then from xterm in the amiga system run these commands:

cd /sources/desktop
tar -xzvf cairo-1.8.10.tar.gz
cd cairo-1.8.10
./configure --prefix=/usr
make $CORES_TO_USE
make $CORES_TO_USE check
make[5]: Leaving directory `/sources/gtk/cairo-1.8.10/test' 
make[4]: *** [check-am] Error 2 
make[4]: Leaving directory `/sources/gtk/cairo-1.8.10/test' 
make[3]: *** [check-recursive] Error 1 
make[3]: Leaving directory `/sources/gtk/cairo-1.8.10/test' 
make[2]: *** [check] Error 2 
make[2]: Leaving directory `/sources/gtk/cairo-1.8.10/test' 
make[1]: *** [check-recursive] Error 1 
make[1]: Leaving directory `/sources/gtk/cairo-1.8.10' 
make: *** [check] Error 2 

Still, the book said:
Note that as many as 29 of the tests are known to fail for unknown reasons. If you do not have a gs binary in your path, many of the 205 tests will fail.

Shame there wasn't some sort of summary here. Also I do not know what a 'gs' binary is.
make install
cd ..
rm -rvf cairo-1.8.10

tar -xjvf pcre-8.00.tar.bz2
cd pcre-8.00
./configure --prefix=/usr \
--docdir=/usr/share/doc/pcre-8.00 \
--enable-utf8 --enable-unicode-properties \
--enable-pcregrep-libz \
--enable-pcregrep-libbz2

The [utf8] and [unicode-properties] are about text localisation stuff. The [libz] and [libbz2] inform it about the gzip and bzip2 compression software.

You will also have noticed that we are using the [\] character at the end of lines. This appears quite frequently in the LFS and BLFS instructions, but until recently I have not been using it. What is does, simply, is break a command over several lines. Without it, if a command was long enough it could wrap around to another line, and the terminal would interpret the wrapping as the end of one command and the beginning of another. This would cause great confusion.

In my blog I can use text boxes with unlimited width which means commands can be as long as they like. The LFS book cannot do this, because it is designed to be printed and printed books do not have slider bars. However, by this point of the build there is a good chance that you are using the Lynx text browser, or a simple text file containing the commands to copy them to an xterm window. As a result the word wrap problem has returned. For safety of copying and pasting, then, I am retaining the [\] convention in the book. There is a really important point here. The [\] character absolutely must be the last character on the line for the wrap not to be detected as the end of the command. Sometimes in copying and pasting an extra space gets accidentally included. If you have a problem compiling this stuff, look back over your commands, and make sure that no such spaces have crept in.

make $CORES_TO_USE
make $CORES_TO_USE check
================== 
All 5 tests passed 
================== 
Well, that's better.

make install

We need to do a quick move and link, just in case we ever build /usr on another partition.

mv -v /usr/lib/libpcre.so.* /lib/
ln -v -sf ../../lib/libpcre.so.0 /usr/lib/libpcre.so
cd ..
rm -rvf pcre-8.00

tar -xjvf glib-2.22.4.tar.bz2
cd glib-2.22.4
./configure --prefix=/usr --with-pcre=system
make $CORES_TO_USE
make $CORES_TO_USE install

We may want to check this software but we would need to install desktop-file-utils first. We are not going to bother with that for this particular build, but it is worth pointing out anyway. If we wanted to do this, we need to change permissions stuff:

chmod -v 755 /usr/bin/gtester-report
make $CORES_TO_USE check

We also need to set an environmental variable in /etc/profile so that glib2 knows about locale bullshit.

cat > /etc/profile.d/glib2-locale.sh << "EOF"
# Use the current locale charset for filenames
# in applications using GLib
export G_FILENAME_ENCODING=@locale
EOF
cd ..
rm -rvf glib-2.22.4

tar -xjvf pango-1.26.2.tar.bz2
cd pango-1.26.2
./configure --prefix=/usr --sysconfdir=/etc
make $CORES_TO_USE
make $CORES_TO_USE check
============= 
1 test passed 
============= 
Again, much better.

make install
cd ..
rm -rvf pango-1.26.2

tar -xjvf atk-1.28.0.tar.bz2
cd atk-1.28.0
./configure --prefix=/usr
make $CORES_TO_USE
make install
cd ..
rm -rvf atk-1.28.0

tar -xzvf tiff-3.9.2.tar.gz
cd tiff-3.9.2
./configure --prefix=/usr
make $CORES_TO_USE
make $CORES_TO_USE check
================== 
All 4 tests passed 
================== 
Fantastic.

make install
cd ..
rm -rvf tiff-3.9.2

tar -xjvf gtk+-2.18.7.tar.bz2
cd gtk+-2.18.7
./configure --prefix=/usr --sysconfdir=/etc
make $CORES_TO_USE
make $CORES_TO_USE check
Gtk-WARNING **: cannot open display: :101 
aborting... 
FAIL: testing 
Terminated 
Hmm. That does not look good. Lets forge ahead anyway and see what happens. Also, having googled this a little bit it seems to be something to do with the X server accepting remote connections. Which I care not a jot about.

make install
install -v -m755 -d /usr/share/doc/gtk+-2.18.7/{faq,tutorial}
cp -v -R docs/faq/html/* /usr/share/doc/gtk+-2.18.7/faq
cp -v -R docs/tutorial/html/* /usr/share/doc/gtk+-2.18.7/tutorial
install -v -m644 docs/*.txt /usr/share/doc/gtk+-2.18.7
cd ..
rm -rvf gtk+-2.18.7

We could go straight back and recompile e-uae to allow for changing disks, but since we also want to fix the fullscreen issue, and that will require recompiling e-uae also, we'll do SDL first.

I return from the far future to advise the reader that, in fact, that error in the check routine made absolutely no difference to the operation of the GTK+ powered graphical interface for e-uae.

No comments:

Post a Comment