Developing Zebra

From Koha Wiki
Jump to navigation Jump to search

WARNING: This page is under active development! Use at your own risk!



Develop Zebra using Docker

Set up development environment

  1. Launch a Debian/Ubuntu Docker container (I used ubuntu:latest which was still set to Ubuntu 18.04 at the time of my work)
  2. apt-get update
  3. apt-get install wget vim
  4. vi /etc/apt/sources.list.d/indexdata.list
    deb https://ftp.indexdata.com/ubuntu bionic main
    deb-src https://ftp.indexdata.com/ubuntu bionic main
  5. wget -q -O- https://ftp.indexdata.com/debian/indexdata.asc | apt-key add -
  6. apt-get update
  7. apt-get install git build-essential autoconf automake libyaz5-dev libexpat1-dev tcl-dev libbz2-dev libtool xsltproc inkscape
  8. git clone https://github.com/indexdata/idzebra.git
  9. sh buildconf.sh
  10. ./configure
  11. make

Run Zebra

  1. cd examples/marcxml
  2. ../../index/zebraidx init
  3. ../../index/zebraidx update collection-*.xml
  4. ../../index/zebrasrv

Test Zebra

  1. Edit the C code (e.g. index/retrieve.c)
  2. cd to root directory of Git clone
  3. make
  4. Re-run zebrasrv

Run yaz-client

  1. apt-get install yaz
  2. yaz-client localhost:9999
  3. form xml
  4. find @attr 1=_ALLRECORDS @attr 2=103 ""

Notes/Tips

  1. I noticed that "make install" didn't work when I tried it (https://github.com/indexdata/idzebra/issues/36), so I'd recommend statically compiling using "./configure --disable-shared". This is also useful if you want to test your customized Zebra against a Zebra database that you've created using Koha. You can just statically compile and copy the binary over to your target destination and run it using your koha-conf.xml like normal.
  2. While I haven't tried building the RPM or DEB packages, that would probably be the best way to distribute a customized Zebra. That said, at this point, I wouldn't recommend forking and using a customized Zebra in production. I just created this wiki for people to hack on Zebra, so that they can send pull requests to Indexdata or so that they can submit more detailed issue reports to Indexdata. 
  3. Notice that you've compiled Zebra using libyaz5-dev. Some of the core server functionality of Zebra comes from libyaz5, so you may find you need to clone yaz (https://github.com/indexdata/yaz) too so that you can better understand index/zebrasrv.c