# Installation

Zebra is written in ANSI C and was implemented with portability in mind. We primarily use GCC on UNIX and Microsoft Visual C++ on Windows.

The software is regularly tested on Debian GNU/Linux, Redhat Linux, Gentoo Linux, SuSE Linux, NetBSD (Cobalt), FreeBSD (i386), MAC OSX, SunOS 5.8 (sparc), Windows 2000 SP3.

Zebra can be configured to use the following utilities (most of which are optional):

yaz (required)

  Zebra uses YAZ to support Z39.50/SRW. Also the memory management utilites from YAZ is used by Zebra.

iconv (optional)

  Character set conversion. This is required if you're going to use any other character set than UTF-8 and ISO-8859-1 for records. Note that some Unixes has iconv built-in.

Expat (optional)

  XML parser. If you're going to index real XML you should install this (filter grs.xml). On most systems you should be able to find binary Expat packages.

Perl (optional)

  Perl is required if you're going to use the Zebra perl filter facility or the Zebra perl API. Perl is preinstalled on many Unixes. We've not tried the Perl extension on Windows ourselves.

Tcl (optional)

  Tcl is required if you need to use the Tcl record filter for Zebra. You can find binary packages for Tcl for many Unices and Windows.

Autoconf, Automake (optional)

  GNU Automake and Autoconf are only required if you're using the CVS version of Zebra. You do not need these if you have fetched a Zebra tar.

Docbook and friends (optional)

  These tools are only required if you're writing documentation for Zebra. You need the following Debian packages: jadetex, docbook, docbook-dsssl, docbook-xml, docbook-utils.

## UNIX

On Unix, `gcc` works fine, but any native C compiler should be possible to use as long as it is ANSI C compliant.

Unpack the distribution archive. The `configure` shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile` in each directory of Zebra.

To run the configure script type:

         ./configure

The configure script attempts to use C compiler specified by the `CC` environment variable. If this is not set, `cc` or GNU C will be used. The `CFLAGS` environment variable holds options to be passed to the C compiler. If you're using a Bourne-shell compatible shell you may pass something like this:

         CC=/opt/ccs/bin/cc CFLAGS=-O ./configure

The configure script support various options: you can see what they are with

         ./configure --help

Once the build environment is configured, build the software by typing:

         make

If the build is successful, two executables are created in the sub-directory `index`:

`zebrasrv`

  The Z39.50 server and search engine.

`zebraidx`

  The administrative indexing tool.

You can now use Zebra. If you wish to install it system-wide, then as root type

         make install

By default this will install the Zebra executables in `/usr/local/bin`, and the standard configuration files in `/usr/local/share/idzebra` You can override this with the `--prefix` option to configure.

## WIN32

The easiest way to install Zebra on Windows is by downloading an installer from here. The installer comes with source too - in case you wish to compile Zebra with different Compiler options.

Zebra is shipped with "makefiles" for the NMAKE tool that comes with Microsoft Visual C++. Version 6 has been tested. We expect that zebra compiles with version 5 as well.

Start a command prompt and switch the sub directory `WIN` where the file `makefile` is located. Customize the installation by editing the `makefile` file (for example by using notepad).

The following summarizes the most important settings in that file:

`DEBUG`

  If set to 1, the software is compiled with debugging libraries (code generation is multi-threaded debug DLL). If set to 0, the software is compiled with release libraries (code generation is multi-threaded DLL).

`YAZDIR`

  Directory of YAZ source. Zebra's makefile expects to find `yaz.lib`, `yaz.dll` in yazdir`/lib` and yazdir`/bin` respectively.

`HAVE_EXPAT`, `EXPAT_DIR`

  If `HAVE_EXPAT` is set to 1, Zebra is compiled with Expat support. In this configuration, set `ZEBRA_DIR` to the Expat source directory.

`HAVE_ICONV`, `ICONV_DIR`

  If `HAVE_ICONV` is set to 1, Zebra is compiled with iconv support. In this configuration, set `ICONV_DIR` to the iconv source directory.

  iconv binaries can be downloaded from this site.

`BZIP2INCLUDE`, `BZIP2LIB`, `BZIP2DEF`

  Define these symbols if Zebra is to be compiled with BZIP2 record compression support.

The `DEBUG` setting in the makefile for Zebra must be set to the same value as `DEBUG` setting in the makefile for YAZ. If not, the Zebra server/indexer will crash.

When satisfied with the settings in the makefile, type

         nmake

If the `nmake` command is not found on your system you probably haven't defined the environment variables required to use that tool. To fix that, find and run the batch file `vcvars32.bat`. You need to run it from within the command prompt or set the environment variables "globally"; otherwise it doesn't work.

If you wish to recompile Zebra - for example if you modify settings in the `makefile` you can delete object files, etc by running.

         nmake clean

The following files are generated upon successful compilation:

`bin/zebraidx.exe`

  The Zebra indexer.

`bin/zebrasrv.exe`

  The Zebra server.