8.4 X11-Based Applications and Libraries

Fink (see Chapter 11) can be used to install many X11-based applications, such as the GNU Image Manipulation Program (GIMP), xfig/transfig , ImageMagick, nedit , and more. Since Fink understands dependencies, installing some of these applications causes 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.

8.4.1 Building X11-Based Applications and Libraries

If you cannot find binaries for X11-based applications, or prefer to build the applications yourself, many tools are available to do so. When you install the Xcode Tools, make sure you install the optional X11SDK , which contains development tools and header files for building X11-based applications. If you didn't install X11SDK when you first installed Xcode, you can still install it from the Xcode CD.

The process of building software usually begins with generating one or more makefile s customized to your system. For X11 applications, there are two popular methods for generating makefiles:

  • You can use a configure script, as described earlier in this chapter.

  • 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 the makefile for you. To do this, imake looks for a template file called Imakefile.

With imake -driven source releases, you'll find Imakefile in the top-level source directory after you download and unpack a source tarball. After reading the README or INSTALL files, examine the Imakefile to see if you need to change anything. 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 instal l .

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

Example 8-2. Downloading and building an X11 game
 # Download the source tarball curl -O ftp://ftp.x.org/contrib/games/xtic1.12.tar.gz # Unpack the tarball gnutar xvfz xtic1.12.tar.gz # Change to the top-level build directory  cd xtic1.12/ # Generate the Makefile xmkmf -a   # Build everything (some X11 apps use 'make World') make # Have fun! ./src/xtic 

8.4.2 AquaTerm

The X Window System is useful to Unix developers and users, since many Unix-based software packages depend on the X11 libraries. An interesting project that sometimes eliminates the need for X windows is the BSD-licensed AquaTerm application, developed by Per Persson (http://aquaterm. sourceforge .net). AquaTerm is a Cocoa application that can display vector graphics in an X11-like fashion. It does not replace X11, but it is useful for applications that generate plots and graphs.

The output graphics formats that AquaTerm supports are PDF and EPS. Applications communicate with AquaTerm through an adapter that acts as an intermediary between your old application's API and AquaTerm's API.

At the time of this writing, AquaTerm has adapters for gnuplot and PGPLOT , as well as example adapters in C, FORTRAN, and Objective-C. For example, assuming that you have installed both X11SDK and AquaTerm, you can build gnuplot (http://www.gnuplot. info ) so that graphics can be displayed either in X windows or in AquaTerm windows.

See AquaTerm's web site for extensive documentation, including the latest program developments, examples, mailing lists and other helpful resources.

Mac OS X Panther for Unix Geeks
Mac OS X Panther for Unix Geeks
ISBN: 0596006071
EAN: 2147483647
Year: 2003
Pages: 212

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net