<< February 2, 2004 | Home | February 4, 2004 >>

XQuery, Kawa, Readline, ...

In my Introduction to XQuery article posted 32 days ago, I used Per Bothner's XQuery processing tool Qexo.

Qexo is actually a small part of something bigger called Kawa that started out as a Scheme implementation but grow into a JVM language framework that supports other languages.

One key feature of Kawa is that it compiles programs (scheme, XQuery, etc.) down to Java bytecodes without going through the JDK's compiler (no intermediate Java source code, no temporary working directory to hold them, compiled classes can be loaded immediately to the JVM). Another feature is its interactive shell that supports the GNU readline command line editing and command line history, which makes using it that much friendly.

Building Kawa on Linux is a breeze. You just do something like:

[weiqi@gao] $ ./configure --prefix=/opt/kawa \
                          --enable-kawa-frontend \
                          --enable-servlets \
                          --enable-swing
[weiqi@gao] $ make
[weiqi@gao] $ make install

However building Kawa on Windows is not easy. You can build it using Ant, but then you don't get to use the Readline command line editing feature. In the past I have modified the generated Makefiles to straighten out the CLASSPATH handling (Sun's javac doesn't like colon separated CLASSPATH, which the Makefile uses).

Lately I've found a workaround that will build Kawa on Windows with GNU readline support. To do this you need to have Cygwin (which includes GCC 3.3.1, and GNU readline) installed. The idea is to build Java class files and the jar file using Ant, and then build the Kawa frondend, a native program with readline support, whose source files and Makefile reside in the bin subdirectory, using GCC. Here's the full procedure:

[weiqi@gao] $ ./configure --prefix=/opt/kawa \
                          --enable-kawa-frontend \
                          --enable-servlets \
                          --enable-swing
[weiqi@gao] $ ant
[weiqi@gao] $ cd bin
[weiqi@gao] $ make
[weiqi@gao] $ cd ..
[weiqi@gao] $ make install