How do I build glean?

Although glean is intended to run on a variety of operating systems, the only documented version at the moment is for the Linux kernel, XFree86 X11 server, and GNU program development tools. This page describes how to build glean on such a system.

glean has been ported to Microsoft Windows, using the VC6 integrated development environment. The glean ZIP archive includes text files translated for Windows and Visual Studio workspace definition files. Help in documenting the process for building and using glean under Windows would be greatly appreciated!

To help port glean to other systems, please see Where do we go from here?.

Other software you'll need

glean stores images in the TIFF format, because it's one of the few standard formats that's capable of handling images with 32-bit and floating-point color values. The best widely-available library for handling TIFF is Sam Leffler's libtiff. Your operating system distribution probably includes this library already; if not, you'll need to obtain a copy of the source and compile it according to the instructions contained therein.

Some of the tools in the glean suite use Mark Kilgard's GLUT library. Again, your OS distribution (or your MESA distribution) may already include GLUT, but if not, you'll need to grab a copy and install it.

The present versions of glean Makefiles depend on features of GNU make. (In particular, the automatic re-scanning of all dependency files after any have changed.) If your version of make is known to be significantly incompatible with GNU make, then you will need to acquire a copy of GNU make or modify glean's Makefiles.

glean makes extensive use of the C++ Standard Template Library. If your C++ compiler fails to compile glean, you may want to try egcs. glean was developed with egcs 1.1.2.

Obtain the source code

Obtain the gzipped tar file containing glean from ftp://ftp.mesa3d.org/mesa/contrib/.

Unpack the tar file:

    tar xfz glean_0_5.tgz
    cd glean_0_5
This will create a subdirectory named glean_0_5 and make it your current directory.

Set the GLEAN_ROOT environment variable

To compile or run glean, you will need to set the environment variable GLEAN_ROOT to the full pathname of the glean source directory. If you're following along, this is your current directory, so this command should do the trick for users of csh and its descendants:

    setenv GLEAN_ROOT `pwd`
and this command should work for users of sh and its descendants:
    GLEAN_ROOT=`pwd`; export GLEAN_ROOT
Be sure to set the environment variable each time you want to compile or run glean. Perhaps the easiest way to ensure this is to set it in your shell's startup script.

Set Makefile options

Edit $GLEAN_ROOT/make/common.mak and modify the configuration variables according to your preferences. Some of the variables that are most likely to need customization are:

CONFIG
This variable selects the operating system and window system for which glean will be compiled. The OS option must be either __UNIX__ or __MS__. The window-system option must be either __X11__ or __WIN__. (Yes, there is some ambiguity between the OS and the window system in Microsoft's case. However, there are X11 products that run under Windows, so the combination of __MS__ and __X11__ is possible.) By default, this variable is set to "-D__UNIX__ -D__X11__".
CC
This variable specifies the location of the C++ compiler. By default it is "g++".
XINC, GLINC, GLUTINC, TIFFINC
These variables specify the directories containing include files for X, OpenGL, GLUT, and libtiff, respectively. The defaults are /usr/include/X11, /usr/local/include, /usr/local/include, and /usr/include, respectively.
XLIB, GLLIB, GLUTLIB, TIFFLIB
These variables specify the directories containing libraries (libX11, libGL, libglut, and libtiff, respectively). The defaults are /usr/X11R6/lib, /usr/local/lib, /usr/local/lib, and /usr/lib, respectively.
_INC, _OPT, _DBG, _WARN, _LIBDIR, _LIB, _PROF
These variables define C++ command-line options for include-file directories, optimization, debugging, warnings, library directories, libraries, and profiling. These apply universally, to all glean compilations. Individual Makefiles can make local additions to these defaults by defining corresponding variables whose names do not have a leading underscore.

Build glean

When you've finished editing the Makefile, simply type

    cd src
    make install
This will build glean and the other tools in the suite, and install them in $GLEAN_ROOT/bin.