C.3. Building Postfix

The source file that you download is in a compressed, tar archive and must be uncompressed using the gzip command. In the same directory as the downloaded bundle, type the following:

$ gzip -d postfix-2.0.10.tar.gz

This uncompresses the file and produces a tar file without the .gz extension. Next, untar the file:

$ tar -xf postfix-2.0.10.tar

This creates a directory called postfix-2.0.10 below the current directory. Set that directory as your current directory for the rest of the compilation:

$ cd postfix-2.0.10

If you accept all of the default parameters for building Postfix, compiling is as simple as executing make in the top-level directory of the distribution:

$ make

Executing make creates a Makefile for your particular platform, which is in turn used to compile Postfix for your system. If you don't need any changes to the default build, you can skip ahead to the Section C.4 section.

C.3.1 Customizing Your Build

The file makedefs contains platform-specific information that Postfix uses when configuring the package for your system. If you are curious, you can look at the file to see which parameters Postfix uses for your platform. It identifies your environment and creates the macros and definitions that are used in the Makefile for building Postfix on your system. The resultant Makefile is invoked by the make command which in turn calls your compiler and linker to build the Postfix system. When you type make as above, all of this happens automatically, so you don't normally need to worry about this file.

If you want to change any of the parameters for your environment, you can execute the build in two steps. The command make makefiles creates a new Makefile based on parameters that you specify on the command line. To set specific parameters, simply define variables on the command line. For example, you can use a different compiler from the default that Postfix chooses for your environment. The following example works on an HP-UX system to be sure that make finds the correct compiler:

$ make makefiles CC="/opt/ansic/bin/cc -Ae"

You would, of course, specify the path to your own compiler plus any necessary options. If you need to specify an additional directory for header files on your system, define CCARGS to include your directory:

$ make makefiles CCARGS="-I /usr/local/include/"

And, of course, you can combine options:

$ make makefiles CC="/opt/ansic/bin/cc -Ae" CCARGS="-I /usr/local/include"

C.3.2 Modifying Postfix Defaults

Postfix provides a lot of flexibility through its configuration files. Nearly all of Postfix's runtime parameters, including the various directories it uses, can be set in its configuration file except, of course, the location of the configuration file itself. You can change the location by defining DEF_CONFIG_DIR within the CCARGS variable:

$ make makefiles CCARGS='-DDEF_CONFIG_DIR="/usr/local/etc/postfix"'

The single and double quotation marks and backslashes are important since the value for DEF_CONFIG_DIR should itself be quoted. After compilation, Postfix looks for its main.cf configuration file in the directory /usr/local/etc/postfix instead of the default directory, /etc/postfix.

You can use combinations of all the examples above to configure the environment you need. If your command line starts to get complicated, you might want to create a simple shell script to execute it for you. See Section C.7 later in this appendix.

Once you have used make makefiles with your specific options to create your Makefile, execute make to build Postfix:

$ make

Postfix(c) The Definitive Guide
Postfix: The Definitive Guide
ISBN: 0596002122
EAN: 2147483647
Year: 2006
Pages: 130
Authors: Kyle Dent D.
Simiral book on Amazon

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