Upgrading GTK

From LSDevLinux
Jump to: navigation, search

To use new features in gtkmm 2.10, I need to upgrade GTK2+ and gtkmm. This is the procedure I followed:

Grab the source for GTK2+ and gtkmm from GNOME:

$ cvs -d :pserver:anonymous@anoncvs.gnome.org:/cvs/gnome login
$ cvs -z9 -d :pserver:anonymous@anoncvs.gnome.org:/cvs/gnome co -r gtk-2-10 gtk2.10
$ cvs -z9 -d :pserver:anonymous@anoncvs.gnome.org:/cvs/gnome co -r GTKMM_2_10_1 gtkmm

Check package requirements in gtk2.10

$ cd gtk+
$ ./autogen --prefix=/opt/gtk
$ make (-j2)
# make install

Check requirements for gtkmm (In this case a later version of cairomm)

Install cairomm

$ cvs -d:pserver:anoncvs@anoncvs.freedesktop.org:/cvs/cairo login
$ cvs -d:pserver:anoncvs@anoncvs.freedesktop.org:/cvs/cairo co -r RELEASE_1_2_2 cairomm
$ cd cairomm
$ ./autogen --prefix=/opt/gtk
$ make (-j2)
# make install

Install gtkmm. Note that the environment variable PKG_CONFIG_PATH needs to be set in order for configure to see the newly installed cairomm

$ cd gtkmm
$ export PKG_CONFIG_PATH=/opt/gtk/lib/pkgconfig:/usr/lib/pkgconfig
$ ./autogen.sh --prefix=/opt/gtk
$ make (-j2) (Long process)
# make install

(Also installed cairo-1.2.6 using download from website and similar method of installation)

Building against the installed packages

Add to makefile:

PKG_CONFIG_PATH=/opt/gtk/lib/pkgconfig:$PKG_CONFIG_PATH
LD_LIBRARY_PATH=/opt/gtk/lib:$LD_LIBRARY_PATH 

Running the executables

LD_LIBRARY_PATH should point to the newer libraries to use them when running your program.

For example,

$ LD_LIBRARY_PATH=/opt/gtk/lib:$LD_LIBRARY_PATH ./a.out

or

$ export LD_LIBRARY_PATH=/opt/gtk/lib:$LD_LIBRARY_PATH
$ ./a.out