initCommon(); $template->displayHeader(); ?>

20.2. Configuring RPM Settings

RPM includes hundreds of settings based on your current system architecture, environment, and which version of the RPM system you have installed. The old settings, called rc or rpmrc settings, are gradually being phased out by the newer, more consistent and more powerful macros.

You can still edit the rc settings, but in most cases you should edit macros instead.

20.2.1. Viewing the current settings

To view the current settings, use the --showrc command-line option:

$ rpm –showrc

ARCHITECTURE AND OS:

build arch : i386

compatible build archs: i686 i586 i486 i386 noarch

build os : Linux

compatible build os's : Linux

install arch : i686

install os : Linux

compatible archs : i686 i586 i486 i386 noarch

compatible os's : Linux

RPMRC VALUES:

macrofiles : /usr/lib/rpm/macros:/usr/lib/rpm/i686-linux/macros:/etc/

rpm/macros.specspo:/etc/rpm/macros.db1:/etc/rpm/macros.cdb:/etc/rpm/macros:/etc/

rpm/i686-linux/macros:~/.rpmmacros

optflags : -O2 -march=i686

This command displays the architecture and operating system information first, and then lists all the rpmrc values, shown here truncated for space.

20.2.2. Locating the rpmrc files

The --showrc option reads in all the rpmrc files from the various locations. By default, this is /usr/lib/rpm/rpmrc, /etc/rpm/rpmrc, and a file named .rpmrc (with a leading period) in your home directory.

These files are read in the order given, so that the later files can override settings in the earlier files.

The uses for these files are listed in Table 21-3.

Table 21-3 Uses for the rpmrc files

File

Holds

/usr/lib/rpm/rpmrc

RPM standard settings

/etc/rpm/rpmrc

Per-system configuration

$HOME/.rpmrc

Per-user configuration

Note

The file /usr/lib/rpm/rpmrc gets overwritten each time you upgrade RPM. Do not customize this file.

You can override this list of files by calling the rpm or rpmbuild commands with the --rcfile option. This option expects a semicolon@nddelimited list of files to read in, in order. For example, if you are working on a 686-architecture Intel platform, you can create a file with the following setting:

optflags: i686 -g

Note that this disables optimization, so it is not a good setting. (The use of this value will make the result more visible.)

If you name this file .rpmnew and place it in your home directory, you can configure an alternate set of files with the --rcfile option and then evaluate the new optflags setting. For example:

$ rpm --eval "%{optflags}"

-O2 -march=i386 -mcpu=i686

$ rpm --rcfile $HOME/.rpmnew --eval "%{optflags}"

-g

This example shows the value before and after changing the configuration files.

When you use the --rcfile option, only the first file listed must exist. The rest of the files are optional. When you use the --rcfile option, however, the file /usr/lib/rpm/rpmrc is read first, and then the list of files you provide with the --rcfile option. The file /usr/lib/rpm/rpmrc is always used.

20.2.3. Changing settings

You can edit the per-user or per-system rc files to change the settings. The format of the rpmrc files is fairly simple but contains a few exceptions. The most basic format is:

setting: value

The settings get more complicated as the rpmrc syntax supports defining settings for multiple architectures at once. In that case, the typical format is:

setting: uname: value

The uname portion is replaced by a value that comes from the uname(2) system call, for example, i686 on a 686-class Intel architecture machine.

Note

In most cases, your best bet is to copy an existing setting and modify it, rather than remembering all the exceptions.

20.2.3.1. Setting the optflags

One exception to the rule is the optflags setting, which controls C compiler options for optimization. The format for the optflags setting is:

setting: arch value

There is no colon after the architecture. For example:

optflags: i686 -O2 -march=i686

optflags: alphaev5 -O2 -mieee -mcpu=ev5

This example sets the optimization flags for an i686 system to -O2 -march=i686 and an alphaev5 system to -O2 -mieee -mcpu=ev5. If your system is running on a 686-class processor, you will get one set of optimization flags. If your system is running on a V5 Alpha processor, you will get a different set.

20.2.3.2. Setting the Architecture Values

The arch_canon setting builds up a table of mappings between architecture names and the numbers used internally. The following example shows the Intel and SPARC architecture settings to 1 and 3 internally.

arch_canon: athlon: athlon 1

arch_canon: i686: i686 1

arch_canon: i586: i586 1

arch_canon: i486: i486 1

arch_canon: i386: i386 1

arch_canon: sparc: sparc 3

arch_canon: sun4: sparc 3

arch_canon: sun4m: sparc 3

arch_canon: sun4c: sparc 3

arch_canon: sun4d: sparc 3

arch_canon: sparcv9: sparcv9 3

The arch_compat setting builds a table of compatible architectures. The format is:

arch_compat: arch: compatible_with

This sets the given architecture arch as being compatible with another architecture.

For example:

arch_compat: athlon: i686

This setting indicates that an athlon architecture is compatible with an i686. The table gets built up further with the following Intel-architecture compatibilities:

arch_compat: i686: i586

arch_compat: i586: i486

arch_compat: i486: i386

arch_compat: i386: noarch

The os_canon setting defines a table of operating system labels and internal numeric values. The basic syntax is:

os_canon: arch: name value

The arch comes from the uname(2) call. The name provides an RPM name for that operating system, and the value defines an internal numeric ID for that OS, for example:

os_canon: Linux: Linux 1

os_canon: HP-UX: hpux10 6

The buildarchtranslate setting defines the operating system settings to use as the build architecture. This value translates information from the uname(2) call to a value used by the arch_canon setting. For example:

buildarchtranslate: athlon: i386

buildarchtranslate: i686: i386

buildarchtranslate: i586: i386

buildarchtranslate: i486: i386

buildarchtranslate: i386: i386

buildarchtranslate: sun4c: sparc

buildarchtranslate: sun4d: sparc

buildarchtranslate: sun4m: sparc

buildarchtranslate: sparcv9: sparc

buildarchtranslate: sun4u: sparc64

displayFooter('$Date: 2005/11/02 19:30:07 $'); ?>