19.3. Build and Install Platform Detection

As we mentioned above, the first step to multi-platform package building is to identify the build platform. This is done by matching information from the build system's uname output against a number of rpmrc file entries.

Normally, it's not necessary to worry too much about the following rpmrc file entries, as RPM comes with a set of entries that support all platforms that currently run RPM. However, when adding support for new platforms, it will be necessary to use the following entries to add support for the new build platform.

19.3.1. Platform-Specific rpmrc Entries

Normally, the file /usr/lib/rpmrc contains the following rpmrc file entries. They can be overridden by entries in /etc/rpmrc or ~/.rpmrc. This is discussed more completely in Appendix B.

Because each entry type is available in both architecture and operating system flavors, we'll just use xxx in place of arch and os in the following descriptions.

19.3.2. Overriding Platform Information At Build-Time

By using the rpmrc file entries discussed above, RPM usually makes the right decisions in selecting the build and install platforms. However, there might be times when RPM's selections aren't the best. Normally the circumstances are unusual, as in the case of cross-compiling software. In these cases, it is nice to have an easy way of overriding the build-time architecture and operating system.

The --buildarch and --buildos options can be used to set the build-time architecture and operating system rather than relying on RPM's automatic detection capabilities. These options are added to a normal RPM build command. One important point to remember is that, although RPM does try to find the specified architecture name, it does no checking as to the sanity of the entered architecture or operating system. For example, if you enter an entirely fictional operating system, RPM will issue a warning message, and then happily build a package for it.

Why? Wouldn't it make more sense for RPM to perform some sort of sanity check? In a word, no. One of RPM's main design goals was to never get in the way of the package builder. If someone has a need to override their build platform information, they should know what they're doing, and what the full implications of their actions are.

Bottom line: Unless you know why you need to use --buildarch or --buildos, you probably don't need to use them.

19.3.3. Overriding Platform Information At Install-Time

It's also possible to direct RPM to ignore platform information while a package is being installed. The --ignorearch and --ignoreos options, when added to any install or upgrade command, will direct RPM to proceed with the install or upgrade, even if the package's platform doesn't match the install platform.

Dangerous? Yes. But it can be indispensable in certain circumstances. Like the ability to override platform information at build-time, unless you know why you need to use --ignorearch or --ignoreos, you probably don't need to use them.