Here are the complete procedures to build Gtk+ 2.2.4 from scratch
(Systems tested are Redhat 8.0, Solaris/sparc 2.5.1, Solaris/sparc 8,
 Solaris/x86 2.6, 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.

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

On x86-solaris, use GCC 3.4, since earlier versions have lots of subtle
problems related e.g. to include files.

On AiX and IRIX, 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.

Download

pkgconfig, glib, pango, atk, gtk+ can be found at ftp://ftp.gtk.org/pub/gtk/

##############

prefix=/opt/gtk-2.0

##############
# pkg-config #
##############
tar xzvf pkgconfig-0.14.0.tar.gz
cd pkgconfig-0.14.0

# IRIX: Apply the following patch to avoid an error with SGI cc:
# patch -p0 < .../GtkAda/contrib/pkgconfig-0.14.0.diff

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

PATH=$prefix/bin:$PATH
LD_LIBRARY_PATH=$prefix/lib:$LD_LIBRARY_PATH
LDFLAGS=-L$prefix/lib
PKG_CONFIG_PATH=$prefix/lib/pkgconfig:/usr/lib/pkgconfig

export PATH LDFLAGS LD_LIBRARY_PATH PKG_CONFIG_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

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

# Not needed on Linux, 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 ..

# At this point, follow instructions in xft-built.txt if you want to
# enable Xft support on non Linux platforms

############
# 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

##########
# 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

# Under IRIX:
# make CC=cc

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 IRIX, when using the SGI C compiler, configure verifies that
# the preprocessor accepts the libintl.h include. Unfortunately,
# the default expression to call the preprocessor is not honoring
# the C_INCLUDE_PATH. So we need to give configure a small hand:
# CPP="cc -E -I$C_INCLUDE_PATH"
# export CPP

# On x86-solaris, there is a dependency on libgcc_s.so for which GCC didn't
# add a rpath, so we need to help the loader find it by adding
# the path to this library in LD_LIBRARY_PATH. This will be needed
# throughout the rest of the gtk builds, so let's export the change.
# LD_LIBRARY_PATH=...gcc-install/lib:$LD_LIBRARY_PATH

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

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

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

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

# on other systems:
make all install

cd ..

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

./configure --prefix=$prefix
make all 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
touch -r aclocal.m4 configure.in

# 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

# If you have Xft2 available, e.g. under Redhat 8.0 and above
./configure --prefix=$prefix \
	--with-included-modules=basic-x,basic-xft --disable-debug

# On other platforms:
# 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 --disable-debug

# On x86-solaris 2.6, there seems to be something going on with respect to
# Xlib.h.  When we include this file, there's apparently some macro defined
# that prevents the XEvent structures from being defined.  These definitions
# are forced by defining DNeedFunctionPrototypes.
#
# make CFLAGS='-g -O2 -DNeedFunctionPrototypes' all install
# 
# This doesn't seem to be the case for x86-solaris 2.8.

# On all other platforms, simply do:
make all 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

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

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

make all 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 ..

