giza - installation

- news
- download
- documentation
- contact
- samples

# Installation

## Getting ready

You will need some basic build tools such as make and a c compiler. Most linux distributions provide packages containing these tools. In Ubuntu the required packages are make and gcc. You will also need the development packages for cairo and x11. In Ubuntu these packages are libcairo2-dev and libx11-dev.

## Get the source

The first step is to get a copy of the code. There are two ways to do this; either get the current source from the subversion repository, or grab the latest tar ball from our download page.

To check out a copy of the code from subversion change to a directory to build the code in, for exampe /path/to/my/home/src/. Then use the following command:

git clone https://github.com/danieljprice/giza.git

It is always best to get the newest code from the subversion repository if possible, but if you don't have subversion installed then grab the newest tarball from here. Move the tar file to a directory in your home directory to build it in. For example /path/to/my/home/src. Then change to this directory and untar the code with the following command:

tar xzvf giza-1.2.0.tar.gz

But replace giza-1.2.0.tar.gz with the version of giza you have.

## Configuration

Once you have the code you may need to configure it for you system. If you are using a linux system and cairo and x11 are installed in the standard places you may skip this section.

#### Specify the location of dependancies

If cairo and/or xlib are not installed in /usr/local and /usr/X11R6 respectivly you will need to specify their location in the make file. To do this open build/Makefile. Near the top of the file the variables X11LIBS, CAIROLIBS are set. Modify these lines so that the specify the location of the cairo and x11 libraries, i.e.

X11LIBS=-L/path/to/X11/lib -lX11
CAIROLIBS=-L/path/to/cairo/lib -lcairo

You also need to set the include flags so the compiler can find the header. In build/Makefile find where the variable INCFLAGS is set. Add to this the the location of cairo.h and xlib.h, i.e.

INCFLAGS= -I/path/to/xlib/header -I/path/to/cairo/header -I$(INCDIR) -I$(SRCDIR)

Now giza should be able to find it's dependancies.

#### Non linux system

If you are not using gcc on a linux system you will have to specify some system dependant things in the make file. Open build/Makefile and scroll down to the following code:

    ifeq ($(SYSTEM),linux)
      # using gcc
      CC= gcc
      CFLAGS += -fPIC
      SHAREDLIBFLAGS= -shared
      SHAREDEXT=.so
      DEBUGFLAG= -Wall -Wextra -g -O0
      RANLIB= ranlib
      KNOWN_SYSTEM=yes
    endif

You will need to set all these variables according to your system. If you can't get this working, send an email to the address on the contact page and I'll try to give you a hand.

#### Install to a non-standard directory

giza's installation path is determined by the variable PREFIX in build/Makefile, so open this file and find the line where this variable is specified and set it to the path you would like to install to, i.e.

PREFIX=/path/to/giza/installation

## Compiling the code

Once the configuration is complete you must build the code. Simply run the following command:

make

## Install giza

Now the final step is to install the libraries. If you are installing outside your home directory you may need root privileges, sudo should do it:

sudo make install

Now you should be able to link your code to the giza library.