PDA

View Full Version : [SOLVED] optflags not showing correctly when "rpm --rcfile $HOME/.rcfile --eval "%{optflags}"



dasplatypus
29th August 2011, 03:25 AM
When playing around with compiling optimized src.rpms, I came across this description of how to pass optflags:
http://docs.fedoraproject.org/en-US/Fedora_Draft_Documentation/0.1/html/RPM_Guide/ch20s02s02.html

I created a file ~/.rcfile that contains:

optflags: i686 -g

When I run :

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

the output is always

-O2 -g -march=pentium3

Am I doing something incorrectly? Is it possible that this could be a bug in rpm/rpmdevtools and/or gcc?

I'm using
gcc 4.5.1-4.fc14
rpm.i686 4.8.1-5.fc14
rpmdevtools 7.10-1.fc14

I'm pretty new to building rpms from source. Any assistance/suggestions would be greatly appreciated. Thanks
-Chris

Seve
29th August 2011, 03:48 AM
What you need to do is create the following file in your home directory.


$ cat /usr/lib/rpm/rpmrc >> /home/username/.rpmrc

Then edit the /home/username/.rpmrc file to add the custom options you want for your native arch.

e.g.


optflags: x86_64 -O3 -g -mtune=native -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4
Save you work and then from your home directory run:


$ rpm -rcfile .rpmrc --eval "%{optflags}"and you will get the following output, for example.

-O3 -g -mtune=native -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4

dasplatypus
29th August 2011, 03:57 AM
Thanks Seve, that did the trick.