Setting optimizations for rpmbuild in Fedora 12 i686

Note to self:

Fedora 12 Koji settings for i686 builds are:

CFLAGS="${CFLAGS:--O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables}"
CXXFLAGS="${CXXFLAGS:--O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables}"
FFLAGS="${FFLAGS:--O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables}"

using bash.

In order to set this up for a rpmdev/rpmbuild local environment, one must add this to .bashrc or the initialization file of one’s preferred shell, whatever that is, adjusting the syntax as needed.

And to have binary rpms with the correct arch settings, add this to ~/.rpmrc:

%_target_platform i686-redhat-linux
%_build_arch i686

Although _target_platform is redundant it is better to be safe than sorry,,, CAVEAT LECTOR: I’m certain this is not the way to do it, cleanly at least. RPM is… Well… Complicated. We go a long way and I still can’t stomach the thing.