Installing and Building e4Graph
Author: Jacob Levy

Installing and Building e4Graph on Unix

This page explains how to install and use the prebuilt distributions for Unix, and how to build e4Graph from source on Unix.

Using the Prebuilt Distributions on Unix

The prebuilt distributions have the following directory structure:

- The top-level directory contains the files README, INSTALL, readme.html and changes. The name of this directory reflects the version of e4Graph which this release represents; e.g. e4graph-1.2b3 is the third Beta of release 1.2.
- include contains header files for all sub-packages provided by e4Graph.
- docs contains documentation for all sub-packages provided by e4Graph, including this document.
- lib contains shared objects.

The e4Graph shared libraries were compiled with GCC 2.95.2 with -O. If you intend to use the prebuilt distribution as part of another project that you will be building from source, you need to have GCC and G++ 2.7.2.1 or a more recent release of GCC and G++ installed on your system. You may also want to use e4Graph from Tcl or Python. In this case, you only need to do the first two steps in the list below. If you intend to use e4Graph from Java, you only need to do the first and third step in the following list. To use e4Graph in your own project that you will build from source, do the following:

- You must have pre-installed binary distributions of Metakit 2.4.9.2, and optionally Tcl 8.4, Python 2.2.3, and expat-1.95.7 or later if your project uses the Tcl or Python bindings, or the XML facilities. If you intend to use the Java binding, you will need an installed Java Runtime Environment, preferably 1.3.1 or later. See here for how to obtain them. To use the XML, Tcl and Python facilities, you must build sources. Unfortunately, these projects currently does not ship binary releases for Unix.
- Copy lib/libe4graph.so, lib/libtgraph.so, lib/libe4py.so, lib/libe4xml.so, lib/libtxml.so and lib/libe4java.so into a directory in your LD_LIBRARY_PATH environment variable.
- If you intend to use the Tcl binding, copy lib/pkgIndex.tcl into a directory in Tcl's auto_path.
- If you intend to use the Java binding, add lib/e4java.jar to your CLASSPATH.
- Add the include directory to the include path of your project and include e4graph.h in the source files of your project that need direct access to e4Graph types and methods. If your project uses the Tcl binding, include t4graph.h instead; it recursively includes all the other needed files. If your project uses the Python binding, include e4py.h instead; it recursively includes all the other needed files. If your project uses the XML facilities, include e4xml.h instead; it recursively includes all other needed files. If your project uses both the Tcl binding and the XML facilities, include t4xml.h instead; it recursively includes all other depended-on headers.
- Add -le4graph to the link line of your project. If you are building an executable or shared object, this will guarantee that the executable will load the e4Graph library on startup. If your project uses the Tcl binding, add -ltgraph to the link line instead; the Tcl library pulls in all the required shared objects. If your project uses the Python binding, add -le4py to the link line instead; the Python library pulls in all the other required shared objects. If your project uses the XML facilities, add -le4xml to the link line instead; this library pulls in all the other required shared objects. If your project uses both the XML facilities and the Tcl binding, add -ltxml instead; this library also ensures all depended-on shared objects are linked in.

Building e4Graph from Source and Using it

Assume that the e4Graph sources are in /home/user/e4graph-1.0a11. The e4Graph source distribution configure utility automatically figures out where you've installed the needed header files for Metakit, and optionally Tcl, Expat and Java. The configure script looks for Metakit, Tcl, Expat, and Java in /home/user/metakit-2.4.9.2, /home/user/tcl8.4/, /home/user/expat-1.95.7 and in several system wide directories.

Building e4Graph on Unix now requires using GNU Make. GNU Make is preinstalled on most variants of Unix as either make or gmake.

You must first build and install Metakit and optionally Tcl and Expat with GCC and G++ 2.95.2 or a later version. Then change directory to /home/user/e4graph-1.0a11/all and invoke ./configure with the appropriate flags for your situation:

- Specify --enable-tcl if you want to create a Makefile that builds the Tcl binding.
- Specify --enable-xml if you want to create a Makefile that builds the XML facilities.
- Specify --enable-python if you want to create a Makefile that builds the Python binding.
- Specify --enable-java if you want to create a Makefile that builds the Java binding for e4Graph.
- If you specify --enable-xml and --enable-tcl, configure will create a Makefile that builds the Tcl binding, the XML facilities and the needed extension to use the XML facilities in the Tcl binding.
- Specify --with-metakit=<dir> if you want to specify which Metakit distribution to use.
- Specify --with-tcl=<dir> if you want to specify which Tcl distribution to use.
- Specify --with-python-<dir> if you want to specify which Python distribution to use.
- Specify --with-expat=<dir> if you want to specify which Expat distribution to use.
- Specify --with-java=<dir> if you want to specify where to find the Java installation to use.
- Specify --prefix=<dir> if you want to specify the root directory where sub-packages of e4Graph will be installed. The default is /usr/local; header files are installed in /usr/local/include and libraries go into /usr/local/lib.
- Specify --help to see what options, including the above, are supported by configure.
- Specify --with-release=<file-name> to create a Makefile that will build a release of e4Graph. The release file will be deposited in the /home/user/e4graph-1.0a11/all directory. If you specify --with-release, a Makefile will be created that builds all sub-packages when make all is invoked -- it implies --with-tcl and --with-xml. The specified file-name should not have a directory prefix or an archive or compression-related extension (e.g. no .tar and no .Z or .gz). This flag is intended for the maintainers of e4Graph or for those who want to repackage e4Graph as part of their own projects. The default value of this flag, if not specified, is --with-release=e4graph.

Then invoke make with the target you want to build:

- Make all to build all the sub-packages of e4Graph you selected when you invoked configure.
- Make install to build and install all the sub-packages of e4Graph you selected in the directory specified by the --prefix argument, when you invoked configure.
- Make main to build just the main e4Graph library, libe4graph.so.
- Make testcore to build main and the exhaustive test facility, the testcore executable.
- Make tcl to build main and the Tcl binding to e4Graph, libtgraph.so.
- Make python to build main and the Python binding to e4Graph, libe4py.so.
- Make xml to build main and the XML facilities, libe4xml.so.
- Make t4xml to build main, xml and tcl, and the facilities enabling use of the XML capabilities in the Tcl binding, libtxml.so.
- Make java to build main and the Java binding for e4Graph, embodied in libe4java.so.
- Make release to build a release in the file file-name-version.tar.gz where file-name was specified as the parameter of the --with-release flag to configure. This target is intended for the maintainers of the e4Graph package or for those who want to repackage e4Graph as part of their own projects. Suppose you specified --with-release=mye4graph to configure and the current version of e4Graph is 1.3b2; then the release file deposited in the all sub-directory will be named mye4graph-1.3b2.tar.gz.

Read this section to learn how to use the e4Graph sub-packages you just built in your own projects. Invoking make install will do the necessary work for you automatically, according to the parameters you selected when you invoked configure.