On Fri, Aug 05, 2011 at 10:54:41AM +0200, Jan de Groot wrote:
On Fri, 2011-08-05 at 15:23 +0800, Ray Rashif wrote:
For eg. some developers like to enforce -O3, so they should first get the system CFLAGS and override it's -O*, if any.
But in general, I agree. We shouldn't enforce anything either unless we're trying to fix something. The ardour PKGBUILD does this [1], maybe it shouldn't, but I assume the -O3 becomes redundant when we pass system CFLAGS to the build as a configuration flag.
[1] http://projects.archlinux.org/svntogit/packages.git/tree/ardour/trunk/PKGBUI...
Looking at ardour, I see it's also patched to support gcc 4.6. Now let's say something about -O3: -O3 optimization can be very bad and the results are extremely dependent on the compiler version. Something that works optimal with gcc 4.4 and -O3 can break completely with gcc 4.6 and -O2.
You should file a bug report if it does. Given the number of PKGBUILDs that patch optimization levels, I would also say that this is only true for a minority of cases.
Just adding -O3 to CFLAGS without knowing which compiler is used is plain stupid. Check this blog for example: http://glandium.org/blog/?p=1975 There someone from Mozilla claims they're finally able to build with O3 +PGO with GCC 4.5. This was at the time we were already doing O2+PGO from our PKGBUILD with 4.5 and now 4.6.