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.
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 statically into Python has performance advantages but requires a little more setup work. The basic steps for altering Python are:
rivet /usr/local/src/rivet/python/rivetmodule.a -L/usr/openwin/lib -lX11
makesetup
from your Python-1.3/Modules directory.
make
from the same directory.
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).
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!
The structure of the directories are: