Building Rivet

To get started, you may need the latest version of python (use version 1.3 or later). Rivet contains Tk, so you don't need to get Tcl/Tk.

Then give it a try. Type make.

Or you can run make from each of rivet's subdirectories. In this case, they should be built in this order: tcl7.4, tk, rivet, python.

If you're compiling with gcc, use make CC=gcc CFLAGS=-fwritable-strings.

You may have to change a few pathnames in the makefiles, such as /usr/local/ or /usr/openwin. Typically, you'll just have to change rivet/Makefile and python/Makefile, especially if you do not have Python installed in /usr/local. Most of these changes are self explanatory and at the top of the Makefiles. I've tried to keep the number of compile flags down to a minimum, although both Tk and Python have a number of their own.

The Rivet module may be built into the Python binary by static linking or imported on demand as a shared library. The makefile will try to build both static (rivet/rivetmodule.a) and a shared library (rivet/rivetmodule.so). To import the rivetmodule.so shared library from Python, it must be located in Python's sys.path. (You may set this with the PYTHON_PATH environment variable.)

To test if the build works, cd into the python subdirectory. and test by typing python rivettable.py. If it works, you should get something on your display. If it doesn't, it may be failing if python is not configured to support shared libraries, or if python is linked with tkinter.

There are configure scripts in the tk and tcl7.4 directories. These haven't been tested but should work, in a pinch you may need to copy the defines that configure adds to the makefiles into the Makefile in the rivet directory. The only change to the Makefile and Makefile.in in these directories is the removal of files that don't need to be compiled.

If you haven't compiled Python before, compile that first. Then make sure you have made the following targets: install, libinstall, libainstall, and inclinstall. These steps ensure you have installed all the files that are necessary for building Python extensions.


Note: Rivet is incompatible with Tkinter.

If Python is linked with statically with the tkinter module and/or the rivet module, Python will crash when using rivet or tkinter. One possible way to get a single Python binary is to use shared libraries for both tkinter and rivet.


Linking Rivet as a Static Library with Python

Linking rivet statically into Python has performance advantages but requires a little more setup work. The basic steps for altering Python are:

The make should create a new Python binary with rivet compiled in statically. When you run Python, rivet should be listed in sys.builtin_module_names. Be sure to add the python subdirectory to your PYTHON_PATH for access to the python utilities (.py files).


Building Rivet without Python

If you want to program Rivet in C or create a new language binding, you can build Rivet without the Python language stuff. Compile only the files in these directories: tcl7.4, tk, rivet. This will create archive file, rivet/librivet.a, and a sample C application (see app.c). The remainder is up to you. Use the source!


Finding your way around the sources

The structure of the directories are:

tcl7.4
contains code unaltered from the tcl7.4 source base.
tk
contains code unaltered from the tk4.0 (pl1) source base.
rivet
contains tcl and tk code files that have been modified (modifications are bracketed by #ifdef RIVET), the tcl libraries that have been ported to C (*lib.c), some utility routines, and a test application (app.c).
python
contains the Python interface (a C file, a Python utility, and a table widget). Set your PYTHON_PATH to this directory.
pythonexamples
examples in python.
doc
contains some documentation for the Python interface. (There is no documentation for the C interface, except for the code itself.) The file index.html is the master index to all the documentation.
outlinelist
contains an outline list implementation in python. The file rivetlist.py contains a built in demo.