From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.6) Gecko/20050323 Firefox/1.0.2 Fedora/1.0.2-1.3.1
Description of problem:
when building ocaml, the optimization flags passed to gcc via RPM_OPT_FLAGS are included but the optimization (-O2) is overridden by -O definitions in the Makefile.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. cd cvs/extras/ocaml
2. make i386
Actual Results: Watch the build logs and notice lines similar to the following:
gcc -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -m32 -march=i386 -mtune=pentium4 -fasynchronous-unwind-tables -I../../byterun -O -fno-defer-pop -Wall -D_FILE_OFFSET_BITS=64 -D_REENTRANT -fPIC -c -o write.o write.c
Expected Results: gcc -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -m32 -march=i386 -mtune=pentium4 -fasynchronous-unwind-tables -I../../byterun -fno-defer-pop -Wall -D_FILE_OFFSET_BITS=64 -D_REENTRANT -fPIC -c -o write.o write.c
The Makefiles seem to contian the following definitions:
CFLAGS=-DCAML_NAME_SPACE -O $(BYTECCCOMPOPTS)
DFLAGS=-DCAML_NAME_SPACE -g -DDEBUG $(BYTECCCOMPOPTS)
Since the CC var is where we're defining the RPM_OPT_FLAGS (./configure -ccoption "gcc $RPM_OPT_FLAGS") the commandline ends up with the RPM_OPT_FLAGS -O2 entered first and the CFLAGS -O overriding it.
Unless upstream has a reason for only compiling with -O, I think we should be pulling the -O from the CFLAGS.
Created attachment 114148 [details]
Patch to allow user defined CFLAGS to override the default optimization level
This is a patch to the ocaml configure script that allows a CFLAGS environment
variable to add to the flags that are eventually passed to gcc when the package
is built. We can then use this functionality in the rpm spec file to send the
RPM_OPT_FLAGS to gcc. This addition occurs after the -O defined by the ocaml
defaults so the RPM_OPT_FLAGS supplied optimization level takes precedence.
Fixes applied and package built.