Installing from Source Codethe Basics


Installing software from source code always involves the same basic steps: Download the compressed source code, unpack it (the term most frequently used in the Unix world for expanding compressed code), move to the new directory using cd , compile, and install. The mantra that Unix veterans use is

 ./configure make make test  or  make check make install 

Here's a more detailed look at the general steps involved.

To install software from source code:

1.
Obtain the source code. Usually you do this by downloading a compressed tar file from a Web site. (Review Chapter 4, "Useful Unix Utilities.")

2.
Uncompress the file containing the source code (this automatically creates a directory). The most common way to do this at the command line is to use the tar command with xfvz options.

3.
cd into the newly created directory.

4.
Read the README and INSTALL files (the filenames are in all caps so that they stand out clearlyyou should always read these files).

They will tell you how to configure and install the software.

5.
All the following steps need to be executed as root, so give yourself a root shell with

sudo -s

(review Chapter 7, "Configuring Your Environment with Unix," for more on shells ; see Chapter 11, "Introduction to System Administration," for more on root and sudo ).

6.
Following the instructions in the INSTALL file, configure the source code so that it's ready for the compiler.

The most common configuration method is to run a script called configure that comes with the source code. Type

./configure

The configuration process sometimes asks you questions about your system, which directory you want to install the software in, and what options you want to include. In most cases you can simply accept the default answers, because the configuration process automatically determines the information it needs (such as asking, "Do you have multiple processors?") and creates one or more files (called makefiles ) it uses to run the compiler process in the next step. The INSTALL file is your main reference for specific issues that arise, such as the meanings of available options and when to use them.

7.
Compile the software.

This will almost certainly be a matter of simply running the make command, which reads the makefiles and runs the commands they contain. Makefiles are scripts for building software. You will see quite a bit of output on your screen while make runs the compiler. We show examples of this later in this chapter.

8.
Run any tests included with the source code.

Some packages include preinstallation tests that can be run with make test or make check . Refer to the INSTALL file for specifics.

9.
Perform the actual installation process.

Again, follow the instructions from the INSTALL fileusually a matter of running make install .

If errors are reported , start by rereading the README and INSTALL files and searching on the Web for the exact text of the error message(s).

10.
You're done.

The Mac OS X Developer Tools: Xcode Tools

The Developer Tools, which contain the gcc compiler you need to install software from source code, come on the Mac OS X installation DVD (or on one of the CDs if your copy of Mac OS X came on CDs). The DVD or CD may be labeled "includes Xcode Tools." Xcode is a marketing name for the Mac OS X Developer Tools, and you will sometimes see the terms used interchangeably.

The Xcode Tools are also available from Apple's developer Web site (http://developer.apple.com).




Unix for Mac OS X 10. 4 Tiger. Visual QuickPro Guide
Unix for Mac OS X 10.4 Tiger: Visual QuickPro Guide (2nd Edition)
ISBN: 0321246683
EAN: 2147483647
Year: 2004
Pages: 161
Authors: Matisse Enzer

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