home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  

Book HomeMac OS X for Unix GeeksSearch this book

9.4. X11-based Applications and Libraries

You can also use Fink to install many X11-based applications, such as the GNU Image Manipulation Program (GIMP), xfig/transfig, ImageMagick, nedit, and many others. Since Fink understands dependencies, installing some of these applications will cause Fink to first install several other packages. For example, since the text editor nedit depends on Motif libraries, Fink will first install lesstif. (This also gives you the Motif window manager, mwm.) Similarly, when you install the GIMP via Fink, you will also install the packages for GNOME, GTK+, and glib.

You can also use Fink to install libraries directly. For example:

% fink install qt

will install the X11-based Qt libraries. An Aqua version of Qt for Mac OS X is available from Trolltech (http://www.trolltech.com).

9.4.1. Building X11-based Applications and Libraries

If you cannot find binaries for X11-based applications (or if you prefer to build the applications yourself), most of the tools to do this are available. First, you need Apple's Developer Tools. If you installed XFree86 by hand, make sure you installed XProg.tgz, which contains development tools and header files needed for building X11-based applications. The XDarwin distribution includes these tools and header files.

The process of building software usually begins with generating one or more makefiles customized to your system. For X11 applications, there are two popular methods for generating makefiles. One method is to use a configure script (see Section 4.2 in Chapter 4.)

The other popular method for generating makefiles involves using the xmkmf script, which is a frontend to the imake utility. xmkmf invokes imake, which creates a makefile. To do this, imake looks for a template file called Imakefile.

With imake-driven source releases, after downloading a source tarball, unpacking it, and changing to the top-level source directory, you'll find an Imakefile. After reading the README or INSTALL files, examine the Imakefile to see if you need to change anything. Then the next step is usually to issue the command:

% xmkmf -a

When invoked with the -a option, xmkmf reads imake-related files in /usr/X11R6/lib/X11/config and performs the following tasks recursively, beginning in the top-level directory and then in the subdirectories, if there are any:

% make Makefiles 
% make includes
% make depend

The next steps are usually make, make test (or make check), and make install.

To illustrate this method of building software, consider the script in Example 9-1, which downloads and builds an X11-based game.

Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.