Previous Next Contents

3. Building Zap!

The source code for Zap! in included in the ASF Standalone and Interoperable distributions.

3.1 ZAP as a CGI program

  1. Get YAZ and compile it. See www.indexdata.dk/yaz.html
  2. Unpack ZAP.
        $ gunzip -c zap-<version>.tar.gz|tar xvf -
    
       Structure now:
          +-- yaz ---- include
          |    |
          |    + ----- libs
          |    |
          |   ...
          |
          +-- zap ---- src               (mod_zap.c, makefile)
               |
               +------ htdocs
                         +
                         +------- zap    (cgi.html, default.zap, ..)
    
  3. Goto the 'src' sub directory and edit the lines in the makefile beginning with YAZLIB and YAZINC to point to the YAZ libs/source. Also specify your HTTP server root in the ZAP_ROOT line.
        $ cd zap/src
        $ vi makefile
    
  4. Compile the ZAP source.
        $ make 
    
  5. Copy the resulting binary 'zap' to your Web server's CGI bin directory.
        $ cp zap /usr/local/etc/httpd/cgi-bin  (or whereever it's located)
    
  6. Create a zap directory in your Web server's HTML docs directory. Copy the ZAP configurations as well as the HTML sample forms to the new directory.
        $ mkdir /usr/local/etc/httpd/htdocs/zap  (or whereever it's located)
        $ cp htdocs/zap/* /usr/local/etc/httpd/htdocs/zap
    
  7. Try it out: http:/zap/cgi.html

3.2 Using ZAP as an Apache module

  1. Get YAZ and compile it. See www.indexdata.dk/yaz.html
  2. Get Apache - don't compile it yet! (www.apache.org)
  3. Create a zap symbolic link to your Apache directory. For example
        $ ln -s apache_1.2b10 zap
    
    4) Unpack zap.tar.gz
        $ gunzip -c zap<version>.tar.gz|tar xvf -
    
       Structure now:
          +-- yaz
          |
          |   (zap)
          +-- apache -- src               (mod_zap.c and apache C files)
                |
                +------ htdocs
                |         +
                |         +------- zap    (search.html, default.zap, ..)
                |
                |
                +------ logs ..           (access_log, ... zap_log)
    
  4. Goto the "src" subdirectory in Apache. Edit the Apache file "Configuration".
    1. Edit the EXTRA_CFLAGS and add YAZ C include path:
                   EXTRA_CFLAGS=-I../../yaz/include -DUSE_APACHE=1
      

    2. Edit the EXTRA_LIBS and specify the YAZ library:
                   EXTRA_LIBS=../../yaz/lib/libyaz.a
      

    3. Announce the ZAP module by adding a line as follows:
                   Module  zap_module mod_zap.o
      

  5. Run Apache's ./Configure
  6. Run "make" to build Apache.
  7. Customize the Apache configuration files in the conf directory as needed. Add the following lines in access.conf to activate the ZAP module whenever the sub directory "search" is accessed.
          <Location /search>
          SetHandler z39.50-search
          </Location>
    
    You can choose another directory name than search, but we recommend, that you use this name since all example forms rely on this name, i.e. all URLs with the prefix "http:/search" invokes the ZAP module.
  8. Try it out: http:/zap/try.html or http:/zap/simple.html


Previous Next Contents