Here are the complete procedures to build Gtk+ 2.2.4 from scratch
(Systems tested are Redhat 7.2, Solaris 2.5.1, Solaris 2.8, Tru64 5.1a,
 HP-UX 11.00).

Note that these instructions are provided as is, and do not represent a
100% guaranteed method. This is merely an empirical list of steps that
are required for a given version and for a given set of OS.

If you have trouble building Gtk+ from sources, the proper place to ask help
is on the various Gtk+ lists.

On linux systems, you can skip the steps from libiconv to libjpeg, and
ignore the special comments.

Under HP-UX, a recent version of GCC (e.g 3.2) should be used.

Under AiX, the vendor C compiler is used:
# CC=cc
# export CC

Once all these steps have been done successfully, only glib, atk, pango and gtk
need to be rebuilt when their version change.

prefix=/opt/gtk-2.0

##############
# pkg-config #
##############
tar xzvf pkgconfig-0.14.0.tar.gz
cd pkgconfig-0.14.0
./configure --prefix=$prefix
make
make install
cd ..

PATH=$prefix/bin:$PATH
LD_LIBRARY_PATH=$prefix/lib:$LD_LIBRARY_PATH
LDFLAGS=-L$prefix/lib
export PATH LDFLAGS LD_LIBRARY_PATH

# Needed so that gcc finds libiconv.h (and libpng.h, ...) when configuring
# and building subsequent packages

C_INCLUDE_PATH="$prefix/include"
export C_INCLUDE_PATH

# When using the native C compiler (e.g. under AiX):
# CFLAGS="-I$C_INCLUDE_PATH -O2 -g"
# export CFLAGS

############
# libiconv #
############
# This step isn't needed on Linux nor AiX 5.1
# It is needed under Solaris, HP-UX, Tru64 and IRIX

tar xzvf libiconv-1.7.tar.gz
cd libiconv-1.7
./configure --prefix=$prefix
make
make install

########
# zlib #
########

# Not needed on Tru64 5.1a nor IRIX 6.5

# AiX 5.1: although this library seems to be provided by the system, building
# it is still needed, as the headers were not installed.

tar xzvf zlib-1.1.4.tar.gz
ln -s zlib-* zlib
cd zlib
./configure --prefix=$prefix

# Under HP-UX and Solaris: add -fPIC to CFLAGS in Makefile
# make
# for HP-UX: ld -z -b -o libz.sl `ar t libz.a`
# for Solaris: gcc -shared -o libz.so `ar t libz.a`
# cp libz.s? $prefix/lib

make
make install
cd ..

##########
# libpng #
##########

# Note: This step is needed on IRIX 6.5 too, because the version of
# libpng installed is too old for GTK to compile.

tar xzvf libpng-1.0.10.tar.gz
cd libpng-1.0.10
cp scripts/makefile.gcc makefile
# check makefile & pngconf.h

# Under HP-UX and Solaris:
# make CFLAGS="-O2 -fPIC"
# for HP-UX: ld -z -b -o libpng.sl `ar t libpng.a` $LDFLAGS -lz
# for Solaris: gcc -shared -o libpng.so `ar t libpng.a` $LDFLAGS -lz
# cp -p libpng.s? $prefix/lib

make
mkdir -p $prefix/include $prefix/lib
cp -p png.h pngconf.h $prefix/include
chmod 644 $prefix/include/png.h $prefix/include/pngconf.h
cp -p libpng.a $prefix/lib
cd ..

###########
# libjpeg #
###########

# Not needed on IRIX 6.5

tar xzvf jpegsrc.v6b.tar.gz
cd jpeg-6b
./configure --prefix=$prefix

# Under HP-UX and Solaris:
# make CFLAGS="-O2 -fPIC"
# for HP-UX: ld -z -b -o libjpeg.sl `ar t libjpeg.a`
# for Solaris: gcc -shared -o libjpeg.so `ar t libjpeg.a`
# cp -p libjpeg.s? $prefix/lib

make
cp -p libjpeg.a $prefix/lib
cp -p jpeglib.h jconfig.h jmorecfg.h $prefix/include
chmod 644 $prefix/include/j*.h
cd ..

###########
# gettext #
###########

# This step is not needed under Solaris & Linux
# It is needed under HP-UX, Tru64 5.1a, IRIX 6.5, AiX 5.1

tar xzvf gettext-0.11.5.tar.gz
cd gettext-0.11.5
./configure --prefix=$prefix
make
make install

# Under HP-UX, remove -R$prefix/lib in $prefix/lib/libintl.la to work around
# a gettext bug, fixed in recent (CVS) versions of gettext.

# On AiX 5.1, the AiX C compiler does not seem to like the _Bool
# name for the {true, false} enum name. This causes a compilation error
# in stdbool.h. So before doing a make, update stdbool.h.in around line
# 34, and replace all instances of _Bool by BOOL.

cd ..

########
# glib #
########
tar xzvf glib-2.2.3.tar.gz
cd glib-2.2.3

# on Linux:
./configure --prefix=$prefix --enable-debug=minimum

# on other systems:
./configure --prefix=$prefix --enable-debug=minimum --with-libiconv

# possible switches for debugging:
# --enable-gc-friendly --disable-mem-pools

# on Tru64:
make CFLAGS="-g -O2 -mieee -DTRIO_COMPILER_DECC"

# on other systems:
make

make install
cd ..

#######
# atk #
#######
tar xzvf atk-1.2.4.tar.gz
cd atk-1.2.4

./configure --prefix=$prefix
make
make install
cd ..

#########
# pango #
#########
tar xzvf pango-1.2.5.tar.gz
cd pango-1.2.5

# Apply this patch if you want to ease distributing stand alone executables:
patch -p0 < .../GtkAda/contrib/pango-1.2.5.diff

# Note: to get all modules included, we could use --with-included-modules=yes
# but basic-x should be all we need. In the future, we may want to also
# include basic-xft, which requires additional librairies. Other modules are:
# arabic-x,arabic-xft,hebrew-x,basic-x,basic-ft2,basic-xft,basic-win32,
# hangul-x,tamil-x,tamil-xft,thai-x,gurmukhi-x,bengali-x,gujarati-x,
# devanagari-x,myanmar-x

# Replace /bin/sh by /bin/bash in order to work around a sh bug under some
# systems (e.g. HP-UX, IRIX):

bash ./configure --prefix=$prefix --with-included-modules=basic-x
make
make install
cd ..

#######
# gtk #
#######
tar xzvf gtk+-2.2.4.tar.gz
cd gtk+-2.2.4

# Under certain platforms such as AiX or NT, a very recent version of
# libtool may be needed. To install the most recent version of libtool,
# do the following:
# rm -f config.cache
# libtoolize --force --copy
# aclocal
# autoconf

# This patch fixes regressions in Gtk+
patch -p0 < .../GtkAda/contrib/gtk+-2.2.4.diff

# Under HP-UX, make sure that libX11.sl, libXt.sl and libXext.sl can be found
# under e.g /usr/lib

./configure --disable-modules --without-libtiff \
  --with-included-loaders=xpm,png,gif,jpeg --prefix=$prefix \
  --enable-debug=minimum

# For debugging Gtk+ and enable Gtk+ traces, use --enable-debug=full

make
make install
cd ..

#####################
# optional: glade 2 #
#####################

###########
# libxml2 #
###########

# libxml2 is only needed by glade

tar xzvf libxml2-2.5.7.tar.gz
cd libxml2-2.5.7
./configure --prefix=$prefix
make
make install
cd ..

#########
# glade #
#########

tar xzvf glade-2.0.0.tar.gz
cd glade-2.0.0
patch -p0 < .../GtkAda/contrib/glade-2.0.0.diff
autoconf
./configure --prefix=$prefix --disable-gnome

# Under Tru64:
make CFLAGS="-g -O2 -mieee -DTRIO_COMPILER_DECC"

# On other platforms:
make

make install
cd ..

