optflags — The Other rpmrc File Entry

While the optflags entry doesn't play a part in determining the build or install platform, it does play a role in multi-platform package building. The optflags entry is used to define a standard set of options that can be used during the build process, specifically during compilation.

The optflags entry looks like this:
optflags: <architecture> <value>
        

For example, assume the following optflags entries were placed in an rpmrc file:
optflags: i386 -O2 -m486 -fno-strength-reduce
optflags: sparc -O2
        

If RPM was running on an Intel 80386-compatible architecture, the optflags value would be set to -O2 -m486 -fno-strength-reduce. If, however, RPM was running on a Sun SPARC-based system, optflags would be set to -O2.

This entry sets the RPM_OPT_FLAGS environment variable, which can be used in the %prep, %build, and %install scripts.