[gtkada] GtkExtra 2 for GtkAda 2.

Bobby D. Bryant bdbryant at mail.utexas.edu
Thu Dec 26 10:42:46 CET 2002


Tuesday I fetched gtkextra-2 from CVS, and with a little coaxing I was 
able to get it to compile.  The demonstration programs seem to be 
working OK too.  I wrote the maintainer, Adrian Feiguin, and he 
confirms that it is almost ready for release, with most of the 
outstanding issues being bug fixes and a Win32 port.  (I don't feel 
that I should post his message to the list, but if any of the GtkAda 
maintainers want to see it they can give me a holler and I'll forward 
it to them.)

Below are some notes I made:

  1. Getting GTK+ 2 running on a GTK+ 1.4 system.

  2. Getting GtkAda 2 running.

  3. Getting GtkExtra 2 running.

  4. Binding GtkExtra 2 into GtkAda 2.

Unfortunately, I barely got my toes wet on step 4, but maybe what I did 
do will be useful to someone.  Steps 1 & 2 won't be any help to the 
maintainers, but I am including them anyway for the benefit of anyone 
who has been itching to test drive GtkAda 2 but does not have a GTK+ 2 
system to try it on.

All the following was done on a Linux system.  For simplicity the 
examples assume that you have a /wherever directory that you use as the 
base directory for all the installations.

Feel free to incorporate this into any documentation where you find it 
useful, but be warned that I may have forgotten a detail here and there.

===
1. Getting GTK+ 2 running on a GTK+ 1.4 system.

If you have a reasonably fast CPU and network connection this can be 
done with Garnome, http://www.gnome.org/~jdub/garnome/.  See the 
instructions there.

The Garnome kit is essentially a big Makefile that will download a 
collection of specified components, compile them, and install them in 
your home directory, at ~/garnome by default.  Thus you can install it 
without sysadmin privileges.

The instructions suggest running the make in 
/wherever/garnome-0.19.5/meta/gnome-desktop/, but if you just want to 
build GTK+ 2 you should run it in /wherever/garnome-0.19.5/gnome/gtk+/ 
instead.  If you want non-default themes you may want to build one or 
more of gnome/gnome-themes/, gnome/gtk-engines/, or one of the 
gnome/*-engine/ kits as well.  For these partial builds you will need 
to use -

  % make deep-install

rather than -

  % make install

or else it will build but not install some of the libraries that you 
will need.

On my system Xft does not work (presumably because my XFree86 is not 
recent enough), so if you get fontconfig error messages when you try to 
start a GTK+ 2 application you should export GDK_USE_XFT=0 rather than 
=1 as instructed. This will keep you from getting the anti-aliased 
fonts, but at least you will be able to start playing with GTK+ 2.

Otherwise follow the instructions at the URL above.  There are lots of 
other useful things to know about Garnome, but this message is going to 
be too long already...

===
2. Getting GtkAda 2 running.

Set up GTK+ 2 per (1) above, and work in a terminal where you have set 
the environment variables required by the Garnome installation.

Hide your GtkAda 1 installation by removing its directories from your 
ADA_INCLUDE_PATH and ADA_OBJECTS_PATH.  Otherwise you'll have trouble 
compiling the new version.

Follow the instructions in the GtkAda 2 kit.  Gnat 3.13p gave a 
compiler error on Gtkada.MDI, but a simple workaround is to disable MDI 
support by commenting out the "with Gtkada.MDI" line in 
/wherever/GtkAda-2.0.0/src/make_gtk.adb.

The test program /wherever/GtkAda-2.0.0/testgtk/testgtk program should 
work now.  You have to run it form the directory where the progam is so 
that it can find some loadable components.

===
3. Getting GtkExtra 2 running.

This is the messy part.

Notice that GtkExtra has moved to http://gtkextra.sourceforge.net/, so 
that's where you'll have to find the components described below.  (You 
can find the maintainer's e-dress there as well.)

Set up GTK+ 2 per (1) above, and work in a terminal where you have set 
the environment variables required by the Garnome installation.

You will need to steal some files from the 0.99.17 release of GtkExtra 
1, so fetch it from Sourceforge and unpack it as 
/wherever/gtk+extra-0.99.17/.  However, there is no need to actually 
build it.

cd /wherever, and follow the CVS instructions linked from the 
Sourceforge page in order to check out the module named gtkextra-2.  
This will create and populate a directory /wherever/gtkextra-2/.

cd /wherever/gtkextra-2/, and pilfer some files from 0.99.17 as follows:

  % cp ../gtk+extra-0.99.17/install-sh .
  % cp ../gtk+extra-0.99.17/missing .
  % cp ../gtk+extra-0.99.17/mkinstalldirs .
  % cp ../gtk+extra-0.99.17/ltmain.sh .
  % cp ../gtk+extra-0.99.17/config.h.in .
  % cp ../gtk+extra-0.99.17/config.sub .
  % cp ../gtk+extra-0.99.17/config.guess .

Run the command:

  % libtool --version

and compare its output to these lines in ltmain.sh -

    VERSION=1.3.4
    TIMESTAMP=" (1.385.2.196 1999/12/07 21:47:57)"

If they do not match, edit ltmain.sh and substitute in the values for 
your system.

Run the following commands, in order:

  % aclocal
  % autoconf
  % run automake
  % configure --help

Now run configure with any desired options.  Be sure to use a --prefix 
that will cause the files to be installed in a safe place if you decide 
to actually install them.  (You don't need to install them for this 
experiment.)

  % make
  % cd gtkextra (i.e., /wherever/gtkextra-2/gtkextra/)

Run all the test* executables.  They should all work, though a few 
still need a bit of cleaning up.

===
4. Binding GtkExtra 2 into GtkAda 2.

Build everything in steps (1), (2), and (3), and set up the necessary 
environment variables as described above.

In /wherever/GtkAda-2.0.0/src/, rename the gtkextra/ subdirectory to 
gtkextra-save/, and set up a symbolic link pointing to your new 
GtkExtra 2 directory:

  % ln -s /wherever/gtkextra-2/gtkextra gtkextra

This will cause the GtkAda 2 Makefile to look at the GtkExtra 2 stuff 
that you just built.

Edit /wherever/GtkAda-2.0.0/src/Makefile and fix it so that it will not 
actually try to rebuild GtkExtra 2 when you rebuild GtkAda 2.  This can 
be done by finding the target "extra:" and commenting out the next line.

If you now try to rebuild GtkAda 2 you will get a couple of link errors 
due to function name changes in GtkExtra 2.  These can be fixed easily 
by editing /wherever/GtkAda-2.0.0/src/gtk-extra-psfont.adb and changing 
the following symbol names in two of the Import pragmas:

     - change gtk_psfont_find_by_family to gtk_psfont_get_by_family
     - change gtk_psfont_get_font       to gtk_psfont_get_by_name

GtkAda 2 should now build and link to the GtkExtra 2 object files for 
those few portions that are not commented out in 
/wherever/GtkAda-2.0.0/src/make_gtk.adb.

However, all this just gets you to the part where the fun starts.  If 
you uncomment more of the Gtk.Extra "withs" in make_gtk.adb you will be 
hit with a barrage of link errors due to symbol mismatches.  Some of 
them are simple name changes and will be very easy to fix (as above), 
but others are going to take more work.  I traced out a couple of them 
and found that they were caused by changes in the definitions of record 
structures between GtkExtra 1 and GtkExtra 2, so determining how they 
should be fixed will not be anything so trivial as changing an 
identifier.

Good luck to any who opt to play with any of this; I hope my notes are 
of some use.

Bobby Bryant
Austin, Texas




More information about the gtkada mailing list