Installation Guide
This installation guide will explain you the step-by-step procedure to install eccvs as well as the gtk-2.6 (GIMP Tool Kit Version 2.6 series).
Although this guide explains the procedure to install the gtk-2.6, it can be adopted to install other versions also.
Table Of Contents
- 1. Installing eccvs
- 2. Installing Gtk+
1. Installing eccvs
eccvs depends on gtk-2.6. If you have installed gtk-2.6 in a different location (other than the usual /usr), then you need to set the LD_LIBRARY_PATH and PKG_CONFIG_PATH variables. Let me assume that you have installed gtk-2.6 in /opt/gtk-2.6. Just execute the following procedure before proceeding to install eccvs.
$ export LD_LIBRARY_PATH=/opt/gtk-2.6/lib
$ export PKG_CONFIG_PATH=/opt/gtk-2.6/lib/pkgconfig:/usr/lib/pkgconfig
You need to set these variables whenever you rebuild the sources. These environment variables need to be set only when you closed your terminal and restarted it freshly.
1. Extract the eccvs distribution tarball
$ tar zxvf eccvs-<version>.tar.gz
$ cd eccvs-<version>
2. Configure and install the software
$ ./configure --prefix=/usr
$ make
[su if necessary]
# make install
Now, you can execute eccvs using the following command.
$ eccvs
If you don't want to install the eccvs but you want to build and run it, you can just use the following make command.
$ make clean
$ make CPPFLAGS=-DNO_INSTALL
$ cd src
$ ./eccvs
Developers of eccvs can use the "./autogen.sh" command to rebuild all the autotools related stuff. This step is needed whenever you change any of the autotools configuration files(like Makefile.am, configure.in, etc.,).[This is applicable only for those who have checked out the source code from the CVS server.]
NOTE: Currently, eccvs overwrites the already installed version of CVS binary and if you don't want this to happen then you need to set --prefix to different location.
2. Installing Gtk+
Contents
- 1. Introduction
- 2. Step-by-Step Procedure
- 3. Compiling Programs Against Gtk+-2.6
- 4. A Sample Program
- 5. Making Themes To Work
- 6. Why Do We Set Environment Variables?
1. Introduction
This tutorial is a simple step by step guide which is intended for the newbies to install and work with the recent development release of gtk+ library.
The main aim of this small tutorial is not to affect the existing system configuration. This is achieved by installing Gtk+ in a separate directory. If you don't have Gtk+ source code then you can download the recent version of Gtk+ from here.
The following system configuration has been used to test this installation guide.
Processor: Intel Pentium-4 1.6 GHz
RAM: 512 MB DDR
Chipset: Intel 845 GL
OS: Fedora Core 1 (Full installation)
HDD Partition sizes:
/ => 1.5G
/boot => 100M
/usr => 7.0G
/opt => 5.6G
/home => 3.9G
/var => 487M
/tmp => 289M
swap => 502M
NOTE: During the installation process, we will set few "Environment Variables". If you want to take a break (during the installation) and closed your shell and started it freshly to continue the installation process, then it is highly likely that the installation may not succeed. To overcome this problem, you need to SET ALL THE ENVIRONMENT VARIABLES as specified in this tutorial, whenever you restart your shell (during installation).
It has been assumed that you have downloaded the most recent version of Gtk+ and its dependencies. This tutorial explains the procedure to install Gtk+ in /opt/gtk-2.6 (You can replace it with the path that will suit your needs).
2. Step-by-Step Procedure
Step 1: Unzip all the source files
This step assumes that you have downloaded the sources into the $HOME/gtk-2.6-source directory and you want to build Gtk+ in the $HOME/gtk-2.6 directory.
$ mkdir $HOME/gtk-2.6
$ cd $HOME/gtk-2.6
$ tar jxvf $HOME/gtk-2.6-source/atk-1.9.0.tar.bz2
$ tar jxvf $HOME/gtk-2.6-source/glib-2.6.3.tar.bz2
$ tar jxvf $HOME/gtk-2.6-source/gtk+-2.6.4.tar.bz2
$ tar jxvf $HOME/gtk-2.6-source/pango-1.8.0.tar.bz2
Gtk+-2.6.4 is also dependent on few other packages like libjpeg, libtiff, gmake, gettext and etc., Since we are using Fedora Core 1, we don't find any need for installing them. We already have those packages in our system (probably older versions). I believe that this method will also work for RedHat Linux 9.0. If not, find out the required packages and install them in the correct order. You can look into the gtk+ documentation for this purpose.
Step 2: Install "glib-2.6.3"
$ cd $HOME/gtk-2.6/glib-2.6.3
$ ./configure --prefix=/opt/gtk-2.6
The "--prefix" option is used to specify the installation directory. You can choose your own directory, but make sure that you have at least 100 MB space. You can use "df -h" command to know about partition sizes. The following process actually uses "$HOME/gtk-2.6" for compiling the source code and "/opt/gtk-2.6" for installing the binaries. In my system, the compilation directory ($HOME/gtk-2.6) took around 220 MB of HDD space while the installation directory (/opt/gtk-2.6) took nearly 90 MB. Checking the HDD space is really important, so don't neglect it.
$ make
[$ su ] --> if necessary (if you don't have write access to /opt/gtk-2.6)
# make install
Now "glib-2.6.3" would have been installed in "/opt/gtk-2.6" directory.
Step 3: Install "pango-1.8.0"
Now, you need to set the following Environment Variables.
$ export PKG_CONFIG_PATH=/opt/gtk-2.6/lib/pkgconfig:/usr/lib/pkgconfig
$ export LD_LIBRARY_PATH=/opt/gtk-2.6/lib
Pango-1.8.0 needs Glib version 2.5.7 or higher. We have already installed glib-2.6.3 but it will not be detected by the "./configure" script unless we set the above environment variables. Click here to learn more about this.
Now, our normal procedure.
$ cd $HOME/gtk-2.6/pango-1.8.0
$ ./configure --prefix=/opt/gtk-2.6
$ make
[$ su ] --> if necessary
# make install
Step 4: Install "atk-1.9.0"
Make sure that PKG_CONFIG_PATH and LD_LIBARY_PATH variables are set as explained above. You can do this by issuing the following commands.
$ echo $PKG_CONFIG_PATH
/opt/gtk-2.6/lib/pkgconfig:/usr/lib/pkgconfig
$ echo $LD_LIBRARY_PATH
/opt/gtk-2.6/lib
If you get an empty line as output for any of the above command, then you need to set the corresponding environment variable accordingly.
$ cd $HOME/gtk-2.6/atk-1.9.0
$ ./configure --prefix=/opt/gtk-2.6
$ make
[$ su ] --> if necessary
# make install
Step 5: Install "gtk+-2.6.4"
Make sure that PKG_CONFIG_PATH and LD_LIBARY_PATH variables are set as explained above. You can do this by issuing the following commands.
$ cd $HOME/gtk-2.6/gtk+-2.6.4
$ ./configure --prefix=/opt/gtk-2.6
$ make
[$ su ] --> if necessary
# make install
3. Compiling Programs Against Gtk+-2.6
Finally, we have installed the gtk+-2.6.4. Now let us see how we can compile our own programs that use gtk+-2.6. GtkIconView widget is newly introduced in gtk+-2.6 (of course in gtk-2.5). So lets use the GtkIconView widget in the sample program to test the newly installed gtk+-2.6.
Just start your "gnome-terminal" and type the following:
$ export PKG_CONFIG_PATH=/opt/gtk-2.6/lib/pkgconfig:/usr/lib/pkgconfig
$ export LD_LIBRARY_PATH=/opt/gtk-2.6/lib
You need to set these ENVIRONMENT VARIABLES whenever you open your terminal freshly. From now onwards, you can compile your programs as usual like the following:
$ gcc -o sample-icon-view sample-icon-view.c `pkg-config --cflags --libs gtk+-2.0`
OK. Now you may have a question in your mind. i.e, HOW CAN I USE MY OLDER GTK LIBRARIES?
Its pretty simple. Just close your terminal and start it freshly and DON'T set the above mentioned ENVIRONMENT VARIABLES. That's it. Now if you execute the above command (gcc -o sampl..) then gcc will show ERROR messages.
4. A Sample Program
The following program needs two PNG images files namely "sample1.png" and "sample2.png". Just use any icons for this purpose (not larger images). These images need to be present in the same directory in which this program resides.
/*
** sample-icon-view.c
*/
#include <gtk/gtk.h>
enum
{
COL_DISPLAY_NAME,
COL_PIXBUF,
NUM_COLS
};
/* Create the ListStore and fill it with required data */
GtkTreeModel *
create_and_fill_model (void)
{
GtkListStore *list_store;
GdkPixbuf *p1, *p2;
GtkTreeIter iter;
GError *err = NULL;
int i = 0;
p1 = gdk_pixbuf_new_from_file ("sample1.png", &err);
/* No error checking is done here */
p2 = gdk_pixbuf_new_from_file ("sample2.png", &err);
list_store = gtk_list_store_new (NUM_COLS, G_TYPE_STRING, GDK_TYPE_PIXBUF);
do {
gtk_list_store_append (list_store, &iter);
gtk_list_store_set (list_store, &iter, COL_DISPLAY_NAME, "gtk+-2.5",
COL_PIXBUF, p1, -1);
gtk_list_store_append (list_store, &iter);
gtk_list_store_set (list_store, &iter, COL_DISPLAY_NAME, "GtkIconView",
COL_PIXBUF, p2, -1);
} while (i++ < 100);
return GTK_TREE_MODEL (list_store);
}
int main (int argc, char *argv[])
{
GtkWidget *window;
GtkWidget *icon_view;
GtkWidget *scrolled_window;
gtk_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL);
gtk_window_set_title (GTK_WINDOW (window), "Sample Icon View Test");
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
gtk_widget_set_size_request (window, 600, 400);
scrolled_window = gtk_scrolled_window_new (NULL, NULL);
gtk_container_add (GTK_CONTAINER (window), scrolled_window);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window),
GTK_SHADOW_IN);
icon_view = gtk_icon_view_new_with_model (create_and_fill_model ());
gtk_container_add (GTK_CONTAINER (scrolled_window), icon_view);
gtk_icon_view_set_text_column (GTK_ICON_VIEW (icon_view),
COL_DISPLAY_NAME);
gtk_icon_view_set_pixbuf_column (GTK_ICON_VIEW (icon_view), COL_PIXBUF);
gtk_icon_view_set_selection_mode (GTK_ICON_VIEW (icon_view),
GTK_SELECTION_MULTIPLE);
gtk_widget_show_all (scrolled_window);
gtk_widget_show (window);
gtk_main ();
return 0;
}
5. Making Themes To Work
Since we have installed the Gtk+ in a different location, these libraries will not be able to find and use the current theme. All your programs that uses gtk+-2.6 will use only the "Default theme". To make gtk+-2.6 themes aware, we need to do the following:
$ su
(give password for "root")
# mv /opt/gtk-2.6/share/themes /opt/gtk-2.6/share/old_themes
# ln -s /usr/share/themes /opt/gtk-2.6/share/themes
# mv /opt/gtk-2.6/lib/gtk-2.0/2.4.0/engines /opt/gtk-2.6/lib/gtk-2.0/2.4.0/old_engines
# ln -s /usr/lib/gtk-2.0/VERSION/engines /opt/gtk-2.6/lib/gtk-2.0/2.4.0/engines
-->here VERSION is your current gtk+ version. In my Fedora system, it is 2.2.0. Check it out for your system.
6. Why Do We Set Environment Variables?
**************TODO****************
|